Get permissions of the user.

@return array
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;
    }
1112377
protected function getAllPermissions() {
    $permissions = array();
    foreach (module_invoke_all('permission') as $name => $permission) {
      $permissions[$name] = $permission['title'];
    }
    return $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;
    }
149459
public function getPermissionActions()
    {
        $actions = [];

        /**
         * @var $route \Symfony\Component\Routing\Route
         */
        foreach ($this->router->getRouteCollection()->all() as $name => $route) {
            if ($route->hasOption('require_admin_permission')) {
                $options = explode('.', $route->getOption('require_admin_permission'));
                if (!array_key_exists($options[0], $actions))
                    $actions[$options[0]] = [];
                if (!in_array($options[1], $actions[$options[0]]))
                    $actions[$options[0]][] = $options[1];
            }
        }

        ksort($actions);

        return $actions;
    }
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;
    }
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;
    }
1084309
public function getRoles() {

		$roles = [];

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

		return $roles;
	}
29080
private function getPermissionTypes()
    {
        $types = [];

        /**
         * @var $route \Symfony\Component\Routing\Route
         */
        foreach ($this->get('router')->getRouteCollection()->all() as $name => $route) {
            if ($route->hasOption('require_admin_permission')) {
                list($permissionType,) = explode('.', $route->getOption('require_admin_permission'));
                $types[$permissionType] = [
                    'id'   => $permissionType,
                    'name' => $permissionType
                ];
            }
        }

        ksort($types);

        return array_values($types);
    }
257773
def get_permissions(self, user_id):
        """"""
        response = self.request(
            "{0}/{1}/permissions".format(self.version, user_id), {}
        )["data"]
        return {x["permission"] for x in response if x["status"] == "granted"}
770478
private function getPermissionActions()
    {
        $actions = [];

        /**
         * @var $route \Symfony\Component\Routing\Route
         */
        foreach ($this->get('router')->getRouteCollection()->all() as $name => $route) {
            if ($route->hasOption('require_admin_permission')) {
                list(, $action) = explode('.', $route->getOption('require_admin_permission'));
                $actions[$action] = [
                    'id'   => $action,
                    'name' => $action
                ];
            }
        }

        ksort($actions);

        return array_values($actions);
    }
624075
public function permissions()
    {
        $permissions = [];
        foreach (config('typicms.permissions') as $module => $perms) {
            $key = __(ucfirst($module));
            $permissions[$key] = $perms;
        }
        ksort($permissions, SORT_LOCALE_STRING);

        return $permissions;
    }
523445
public function getPermissions() {
		$permissions = [];
		foreach ($this->role->sharedPermissionList as $permission) {
			$permissions[] = $permission->name;
		}

		return $permissions;
	}
614000
private function getPermissions(): array
    {
        $model = App::shortName(get_class($this->table), 'Model/Table', 'Table');

        $values = $this->getPermissionsByModel($model);
        if (empty($values)) {
            return [];
        }

        $primaryKey = $this->table->getPrimaryKey();
        Assert::string($primaryKey);

        return [$this->table->aliasField($primaryKey) . ' IN' => array_unique($values)];
    }
329097
protected function getPreparedPermissions()
    {
        if ($this->preparedPermissions === null) {
            $this->preparedPermissions = $this->createPreparedPermissions();
        }

        return $this->preparedPermissions;
    }
376810
public function check_permissions() {
        $context = context_module::instance($this->cm->id);
        return has_capability('mod/glossary:exportentry', $context)
            || ($this->entry->userid == $this->user->id && has_capability('mod/glossary:exportownentry', $context));
    }
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);
    }
542304
public function getPermissions()
    {
        // user permissions overridden from role.
        $permissions = \Cache::remember(
            'acl.getPermissionsById_'.$this->id,
            config('acl.cacheMinutes'),
            function () {
                return $this->getPermissionsInherited();
            }
        );

        // permissions based on role.
        // more permissive permission wins
        // if user has multiple roles we keep
        // true values.
        foreach ($this->roles as $role) {
            foreach ($role->getPermissions() as $slug => $array) {
                if ( array_key_exists($slug, $permissions) ) {
                    foreach ($array as $clearance => $value) {
                        if( !array_key_exists( $clearance, $permissions[$slug] ) ) {
                            ! $value ?: $permissions[$slug][$clearance] = true;
                        }
                    }
                } else {
                    $permissions = array_merge($permissions, [$slug => $array]);
                }
            }
        }

        return $permissions;
    }