select manager check link restricted

This commit is contained in:
yuri
2019-01-09 13:35:03 +02:00
parent 5d32485fc5
commit c9a6bd2d64
3 changed files with 28 additions and 0 deletions
+5
View File
@@ -124,6 +124,11 @@ class Acl
return $this->getAclManager()->getScopeForbiddenFieldList($this->getUser(), $scope, $action, $thresholdLevel);
}
public function getScopeForbiddenLinkList($scope, $action = 'read', $thresholdLevel = 'no')
{
return $this->getAclManager()->getScopeForbiddenLinkList($this->getUser(), $scope, $action, $thresholdLevel);
}
public function checkUserPermission($target, $permissionType = 'userPermission')
{
return $this->getAclManager()->checkUserPermission($this->getUser(), $target, $permissionType);
+16
View File
@@ -309,6 +309,22 @@ class AclManager
return $list;
}
public function getScopeForbiddenLinkList(User $user, $scope, $action = 'read', $thresholdLevel = 'no')
{
$list = [];
if ($thresholdLevel === 'no') {
$list = array_merge(
$list,
$this->getScopeRestrictedLinkList($scope, $this->getGlobalRestrictionTypeList($user, $action))
);
$list = array_values($list);
}
return $list;
}
public function checkUserPermission(User $user, $target, $permissionType = 'userPermission')
{
$permission = $this->get($user, $permissionType);
@@ -787,6 +787,13 @@ class Base
if (in_array($attribute, $this->getAcl()->getScopeForbiddenFieldList($this->getEntityType()))) {
throw new Forbidden();
}
if (
$this->getSeed()->hasRelation($attribute)
&&
in_array($attribute, $this->getAcl()->getScopeForbiddenLinkList($this->getEntityType()))
) {
throw new Forbidden();
}
} else {
if (in_array($attribute, $this->getAcl()->getScopeForbiddenAttributeList($this->getEntityType()))) {
throw new Forbidden();