mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Allow to change all permissions at once via the console command.
This commit is contained in:
parent
3fbc72600f
commit
a30b67e328
3 changed files with 57 additions and 36 deletions
|
@ -56,7 +56,6 @@ class ValidPermissionValidator extends ConstraintValidator
|
|||
public function __construct(PermissionResolver $resolver)
|
||||
{
|
||||
$this->resolver = $resolver;
|
||||
$this->perm_structure = $resolver->getPermissionStructure();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,17 +73,6 @@ class ValidPermissionValidator extends ConstraintValidator
|
|||
/** @var HasPermissionsInterface $perm_holder */
|
||||
$perm_holder = $this->context->getObject();
|
||||
|
||||
//Check for each permission and operation, for an alsoSet attribute
|
||||
foreach ($this->perm_structure['perms'] as $perm_key => $permission) {
|
||||
foreach ($permission['operations'] as $op_key => $op) {
|
||||
if (!empty($op['alsoSet']) &&
|
||||
true === $this->resolver->dontInherit($perm_holder, $perm_key, $op_key)) {
|
||||
//Set every op listed in also Set
|
||||
foreach ($op['alsoSet'] as $set_also) {
|
||||
$this->resolver->setPermission($perm_holder, $perm_key, $set_also, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->resolver->ensureCorrectSetOperations($perm_holder);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue