Skip to content

Commit fa98557

Browse files
committed
Check that the permissions are really an array
This accounts for weird data in the permissions column
1 parent 07256fd commit fa98557

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/Models/User.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,14 @@ public function hasIndividualPermissions()
237237
$permissions = json_decode($this->permissions, true);
238238
}
239239

240-
foreach ($permissions as $permission) {
241-
if ($permission != 0) {
242-
return true;
240+
if (($permissions) && (is_array($permissions))) {
241+
foreach ($permissions as $permission) {
242+
if ($permission != 0) {
243+
return true;
244+
}
243245
}
244246
}
247+
245248
return false;
246249
}
247250

0 commit comments

Comments
 (0)