mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-23 22:04:25 +02:00
Role: Add param $cascadeUpwards
also to public method grant()
This commit is contained in:
parent
c203ffdd79
commit
ab90b3e0a1
@ -253,19 +253,20 @@ class Role
|
||||
*
|
||||
* @param string $permission
|
||||
* @param bool $ignoreParent Only evaluate the role's own permissions
|
||||
* @param bool $cascadeUpwards `false` if `foo/bar/*` and `foo/bar/raboof` should not match `foo/*`
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function grants($permission, $ignoreParent = false)
|
||||
public function grants($permission, $ignoreParent = false, $cascadeUpwards = true)
|
||||
{
|
||||
foreach ($this->permissions as $grantedPermission) {
|
||||
if ($this->match($grantedPermission, $permission)) {
|
||||
if ($this->match($grantedPermission, $permission, $cascadeUpwards)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $ignoreParent && $this->getParent() !== null) {
|
||||
return $this->getParent()->grants($permission);
|
||||
return $this->getParent()->grants($permission, false, $cascadeUpwards);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user