mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Updated shelf menu item to show on custom permission
- Extended new 'userCanOnAny' helper to take a entity class for filtering. Closes #1201
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use BookStack\Auth\Permissions\PermissionService;
|
||||
use BookStack\Entities\Entity;
|
||||
use BookStack\Ownable;
|
||||
|
||||
/**
|
||||
@ -70,12 +71,13 @@ function userCan(string $permission, Ownable $ownable = null)
|
||||
* Check if the current user has the given permission
|
||||
* on any item in the system.
|
||||
* @param string $permission
|
||||
* @param string|null $entityClass
|
||||
* @return bool
|
||||
*/
|
||||
function userCanOnAny(string $permission)
|
||||
function userCanOnAny(string $permission, string $entityClass = null)
|
||||
{
|
||||
$permissionService = app(PermissionService::class);
|
||||
return $permissionService->checkUserHasPermissionOnAnything($permission);
|
||||
return $permissionService->checkUserHasPermissionOnAnything($permission, $entityClass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user