1
0
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:
Dan Brown
2019-03-09 21:15:45 +00:00
parent 04287745e4
commit 042a6f9760
4 changed files with 39 additions and 12 deletions

View File

@ -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);
}
/**