Lazily grab the prepared permissions.

@return array
329097
protected function getPreparedPermissions()
    {
        if ($this->preparedPermissions === null) {
            $this->preparedPermissions = $this->createPreparedPermissions();
        }

        return $this->preparedPermissions;
    }
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);
    }
854623
public function getPermissionsInherited()
    {
        $rights = [];
        $permissions = $this->permissions;

        // ntfs permissions
        // determine if ntfs is enabled
        // then more permissive wins
        $tmp = [];
        $letNtfs = function ($alias, $slug) use (&$tmp) {
            if ( config('acl.most_permissive_wins', false) ) {
                $ntfs[$alias] = array_diff($slug, [false]);
                if ( sizeof($ntfs) > 0 ) {
                    $tmp = array_replace_recursive($tmp, $ntfs);
                }
            }
        };

        foreach ($permissions as $row) {

            // permissions without inherit ids
            if ( is_null($row->inherit_id) || ! $row->inherit_id ) {

                // ntfs determination
                $letNtfs($row->name, $row->slug);

                // merge permissions
                $rights = array_replace_recursive($rights, [$row->name => $row->slug], $tmp);
                continue;
            }

            // process inherit_id recursively
            $inherited = $this->getRecursiveInherit($row->inherit_id, $row->slug);
            $merge = $permissions->where('name', $row->name);
            $merge = method_exists($merge, 'pluck') ? $merge->pluck('slug', 'name') : $merge->lists('slug', 'name');

                // fix for l5.1 and backward compatibility.
            // lists() method should return as an array.
            $merge = $this->collectionAsArray($merge);

            // replace and merge permissions
            $rights = array_replace_recursive($rights, $inherited, $merge);

            // make sure we don't unset if
            // inherited & slave permission
            // have same names
            if ( key($inherited) != $row->name )
                unset($rights[$row->name]);

        }

        return $rights;
    }
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)];
    }
616806
private function getRolesPermissions()
    {
        return [
            [
                'name'        => 'Roles - List all roles',
                'description' => 'Allow to list all roles.',
                'slug'        => RolesPolicy::PERMISSION_LIST,
            ],
            [
                'name'        => 'Roles - View a role',
                'description' => 'Allow to view the role\'s details.',
                'slug'        => RolesPolicy::PERMISSION_SHOW,
            ],
            [
                'name'        => 'Roles - Add/Create a role',
                'description' => 'Allow to create a new role.',
                'slug'        => RolesPolicy::PERMISSION_CREATE,
            ],
            [
                'name'        => 'Roles - Edit/Update a role',
                'description' => 'Allow to update a role.',
                'slug'        => RolesPolicy::PERMISSION_UPDATE,
            ],
            [
                'name'        => 'Roles - Delete a role',
                'description' => 'Allow to delete a role.',
                'slug'        => RolesPolicy::PERMISSION_DELETE,
            ],
        ];
    }
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);
    }
1372584
public function getPermissions()
    {
        $permissions = [[], []];

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

        return call_user_func_array('array_merge', $permissions);
    }
615835
public function providePermissions()
    {
        $category = _t(__CLASS__ . '.PERMISSION_CATEGORY', 'SilverWare folders');
        
        return [
            'SILVERWARE_FOLDER_CREATE' => [
                'category' => $category,
                'name' => _t('.PERMISSION_CREATE_NAME', 'Create folders'),
                'help' => _t('.PERMISSION_CREATE_HELP', 'Ability to create SilverWare folders.'),
                'sort' => 100
            ],
            'SILVERWARE_FOLDER_EDIT' => [
                'category' => $category,
                'name' => _t('.PERMISSION_EDIT_NAME', 'Edit folders'),
                'help' => _t('.PERMISSION_EDIT_HELP', 'Ability to edit SilverWare folders.'),
                'sort' => 200
            ],
            'SILVERWARE_FOLDER_DELETE' => [
                'category' => $category,
                'name' => _t('.PERMISSION_DELETE_NAME', 'Delete folders'),
                'help' => _t('.PERMISSION_DELETE_HELP', 'Ability to delete SilverWare folders.'),
                'sort' => 300
            ]
        ];
    }
62395
private function getAllPermissions()
    {
        $user = auth()->user();

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

        $permissions = $permissions->sortBy('name')->groupBy('name');

        return json_encode($permissions);
    }
134755
protected function getCandidateUsers()
    {
        if ($this->config()->get('grant_user_access')) {
            $list = Member::get();
            $this->extend('updateCandidateUsers', $list);
            return $list;
        }

        return Permission::get_members_by_permission(
            $this->config()->get('grant_user_permission')
        );
    }
765209
public function getAccessOptions()
    {
        try {
            $ret    = array();
            $result = $this->getSoapClient()->GetDocumentAccessOptions();
            if ( isset($result->GetDocumentAccessOptionsResult->string) ) {
                $ret = $result->GetDocumentAccessOptionsResult->string;
            }

            return $ret;
        } catch ( SoapException $ex ) {
            throw new PermissionsException('Error while getting the list of available permissions for the document' , $ex);
        }
    }
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;
    }
897225
public static function getRequiredPermissions()
    {
        $class = get_called_class();
        // If the user is accessing LeftAndMain directly, only generic permissions are required.
        if ($class === self::class) {
            return 'CMS_ACCESS';
        }
        $code = Config::inst()->get($class, 'required_permission_codes');
        if ($code === false) {
            return false;
        }
        if ($code) {
            return $code;
        }
        return 'CMS_ACCESS_' . $class;
    }
555429
public function getAllPermissions(): Collection
    {
        $permissions = $this->permissions;

        if ($this->roles) {
            $permissions = $permissions->merge($this->getPermissionsViaRoles());
        }

        return $permissions->sort()->values();
    }
106773
protected function getPermissions()
    {
        try {
            return $this->cache->rememberForever('permissions.policies', function () {
                return Permission::with('roles')->get();
            });
        } catch (\Exception $exception) {
            $this->cache->forget('permissions.policies');

            return new Collection;
        }
    }
398920
public function getPermissionCodes()
    {
        $permissions = [
            'view' => MaskBuilder::MASK_VIEW,
            'create' => MaskBuilder::MASK_CREATE,
            'edit' => MaskBuilder::MASK_EDIT,
            'delete' => MaskBuilder::MASK_DELETE,
            'undelete' => MaskBuilder::MASK_UNDELETE,
            'operator' => MaskBuilder::MASK_OPERATOR,
            'master' => MaskBuilder::MASK_MASTER,
            'owner' => MaskBuilder::MASK_OWNER,
            'iddqd' => MaskBuilder::MASK_IDDQD,
            'commit' => MaskBuilder::MASK_COMMIT,
            'publish' => MaskBuilder::MASK_PUBLISH,
            'none' => MaskBuilder::CODE_NONE
        ];

        return $permissions;
    }
454913
public function getPermissions()
    {
        $mode     = \RecursiveIteratorIterator::CHILD_FIRST;
        $iterator = $this->createRecursiveIterator($mode);

        $permissions = [];

        /** @var $child RoleInterface */
        foreach ($iterator as $child) {
            $permissions = array_replace_recursive($permissions, $child->getPermissions());
        }

        return array_replace_recursive($permissions, $this->permissions);
    }