Generate and return the array having slug of mapped permissions.

@return array
428851
public function getPermissionsSlugList() {

		$slugList	= [];
		$idList		= [];

		// TODO: Use roles hierarchy recursively to get child roles

		if( !empty( $this->gridCache ) ) {

			return $this->getGridCacheAttribute( 'permissionsSlugList' );
		}
		else {

			// Generate L0 Slugs and Ids List
			$permissions = $this->permissions;

			foreach( $permissions as $permission ) {

				if( !in_array( $permission->slug, $slugList ) ) {

					array_push( $slugList, $permission->slug );

					if( $permission->group ) {

						array_push( $idList, $permission->id );
					}
				}
			}

			// Add child permission slugs recursively till all leaf nodes get exhausted.
			while( count( $idList ) > 0 ) {

				$permissions = Permission::findGroupPermissions( $idList );

				$idList = [];

				foreach( $permissions as $permission ) {

					if( !in_array( $permission->slug, $slugList ) ) {

						array_push( $slugList, $permission->slug );

						if( $permission->group ) {

							array_push( $idList, $permission->id );
						}
					}
				}

				if( count( $idList ) == 0 ) {

					break;
				}
			};
		}

		return $slugList;
	}
282073
public function providePermissions()
    {
        $permissions = array();
        $config = Config::inst()->get('PublishProvider', 'classes');

        foreach ($config as $class) {
            $subClasses = array_keys(ClassInfo::subclassesFor($class));
            
            foreach ($subClasses as $subClass) {
                foreach (array(
                        'publish',
                        'unpublish',
                        'archive',
                        'view',
                        'edit',
                        'delete',
                        'create') as $name) {
                    $permissions[$subClass . '_' . $name] = singleton($subClass)->singular_name(). ' ' . $name;
                }
            }
        }
        
        return $permissions;
    }
302112
public function permissions()
    {
        if ( ! isset($this->permissions) ) {
            $permissionModel = $this::$permissionModel;

            $this->permissions = $permissionModel::whereHas('roles', function ($query) {
                $query->whereHas('users', function ($query) {
                    $query->where('id', $this->id);
                });
            })->get();
        }

        return $this->permissions;
    }
665575
private function getParentPermissions() : array
    {
        $result = [];
        foreach ($this->table->associations() as $association) {
            if (! $this->isSupportedJoinAssociation($association)) {
                continue;
            }

            if (! $this->isParentModuleAssociation($association)) {
                continue;
            }

            $foreignKey = $association->getForeignKey();
            Assert::string($foreignKey);

            $field = sprintf('%s IN', $foreignKey);
            $result[$field] = $this->getPermissionsByModel($this->getModelByAssociation($association));
        }

        return $result;
    }
12876
public function getAllPermissions()
    {
        $permissions = [];

        // Gather and combine all permissions for roles
        foreach ($this->roleModel->all() as $role) {
            $permissions = array_merge(
                $permissions,
                array_keys(array_filter($role->getPermissions()))
            );
        }

        // Gather permissions set specifically for users
        foreach ($this->userModel->all() as $user) {
            $permissions = array_merge(
                $permissions,
                array_keys(array_filter($user->getPermissions()))
            );
        }

        sort($permissions);

        return array_unique($permissions);
    }
939337
public function getAllPermissions()
    {

        $permissions = [];

        $roles = $this->group->roles()->with('permissions')->get();

        // Go through every role...
        foreach ($roles as $role) {

            // ... in every defined permission
            foreach ($role->permissions as $permission) {

                // only add permissions if it is not an inverse
                if (! $permission->pivot->not)
                    array_push($permissions, $permission->title);
            }

        }

        return $permissions;
    }
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 => [
      ],
    ];
  }
473859
private function getPostsPermissions()
    {
        return [
            [
                'name'        => 'Posts - List all posts',
                'description' => 'Allow to list all posts.',
                'slug'        => PostsPolicy::PERMISSION_LIST,
            ],
            [
                'name'        => 'Posts - View a post',
                'description' => 'Allow to display a post.',
                'slug'        => PostsPolicy::PERMISSION_SHOW,
            ],
            [
                'name'        => 'Posts - Create a post',
                'description' => 'Allow to create a post.',
                'slug'        => PostsPolicy::PERMISSION_CREATE,
            ],
            [
                'name'        => 'Posts - Update a post',
                'description' => 'Allow to update a post.',
                'slug'        => PostsPolicy::PERMISSION_UPDATE,
            ],
            [
                'name'        => 'Posts - Delete a post',
                'description' => 'Allow to delete a post.',
                'slug'        => PostsPolicy::PERMISSION_DELETE,
            ],
        ];
    }
284306
public function getPermissionOptions()
    {
        // Get all the grouped elements
        $elements = app('decoy.elements')
            ->localize(Decoy::locale())
            ->hydrate(true)
            ->asModels()
            ->sortBy('page_label')
            ->groupBy('page_label');

        // Map to the expected permisions forat
        $out = [];
        foreach ($elements as $page_label => $fields) {
            $out[Str::slug($page_label)] = [$page_label, $fields[0]->page_help];
        }

        return $out;
    }
1256051
public static function permissions(): array
    {
        $aPermissions = parent::permissions();

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

        $aOut = array();

        if (!empty($aBlogs)) {

            foreach ($aBlogs as $oBlog) {

                $aPermissions[$oBlog->id . ':manage']  = $oBlog->label . ': Can manage posts';
                $aPermissions[$oBlog->id . ':create']  = $oBlog->label . ': Can create posts';
                $aPermissions[$oBlog->id . ':edit']    = $oBlog->label . ': Can edit posts';
                $aPermissions[$oBlog->id . ':delete']  = $oBlog->label . ': Can delete posts';
                $aPermissions[$oBlog->id . ':restore'] = $oBlog->label . ': Can restore posts';

            }
        }

        return $aPermissions;
    }
1056809
public function getPermissions()
    {
        $permissions = &gplcart_static('user.role.permissions');

        if (isset($permissions)) {
            return $permissions;
        }

        $permissions = (array) gplcart_config_get(GC_FILE_CONFIG_PERMISSION);
        asort($permissions);

        $this->hook->attach('user.role.permissions', $permissions, $this);
        return $permissions;
    }
429623
private function buildPermissionsMap()
    {
        $permissionsMap = [];
        $roles          = $this->roles()->with('permissions')->get()->toArray();
        foreach ($roles as $role) {
            if (!empty($role['permissions'])) {
                foreach ($role['permissions'] as $permission) {
                    $permissionsMap[] = $permission['name'];
                }
            }
        }
        return array_unique($permissionsMap);
    }
1296636
private function getMapConfigPermissions()
    {
        $id = '_config';

        if (!\array_key_exists($id, $this->cache)) {
            $this->cache[$id] = [];
            $this->buildSystemPermissions($id);
        }

        return $this->cache[$id];
    }
948352
public function listPermissions()
    {
        if ($this->permissionCache !== false) {
            return $this->permissionCache;
        }

        /*
         * Load module items
         */
        foreach ($this->callbacks as $callback) {
            $callback($this);
        }

        /*
         * Load plugin items
         */
        $plugins = PluginManager::instance()->getPlugins();

        foreach ($plugins as $id => $plugin) {
            $items = $plugin->registerPermissions();
            if (!is_array($items)) {
                continue;
            }

            $this->registerPermissions($id, $items);
        }

        /*
         * Sort permission items
         */
        usort($this->permissions, function ($a, $b) {
            if ($a->order == $b->order) {
                return 0;
            }

            return $a->order > $b->order ? 1 : -1;
        });

        return $this->permissionCache = $this->permissions;
    }
628047
public function getMergedPermissions()
	{
		if ( ! $this->mergedPermissions)
		{
			$permissions = array();

			foreach ($this->getGroups() as $group)
			{
				$permissions = array_merge($permissions, $group->getPermissions());
			}

			$this->mergedPermissions = array_merge($permissions, $this->getPermissions());
		}

		return $this->mergedPermissions;
	}
6713
public function permissions()
    {
        if (is_array($this->permissions)) {
            return $this->permissions;
        }

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

        return [];
    }
766393
private function getFilters()
    {
        $filters = new Collection;

        foreach ($this->getCachedPermissionGroups() as $group) {
            /** @var  \Arcanesoft\Auth\Models\PermissionsGroup  $group */
            $filters->push([
                'name'   => $group->name,
                'params' => [$group->hashed_id],
            ]);
        }

        // Custom Permission group
        //----------------------------------
        if (Permission::where('group_id', 0)->count()) {
            $filters->push([
                'name'   => trans('auth::permission-groups.custom'),
                'params' => [hasher()->encode(0)],
            ]);
        }

        return $filters;
    }