|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
-
-
- namespace Lc\SovBundle\Definition;
-
-
- class RolesDefinition implements RolesDefinitionInterface
- {
- protected $roles = array(
- 'ROLE_USER' => [
- 'label' => 'Utilisateurs',
- 'role' => 'ROLE_USER',
- ],
- 'ROLE_ADMIN' => [
- 'label' => 'Administrateurs',
- 'role' => 'ROLE_ADMIN',
- ],
- 'ROLE_SUPER_ADMIN' => [
- 'label' => 'SuperAdmin',
- 'role' => 'ROLE_SUPER_ADMIN',
- ],
- );
-
- public function getRoles(): array
- {
- return $this->roles;
- }
-
- public function getRole($role): ?array
- {
- if (isset($this->roles[$role])) {
- return $this->roles[$role];
- } else {
- return null;
- }
- }
-
- public function getRolesList(): array
- {
- $rolesList = array();
- foreach ($this->roles as $role) {
- $rolesList[$role['label']] = $role['role'];
- }
-
- return $rolesList;
- }
- }
|