Added PermissionAttachment::setPermissions()

This allows bulk permission without recalculating the new permissions until all everything is set. Permission plugins that set a big amount of nodes may want to use this method.
This commit is contained in:
Shoghi Cervantes 2014-09-11 12:39:01 +02:00
parent 4624dfb472
commit 0328b4c5f5

View File

@ -88,6 +88,17 @@ class PermissionAttachment{
return $this->permissions;
}
/**
* @param bool[] $permissions
*/
public function setPermissions(array $permissions){
$this->permissions = [];
foreach($permissions as $key => $value){
$this->permissions[$key] = (bool) $value;
}
$this->permissible->recalculatePermissions();
}
/**
* @param string|Permission $name
* @param bool $value