Gets user all roles.

@return array
978376
public function getRolesNames ()
		{
			$auth = Yii::$app->getAuthManager();
			$rolesByUser = $auth->getRolesByUser($this->id);
			$roles = ArrayHelper::objectsAttribute($rolesByUser, 'name');

			return $roles;
		}
878454
private function getRoleIds()
    {
        $assign_to_roles = $this->option('assign-to-roles');

        if ($assign_to_roles) {
            $role_ids = explode(',', $assign_to_roles);

            return array_map('intval', $role_ids);
        }

        return [];
    }
1171062
public function getRoles()
    {
        global $wpdb;
        $capabilities = get_user_meta($this->ID, $wpdb->prefix . 'capabilities', true);

        return is_array($capabilities) ? array_keys($capabilities) : array(
            'non-user'
        );
    }
1191624
protected function _getRoleIds()
    {
        $ids = [];
        if (!$this->has('roles')) {
            return $ids;
        }
        foreach ($this->roles as $k => $role) {
            $ids[] = $role->id;
        }

        return $ids;
    }
373819
public function getRoles()
    {
        $roles = $this->roles;

        foreach ($this->getGroups() as $group) {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $roles = array_merge($roles, $group->getRoles());
        }

        // we need to make sure to have at least one role
        $roles[] = static::ROLE_DEFAULT;

        return array_unique($roles);
    }
340871
public function getIncludeUserIds()
    {
        $userIds = array();
        $roleUsers = $this->role->getUsers();
        foreach ($roleUsers as $user) {
            array_push($userIds, $user->getId());
        }
        $roleGroups = $this->role->getGroups();
        foreach ($roleGroups as $group) {
            $userIds = array_merge($userIds, $group->getUserIds());
        }
        $userIds = array_unique($userIds);

        return $userIds;
    }
930514
protected function getAllRoles($users)
	{
		$dataArray = array();
		$it = $users->getRolesIterator('_all');
		while ($it->hasNext()) {
			$sr = $it->moveNext();
//			$site = $sr->getField($users->getRolesTable()->Site);
			$dataArrayRoles = $sr->getFieldArray($users->getRolesTable()->Role);
			if (sizeof($dataArrayRoles) > 0) {
				foreach ($dataArrayRoles as $roles) {
					$dataArray[$roles] = $roles;
				}
			}
		}
		return $dataArray;
	}
1084309
public function getRoles() {

		$roles = [];

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

		return $roles;
	}
927663
public function getInheritanceList(): array
    {
        $roleList = [$this];
        $role = $this;
        while ($parentRole = $role->getParent()) {
            $roleList[] = $parentRole;
            $role = $parentRole;
        }

        return $roleList;
    }
381048
public function getRolesAttribute()
    {
        $roles = new Collection();

        foreach ($this->guild->roles as $role) {
            if (array_search($role->id, $this->attributes['roles']) !== false) {
                $roles->push($role);
            }
        }

        return $roles;
    }
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);
    }
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;
    }
214915
protected function allUsers()
    {
        $directory = Google::make('directory');
        $pageToken = null;
        $users = [];
        do {
            try {
                $r = $directory->users->listUsers([
                    'domain' => config('users.google_apps_domain'),
                    'maxResults' => config('users.google_apps_users_maxResults'),
                    'pageToken' => $pageToken
                ]);
                $pageToken = $r->nextPageToken;
                $users = array_merge($users, $r->users);
            } catch (\Exception $e) {
                return json_decode($e->getMessage());
            }
        } while ($pageToken);
        return $users;
    }
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);
    }
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;
    }
163823
public function getGroupRoles()
    {
        $roles = [];

        foreach ($this->groups as $group) {
            foreach ($group->getEntityRoles() as $role) {
                if (!in_array($role, $roles)) {
                    $roles[] = $role;
                }
            }
        }

        return $roles;
    }
1308878
protected function getterRoleTitles(): array
	{
		$result = [];
		$roles = $this->roles->get();
		/* @var $role AclRole */
		foreach ($roles as $role) {
			$result[] = $role->title;
		}
		return $result;
	}