mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Fixed permissions fixtures loading.
This commit is contained in:
parent
adde39de9f
commit
960dbdf6f6
2 changed files with 26 additions and 121 deletions
|
@ -7,6 +7,13 @@ use App\Security\Interfaces\HasPermissionsInterface;
|
|||
|
||||
class PermissionPresetsHelper
|
||||
{
|
||||
public const PRESET_ALL_INHERIT = 'all_inherit';
|
||||
public const PRESET_ALL_FORBID = 'all_forbid';
|
||||
public const PRESET_ALL_ALLOW = 'all_allow';
|
||||
public const PRESET_READ_ONLY = 'read_only';
|
||||
public const PRESET_EDITOR = 'editor';
|
||||
public const PRESET_ADMIN = 'admin';
|
||||
|
||||
private PermissionManager $permissionResolver;
|
||||
|
||||
public function __construct(PermissionManager $permissionResolver)
|
||||
|
@ -28,22 +35,22 @@ class PermissionPresetsHelper
|
|||
$perm_holder->getPermissions()->resetPermissions();
|
||||
|
||||
switch($preset_name) {
|
||||
case 'all_inherit':
|
||||
case self::PRESET_ALL_INHERIT:
|
||||
//Do nothing, all values are inherit after reset
|
||||
break;
|
||||
case 'all_forbid':
|
||||
case self::PRESET_ALL_FORBID:
|
||||
$this->allForbid($perm_holder);
|
||||
break;
|
||||
case 'all_allow':
|
||||
case self::PRESET_ALL_ALLOW:
|
||||
$this->allAllow($perm_holder);
|
||||
break;
|
||||
case 'read_only':
|
||||
case self::PRESET_READ_ONLY:
|
||||
$this->readOnly($perm_holder);
|
||||
break;
|
||||
case 'editor':
|
||||
case self::PRESET_EDITOR:
|
||||
$this->editor($perm_holder);
|
||||
break;
|
||||
case 'admin':
|
||||
case self::PRESET_ADMIN:
|
||||
$this->admin($perm_holder);
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue