acl checkField
This commit is contained in:
@@ -248,6 +248,19 @@ class Acl
|
||||
->getScopeForbiddenFieldList($this->user, $scope, $action, $thresholdLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check access to a field.
|
||||
*
|
||||
* @param string $scope A scope (entity type).
|
||||
* @param string $field A field to check.
|
||||
* @param Table::ACTION_READ|Table::ACTION_EDIT $action An action.
|
||||
* @return bool
|
||||
*/
|
||||
public function checkField(string $scope, string $field, string $action = Table::ACTION_READ): bool
|
||||
{
|
||||
return $this->aclManager->checkField($this->user, $scope, $field, $action);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get links forbidden for a user.
|
||||
*
|
||||
|
||||
@@ -556,6 +556,20 @@ class AclManager
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check access to a field.
|
||||
*
|
||||
* @param User $user A user.
|
||||
* @param string $scope A scope (entity type).
|
||||
* @param string $field A field to check.
|
||||
* @param Table::ACTION_READ|Table::ACTION_EDIT $action An action.
|
||||
* @return bool
|
||||
*/
|
||||
public function checkField(User $user, string $scope, string $field, string $action = Table::ACTION_READ): bool
|
||||
{
|
||||
return !in_array($field, $this->getScopeForbiddenFieldList($user, $scope, $action));
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a user has access to another user over a specific permission.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user