mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Continued removal of joint permission non-view queries
Cleaned up PermissionApplicator to remove old cache system which was hardly ever actuall caching anything since it was reset after each public method run. Changed the scope of 'userCanOnAny' to just check entity permissions, and added protections of action scope creep, in case a role permission action was passed by mistake.
This commit is contained in:
@ -71,14 +71,14 @@ function userCan(string $permission, Model $ownable = null): bool
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current user has the given permission
|
||||
* on any item in the system.
|
||||
* Check if the current user can perform the given action on any items in the system.
|
||||
* Can be provided the class name of an entity to filter ability to that specific entity type.
|
||||
*/
|
||||
function userCanOnAny(string $permission, string $entityClass = null): bool
|
||||
function userCanOnAny(string $action, string $entityClass = ''): bool
|
||||
{
|
||||
$permissions = app(PermissionApplicator::class);
|
||||
|
||||
return $permissions->checkUserHasPermissionOnAnything($permission, $entityClass);
|
||||
return $permissions->checkUserHasEntityPermissionOnAny($action, $entityClass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user