From fa9855722554735227e11c71ebd0b3c1ed90d282 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 30 Oct 2025 13:34:50 +0000 Subject: [PATCH] Check that the permissions are really an array This accounts for weird data in the permissions column --- app/Models/User.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Models/User.php b/app/Models/User.php index c6cac9f388..2c56c43737 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -237,11 +237,14 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo $permissions = json_decode($this->permissions, true); } - foreach ($permissions as $permission) { - if ($permission != 0) { - return true; + if (($permissions) && (is_array($permissions))) { + foreach ($permissions as $permission) { + if ($permission != 0) { + return true; + } } } + return false; }