mirror of
https://github.com/grocy/grocy.git
synced 2025-08-28 09:01:14 +00:00
Fixed granular user permission checking in GenericEntityApiController (fixes #2025)
This commit is contained in:
@@ -83,16 +83,12 @@ class User
|
||||
return $user->getPermissionList();
|
||||
}
|
||||
|
||||
public static function checkPermission($request, string ...$permissions): void
|
||||
public static function checkPermission($request, string $permission): void
|
||||
{
|
||||
$user = new self();
|
||||
|
||||
foreach ($permissions as $permission)
|
||||
if (!$user->hasPermission($permission))
|
||||
{
|
||||
if (!$user->hasPermission($permission))
|
||||
{
|
||||
throw new PermissionMissingException($request, $permission);
|
||||
}
|
||||
throw new PermissionMissingException($request, $permission);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user