Get the Role List of Roles assigned to a Site.
@param mixed $nb_site A Site instance, an object containing a field name nb_site_id or a Site Id.
@return CNabuRoleList Returns the list of roles found or an empty list if none.
517360
static public function getRolesForSite($nb_site) : CNabuRoleList
    {
        $nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);

        if (is_numeric($nb_site_id)) {
            $retval = self::buildObjectListFromSQL(
                'nb_role_id',
                'select r.* '
                . 'from nb_role r, nb_site_role sr, nb_site s '
               . 'where r.nb_role_id=sr.nb_role_id '
                 . 'and sr.nb_site_id=s.nb_site_id '
                 . 'and s.nb_site_id=%site_id$d',
                array(
                    'site_id' => $nb_site_id
                ),
                ($nb_site instanceof CNabuSite ? $nb_site : null)
            );
        } else {
            $retval = new CNabuRoleList();
        }

        return $retval;
    }
979269
public function getAvailableRoles()
    {
        Piwik::checkUserHasSomeAdminAccess();

        $response = array();

        foreach ($this->roleProvider->getAllRoles() as $role) {
            $response[] = array(
                'id' => $role->getId(),
                'name' => $role->getName(),
                'description' => $role->getDescription(),
                'helpUrl' => $role->getHelpUrl(),
            );
        }

        return $response;
    }
10239
public function addRootSiteMapForURL($order, CNabuRole $nb_role = null)
    {
        if ($nb_role === null) {
            $nb_role = $this->nb_engine->getHTTPServer()->getSite()->getDefaultRole();
        }

        $nb_site_map = new CNabuBuiltInSiteMap();
        $nb_site_map->setOrder($order);

        return $this->addRootSiteMap($nb_site_map);
    }
1326341
public function setSiteAliasId(int $nb_site_alias_id) : CNabuDataObject
    {
        if ($nb_site_alias_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_site_alias_id")
            );
        }
        $this->setValue('nb_site_alias_id', $nb_site_alias_id);
        
        return $this;
    }
854583
public function getRoleName ()
		{
			$auth = Yii::$app->getAuthManager();
			$roles = $auth->getRolesByUser($this->id);
			$role = current($roles);

			return $role ? $role->name : null;
		}
403934
public function getSites($force = false)
    {
        if ($force) {
            $this->nb_site_list->clear();
            $this->nb_site_list->merge(CNabuSite::getAllSites($this));
        }

        return $this->nb_site_list->getItems();
    }
57467
public function getRoles()
    {
        if (is_array($this->_roles)) {
            return $this->_roles;
        }
        if (!$this->id) {
            return $this->_roles = [];
        }
        return $this->_roles = \Cms\Orm\CmsAuthRoleQuery::joinedRoleByAuthId($this->id)
            ->orderAsc('name', 'cms_role')
            ->findPairs('cms_role_id', 'cms_role.name');
    }
1354215
protected function getUserRoles()
    {
        if (!$this->auth->guest()) {
            return $this->auth->roles();
        }


        return $this->roles->has('guest') ? ['guest'] : [];
    }
338651
public function getRoles($user_id) {
        $results = $this->find('all', array(
            'conditions' => array(
                'RequestObject.foreign_key' => $user_id,
                'RequestObject.model' => USER_MODEL
            )
        ));

        if ($results) {
            // Grab the direct parents (or roles)
            $results = $this->find('all', array(
                'conditions' => array('RequestObject.id' => Hash::extract($results, '{n}.RequestObject.parent_id'))
            ));

            // Also grab the children of the parents since the user has access to them as well
            $results = array_merge($results, $this->find('all', array(
                'conditions' => array(
                    'RequestObject.parent_id' => Hash::extract($results, '{n}.RequestObject.id'),
                    'RequestObject.model' => null,
                    'RequestObject.foreign_key' => null
                )
            )));
        }

        return $results;
    }
104354
public function getRoles($includeAbstract = false)
    {
        $this->initialize();
        if (!$includeAbstract) {
            return array_filter($this->roles, function (Role $role) {
                return $role->isAbstract() !== true;
            });
        }
        return $this->roles;
    }
612030
public function getRolesForUserCreation()
    {
        $rolesList = [];

        // logged user
        $user = auth()->user();

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

        return $rolesList;
    }
1341200
public static function getUserRoles($incl_admin = true)
    {
        $wp_roles = new \WP_Roles();
        $wp_roles = $wp_roles->get_names();
        if (!$incl_admin) {
            unset($wp_roles['administrator']);
        }
        $roles = [];
        foreach ($wp_roles as $key => $value) {
            $roles[] = $key;
        }
        return $roles;
    }
1059633
public function getProfiles(bool $force = false) : CNabuSiteUserList
    {
        if ($this->nb_site_user_list->isEmpty() || $force) {
            $this->nb_site_user_list->clear();
            $this->nb_site_user_list->merge(CNabuSiteUser::getSitesForUser($this));
        }

        return $this->nb_site_user_list;
    }
1069773
function roles()
    {
        $groups = $this->attribute( 'groups' );
        $groups[] = $this->attribute( 'contentobject_id' );
        return eZRole::fetchByUser( $groups );
    }
20755
public function getRoleDescription()
    {
        static $list = null;
        if ($list === null) {
            $list = static::getRoles();
        }
        return (isset($list[$this->role])) ? $list[$this->role] : $this->role;
    }
853673
protected function getUserRoles(): Collection
    {
        if (! \is_null($this->userRoles)) {
            return $this->userRoles;
        } elseif (! $this->auth->guest()) {
            return $this->auth->roles();
        }

        return new Collection($this->roles->has('guest') ? ['guest'] : []);
    }
278988
public function collectRelativeRoles(Site $context = null)
    {
        $event = new RolesCollectionEvent($this->getDefaultRelativeRoles(), $context);
        $this->dispatcher->dispatch(RolesCollectionEvent::EVENT_NAME, $event);
        return $event->getRoles();
    }