Get the Medias permissions.

@return array
341964
private function getMediasPermissions()
    {
        return [
            [
                'name'        => 'Medias - List all medias',
                'description' => 'Allow to list all the medias.',
                'slug'        => MediasPolicy::PERMISSION_LIST,
            ],
            [
                'name'        => 'Medias - View a media',
                'description' => 'Allow to display a media.',
                'slug'        => MediasPolicy::PERMISSION_SHOW,
            ],
            [
                'name'        => 'Medias - Download a media',
                'description' => 'Allow to download a media.',
                'slug'        => MediasPolicy::PERMISSION_CREATE,
            ],
            [
                'name'        => 'Medias - Update a media',
                'description' => 'Allow to update a media.',
                'slug'        => MediasPolicy::PERMISSION_UPDATE,
            ],
            [
                'name'        => 'Medias - Delete a media',
                'description' => 'Allow to delete a media.',
                'slug'        => MediasPolicy::PERMISSION_DELETE,
            ],
        ];
    }
161243
public function getPermissions()
    {
        // return permissions if they have already been requested
        if(Session::get("usersPermission")) {
            self::$permissions = Session::get("usersPermission");
            return Session::get("usersPermission");
        }
        // return permissions if they have already been requested
        if(self::$permissions) {
            return self::$permissions;
        }

        $groupIDs = [];
        foreach (Auth::user()->roles as $group) {
            if ($group->isDefault) {
                self::$permissions["global"]["isDefault"] = true;
            }
            $groupIDs[] = $group->groupID;
        }

        $permissions = Permission::whereIn("groupID", $groupIDs)->get();

        // save values in keys & values for easy access
        foreach ($permissions as $permission) {
            self::$permissions[$permission->app][$permission->key] = [
              'value' => ($permission->ids !== null) ? array_values(json_decode($permission->ids, true)) : $permission->value,
              'hasAll' => $permission['hasAll']
            ];
        }
        Session::put("usersPermission", self::$permissions);
        return self::$permissions;
    }
1119790
public function getPermissions()
    {
        if(!$this->permissions){
            $rolePermissions = $this->rolePermissions();
            $userPermissions = $this->grantedPermissions()->get();

            $permissions = $rolePermissions->merge($userPermissions);
            $deniedPermissions =$this->deniedPermissions()->get();

            $this->permissions = $permissions->filter(function($permission) use ($deniedPermissions)
            {
                return !$deniedPermissions->contains($permission);
            });
        }
        return $this->permissions;
    }
1121654
protected function _getGroupPermissions()
    {
        if (get_class($this->GroupPermissions) === 'GroupPermission') {
            return $this->GroupPermissions;
        }
        return $this->GroupPermissions = TableRegistry::get('Wasabi/Core.GroupPermissions');
    }
448474
public function getRolesWithPermissions()
    {
        $roles = Roles::with('permissions')
            ->notSuperAdmin()
            ->orderBy('name')
            ->get()->map(function ($role) {
                return [
                    'id'          => $role->id,
                    'role'        => $role->name,
                    'slug'        => $role->slug,
                    'permissions' => $role->permissions->pluck('id')->all(),
                ];
            });

        return json_encode($roles);
    }
854300
public function permissions() {
    $permissions = [];

    $contentTypes = $this->getContentTypes();
    foreach ($contentTypes as $bundle) {
      $entity_type = 'node';
      $fields = $this->getEntityAccessFields($entity_type, $bundle);

      /** @var \Drupal\field\Entity\FieldConfig $field */
      foreach ($fields as $field) {
        $field_storage = $field->getFieldStorageDefinition();
        // @TODO Add support for allowed_values_function.
        $allowed_values = $field_storage->getSetting('allowed_values');
        if (!empty($allowed_values)) {
          foreach ($allowed_values as $field_key => $field_label) {
            if (!in_array($field_key, $this->getIgnoredValues())) {
              // e.g. label = node.article.field_content_visibility:public.
              $permission_label = $field->id() . ':' . $field_key;
              $permission = 'view ' . $permission_label . ' content';
              $permissions[$permission] = [
                'title' => $this->t('View @label content', ['@label' => $permission_label]),
              ];
            }
          }
        }
      }
    }

    return $permissions;
  }
517314
protected function getPermissionsRole()
    {
        $arguments = $this->getArguments();

        if (count($arguments) < 2) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $role_id = array_shift($arguments);

        if (!is_numeric($role_id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $role = $this->role->get($role_id);

        if (!isset($role['permissions'])) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($role_id, $role['permissions'], $arguments);
    }
738765
protected function getPrivileges()
    {
        if (!$this->privileges) {
            $privileges = [];

            $allExisting = $this->getUsedPrivileges();

            foreach ($this->acl->getPrivilegeRoles() as $privilege => $roles) {
                $privileges[$privilege]['privilege'] = $privilege;
                $privileges[$privilege]['menu'] = isset($allExisting[$privilege]) ? $allExisting[$privilege] : null;
                $privileges[$privilege]['allowed'] = $roles[\Zend_Acl::TYPE_ALLOW] ? implode(', ', $roles[\Zend_Acl::TYPE_ALLOW]) : null;
                $privileges[$privilege]['denied'] = $roles[\Zend_Acl::TYPE_DENY] ? implode(', ', $roles[\Zend_Acl::TYPE_DENY]) : null;
            }

            // Add unassigned rights to the array too

            $unassigned = array_diff_key($allExisting, $privileges);
            $nonexistent = array_diff_key($privileges, $allExisting);
            unset($nonexistent['pr.nologin']);
            unset($nonexistent['pr.islogin']);
            ksort($nonexistent);

            foreach ($unassigned as $privilege => $description) {
                $privileges[$privilege] = array(
                    'privilege' => $privilege,
                    'menu' => isset($allExisting[$privilege]) ? $allExisting[$privilege] : null,
                    'allowed' => null,
                    'denied' => null
                );
            }
            ksort($privileges);

            $this->setNonExistent($nonexistent);

            $this->privileges = $privileges;
        }
        return $this->privileges;
    }
338233
public function rolesPermissions() {
    return [
      self::ROLE_USER => [
      ],
      self::ROLE_USER_MANAGER => [
        self::USER_VIEW,
        self::USER_CREATE,
        self::USER_UPDATE,
        self::USER_CHANGE_SECURITY_INFO,
        self::USER_CHANGE_PROFILE_INFO,
      ],
      self::ROLE_ADMIN => [
      ],
    ];
  }
460133
public static function permissions(): array
    {
        $aPermissions = parent::permissions();

        $aPermissions['object:browse']  = 'Can browse existing objects';
        $aPermissions['object:create']  = 'Can create new objects';
        $aPermissions['object:delete']  = 'Can delete existing objects';
        $aPermissions['object:restore'] = 'Can restore deleted objects';
        $aPermissions['object:purge']   = 'Can purge deleted objects';
        $aPermissions['bucket:create']  = 'Can create new buckets';

        return $aPermissions;
    }
92809
public function getPermissions()
    {
        if (!$this->permissions) {
            $permissions = new Permissions('Job/Permissions');
            if ($this->user) {
                $permissions->grant($this->user, Permissions::PERMISSION_ALL);
            }
            $this->setPermissions($permissions);
        }

        return $this->permissions;
    }
682984
public function providePermissions()
    {
        $permissions = [];
        foreach (MenuSet::get() as $menuset) {
            $key = $menuset->PermissionKey();
            $permissions[$key] = [
                'name' => _t(
                    __CLASS__ . '.EDITMENUSET',
                    "Manage links with in '{name}'",
                    [
                        'name' => $menuset->obj('Title')
                    ]
                ),
                'category' => _t(__CLASS__ . '.MENUSETS', 'Menu sets')
            ];
        }
        return $permissions;
    }
200719
public function permissions()
    {
        if (is_array($this->permissions)) {
            return $this->permissions;
        }

        if ($this->permissions) {
            return [ $this->permissions ];
        }

        return false;
    }
1362507
public function getRules()
    {
        $perm = $this->permissions;
        $data = array();

        foreach ($perm as $val)
        {
            list($prefix,$data[]) = explode('.', $val);
        }

        return implode(',',$data);
    }
412683
private function getCategoriesPermissions()
    {
        return [
            [
                'name'        => 'Categories - List all categories',
                'description' => 'Allow to list all categories.',
                'slug'        => CategoriesPolicy::PERMISSION_LIST,
            ],
            [
                'name'        => 'Categories - View a category',
                'description' => 'Allow to display a category.',
                'slug'        => CategoriesPolicy::PERMISSION_SHOW,
            ],
            [
                'name'        => 'Categories - Create a category',
                'description' => 'Allow to create a category.',
                'slug'        => CategoriesPolicy::PERMISSION_CREATE,
            ],
            [
                'name'        => 'Categories - Update a category',
                'description' => 'Allow to update a category.',
                'slug'        => CategoriesPolicy::PERMISSION_UPDATE,
            ],
            [
                'name'        => 'Categories - Delete a category',
                'description' => 'Allow to delete a category.',
                'slug'        => CategoriesPolicy::PERMISSION_DELETE,
            ],
        ];
    }
1132607
public function getPermissionsAttribute()
    {
        return $this->active_roles
            ->pluck('permissions')
            ->flatten()
            ->unique(function (PermissionContract $permission) {
                return $permission->getKey();
            });
    }
1084309
public function getRoles() {

		$roles = [];

		foreach($this -> permissions as $role => $permissions) {
			$roles[$role] = $this -> getRole($role);
		}

		return $roles;
	}