Get all roles.

@return array
770117
public function getRoles()
    {
        $this_roles = \Cache::remember(
            'acl.getRolesById_'.$this->id,
            config('acl.cacheMinutes'),
            function () {
                return $this->roles;
            }
        );

        $slugs = method_exists($this_roles, 'pluck') ? $this_roles->pluck('slug','id') : $this_roles->lists('slug','id');
        return is_null($this_roles)
            ? []
            : $this->collectionAsArray($slugs);
    }
885436
public function getRoles()
    {
        if (count($this->rolesStringAsArray) > 0) {
            return $this->rolesStringAsArray;
        }

        $roleNames = array();

        foreach ($this->getEntityRoles(true) as $role) {
            $roleNames[] = $role->getName();
        }

        return $roleNames;
    }
995971
public function getManageableRolesForPages()
    {
        $roles = $this->em->getRepository('KunstmaanAdminBundle:Role')->findAll();

        if (($token = $this->tokenStorage->getToken()) && ($user = $token->getUser())) {
            if ($user && !$user->isSuperAdmin() && ($superAdminRole = array_keys($roles, 'ROLE_SUPER_ADMIN'))) {
                $superAdminRole = current($superAdminRole);
                unset($roles[$superAdminRole]);
            }
        }

        return $roles;
    }
534654
public function getSearchableRules(): array
    {
        return [
            'roles:[]' => function (Builder $query, array $roles) {
                return $query->whereHas('roles', function (Builder $query) use ($roles) {
                    return $query->whereIn(Role::column('name'), $roles);
                });
            },
        ];
    }
1147321
public function getRoles()
    {
        return \is_string($value = $this->getContentValue('roles', null))
            ? array_filter(explode(',', (string) $value))
            : null;
    }
907989
public function getRolesForUserCreation(): array
    {
        $roles = [];

        if (auth()->check()) {
            /** @var HCUser $user */
            $user = auth()->user();

            if ($user->isSuperAdmin()) {
                $roles = HCAclRole::select('id', 'name as label')->orderBy('name')->get()->toArray();
            } else {
                foreach ($user->roles as $role) {
                    $roles[] = [
                        'id' => $role->id,
                        'label' => $role->name,
                    ];
                }
            }
        }

        return $roles;
    }
214931
public function getRoleNamesAsArray()
    {

        // initialize the array for the role names
        $roleNames = array();

        // prepare the role names
        /** @var AppserverIo\Appserver\Core\Api\Node\RoleNameNode $roleName */
        foreach ($this->getRoleNames() as $roleName) {
            $roleNames[] = $roleName->__toString();
        }

        // return the array with the role names
        return $roleNames;
    }
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');
    }
1347969
public function getRoles()
    {
        $data  = $this->getData();
        $roles = KObjectConfig::unbox($data->roles);

        if(empty($roles)) {
            $this->getSession()->set('user.roles', JAccess::getAuthorisedViewLevels($this->getId()));
        }

        return parent::getRoles();
    }
739123
public function allPermissions() : Collection
    {
        return $this->roles()->with('permissions')->get()->pluck('permissions')->flatten()->merge($this->permissions);
    }
582207
public function getManagedRoles(): Collection
    {
        if ($this->isA('superadmin')) {
            $roles = app('cortex.auth.role')->all();
        } elseif ($this->isA('supermanager')) {
            $roles = $this->roles->merge(config('rinvex.tenants.active') ? app('cortex.auth.role')->where('scope', config('rinvex.tenants.active')->getKey())->get() : collect());
        } else {
            $roles = $this->roles;
        }

        return $roles->pluck('title', 'id')->sort();
    }
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);
    }
935627
public function GetArray() {
      // $RoleData = $this->GetEditablePermissions();
      $RoleData = $this->Get();
      $RoleIDs = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'RoleID');
      $RoleNames = ConsolidateArrayValuesByKey($RoleData->ResultArray(), 'Name');
      return ArrayCombine($RoleIDs, $RoleNames);
   }
804747
public function roleList()
    {
        $body = $this->request(self::URI_AUTH_ROLE_LIST);

        if ($this->pretty && isset($body['roles'])) {
            return $body['roles'];
        }

        return $body;
    }
1175836
protected function getAclRoles()
    {
        $aclRoles = [];
        $roleHierarchy = $this->container->getParameter('security.role_hierarchy.roles');
        $pool = $this->container->get('sonata.admin.pool');

        foreach ($pool->getAdminServiceIds() as $id) {
            try {
                $admin = $pool->getInstance($id);
            } catch (\Exception $e) {
                continue;
            }

            $baseRole = $admin->getSecurityHandler()->getBaseRole($admin);
            foreach ($admin->getSecurityInformation() as $role => $permissions) {
                $role = sprintf($baseRole, $role);
                $aclRoles[] = $role;
            }
        }

        foreach ($roleHierarchy as $name => $roles) {
            $aclRoles[] = $name;
            $aclRoles = array_merge($aclRoles, $roles);
        }

        $aclRoles = array_unique($aclRoles);

        return \is_array($aclRoles) ? new \ArrayIterator($aclRoles) : $aclRoles;
    }
401198
public function getAllowedRoles()
    {
        $returnValue = array();

        $role = new core_kernel_classes_Resource(GenerisRdf::INSTANCE_ROLE_GENERIS);
        $returnValue = array($role->getUri() => $role);

        return (array) $returnValue;
    }
1247138
public function getRoles()
    {
        $result = array();
        /* @var $role RoleInterface */
        foreach ($this->roles as $role) {
            $result[] = $role->getRole();
        }

        return $result;
    }