acl always do checkScope

This commit is contained in:
Yuri Kuznetsov
2021-04-30 13:38:01 +03:00
parent e30e164ba3
commit fc7e2400cf
+12 -2
View File
@@ -193,11 +193,13 @@ class AclManager
/**
* Get an access level for a specific scope and action.
*
* @todo Use LevelProvider?
*/
public function getLevel(User $user, string $scope, string $action): string
{
if (!$this->checkScope($user, $scope)) {
return Table::LEVEL_NO;
}
$data = $this->getTable($user)->getScopeData($scope);
return $data->get($action);
@@ -281,6 +283,10 @@ class AclManager
{
$scope = $entity->getEntityType();
if (!$this->checkScope($user, $scope)) {
return false;
}
$data = $this->getTable($user)->getScopeData($scope);
$checker = $this->getAccessChecker($scope);
@@ -395,6 +401,10 @@ class AclManager
*/
public function checkScope(User $user, string $scope, ?string $action = null): bool
{
if ($action && !$this->checkScope($user, $scope)) {
return false;
}
$data = $this->getTable($user)->getScopeData($scope);
$checker = $this->getAccessChecker($scope);