Returns an array containing parsed submitted data, such as:
role ID, the role permissions, submitted permissions
@return array
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);
    }
546801
public function permissionList()
  {
    if($this->permissionList === null)
    {
      $this->fetchPermissionList();
    }

    foreach($this->permissionList as $permname => $permdata)
    {
      if(isset($permdata["permcatid"]) && $permdata["permgrant"])
      {
        continue;
      }

      $this->permissionList[$permname]["permcatid"] = $this->permissionGetCategoryById($permdata["permid"]);
      $this->permissionList[$permname]["permgrant"] = $this->permissionGetGrantById($permdata["permid"]);

      $grantsid = "i_needed_modify_power_" . substr($permname, 2);

      if(!$permdata["permname"]->startsWith("i_needed_modify_power_") && !isset($this->permissionList[$grantsid]))
      {
        $this->permissionList[$grantsid]["permid"]    = $this->permissionList[$permname]["permgrant"];
        $this->permissionList[$grantsid]["permname"]  = Str::factory($grantsid);
        $this->permissionList[$grantsid]["permdesc"]  = null;
        $this->permissionList[$grantsid]["permcatid"] = 0xFF;
        $this->permissionList[$grantsid]["permgrant"] = $this->permissionList[$permname]["permgrant"];
      }
    }

    return $this->permissionList;
  }
1149097
public function getPermissions(): array
    {
        $userID = $this->getID();
        if ($userID === null) {
            return [];
        }
        $data = Internal\Data::getValue('bearcms/users/user/' . md5($userID) . '.json');
        if ($data !== null) {
            $user = json_decode($data, true);
            return isset($user['permissions']) ? $user['permissions'] : [];
        }
        return [];
    }
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 => [
      ],
    ];
  }
664581
protected function getListUserRole()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        $list = (array) $this->role->getList($conditions);
        $this->prepareListUserRole($list);

        return $list;
    }
1071746
protected function get_permission_strings() {
        static $strpermissions;
        if (!$strpermissions) {
            $strpermissions = array(
                CAP_INHERIT => new lang_string('inherit', 'role'),
                CAP_ALLOW => new lang_string('allow', 'role'),
                CAP_PREVENT => new lang_string('prevent', 'role'),
                CAP_PROHIBIT => new lang_string('prohibit', 'role')
            );
        }
        return $strpermissions;
    }
362584
public function parseData()
    {
        $headers = $this->getHeaders();

        if (!in_array($this->httpRequest->getMethod(), ['PUT', 'POST'])) {
            return $this->emit('end');
        }

        $this->httpRequest->on('data', function($data) use ($headers, &$dataResult) {
            $dataResult .= $data;

            if (isset($headers["content-length"])) {
                if (strlen($dataResult) == $headers["content-length"][0]) {
                    $this->httpRequest->close();
                }
            } else {
                $this->httpRequest->close();
            }
        });

        $this->httpRequest->on('end', function() use (&$dataResult) {
            $this->onEnd($dataResult);
        });
    }
33048
protected function getAllowedRoles()
    {
        if ($this->request->user('administrator')->isRole('super-administrator')) {
            $roles = $this->role->newQuery()->get();
        } else {
            $roles = $this->role->newQuery()->where('slug', '!=', 'super-administrator')->get();
        }

        return $roles->pluck('name', 'id');
    }
912581
public function getAllPermissions(): Collection
    {
        $user = auth()->user();

        if ($user->hasRole($this->roleRepository::ROLE_PA)) {
            $permissions = $this->permissionRepository->makeQuery()
                ->select('id', 'name', 'action', 'created_at')
                ->where('name', '!=', 'admin.acl.role')
                ->get();
        } elseif ($user->isSuperAdmin()) {
            $permissions = $this->permissionRepository->makeQuery()
                ->select('id', 'name', 'action', 'created_at')->get();
        } else {
            $permissions = collect([]);
        }

        return $permissions->sortBy('name')->groupBy('name');
    }
490875
public function getPermissionsAttribute()
    {
        $permissions = new Collection();

        foreach ($this->roles as $role) {
            foreach ($role->permissions as $permission) {
                $permissions->push($permission);
            }
        }

        return $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;
    }
672757
public function toData()
    {
        if ($this->action === self::TYPE_READ) {
            return [
                'fields' => 'whitelisted_domains',
            ];
        }

        if ($this->action === self::TYPE_DELETE) {
            return [
                'fields' => [
                    'whitelisted_domains',
                ],
            ];
        }

        return [
            'whitelisted_domains' => $this->domains,
        ];
    }
1362507
public function getRules()
    {
        $perm = $this->permissions;
        $data = array();

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

        return implode(',',$data);
    }
1004045
public function getPrettyPermissions() {
        $permissionReflect = new \ReflectionClass('\\pff\models\\'.$this->permissionClass);
        $prop = $permissionReflect->getProperties();
        $toReturnAnnotations = array();
        foreach($prop as $a) {
            $i = $this->reader->getPropertyAnnotations('\\pff\models\\'.$this->permissionClass, $a->name);
            $arr = $i->toArray();
            if(isset($arr['Pff2PermissionDescription'])){
                $tmp_name = explode('_', $a->name);
                array_walk($tmp_name, function(&$arr,$k){$arr = ucfirst($arr);});
                $toReturnAnnotations[implode($tmp_name)] = $arr['Pff2PermissionDescription'];
            }
        }
        return $toReturnAnnotations;
    }
45521
public function getMergedPermissions(): array
    {
        $permissions = [];
        foreach ($this->getRoles() as $role) {
            $permissions = \array_merge($permissions, $role->getPermissions() ?? []);
        }

        // merge with users own permissions
        return \array_merge($permissions, $this->getPermissions());
    }
1156565
public static function permissions(): array
    {
        $permissions = parent::permissions();

        //  Fetch the blogs, each blog should have its own admin nav grouping
        $ci =& get_instance();
        $ci->load->model('blog/blog_model');
        $blogs = $ci->blog_model->getAll();

        $out = array();

        if (!empty($blogs)) {

            foreach ($blogs as $blog) {

                $permissions[$blog->id . ':manage']  = $blog->label . ': Can manage categories';
                $permissions[$blog->id . ':create']  = $blog->label . ': Can create categories';
                $permissions[$blog->id . ':edit']    = $blog->label . ': Can edit categories';
                $permissions[$blog->id . ':delete']  = $blog->label . ': Can delete categories';
            }
        }

        return $permissions;
    }
1201603
public function toArray()
	{
		$attributes = parent::toArray();

		if (isset($attributes['permissions']))
		{
			$attributes['permissions'] = $this->getPermissionsAttribute($attributes['permissions']);
		}

		return $attributes;
	}