Get the group in which a user is.
This is useful for gui actions.

@param string $login

@return Group
765036
public function getLoginUserGroups($login)
    {
        $groupName = $this->adminGroupConfiguration->getLoginGroupName($login);
        if (empty($groupName)) {
            $groupName = 'guest';
        }

        return $this->getUserGroup("$groupName");
    }
1104315
public function getToken(string $login, string $pass): GetTokenResponse
    {
        $response = $this->request('GET', 'getToken', [
            'login' => $login,
            'pass' => $pass,
        ]);

        return $this->converter->getResponseObject(GetTokenResponse::class, $response);
    }
1278021
public function getLanguageForUser($login)
    {
        if ($login == 'anonymous') {
            return false;
        }

        Piwik::checkUserHasSuperUserAccessOrIsTheUser($login);

        $lang = $this->getModel()->getLanguageForUser($login);

        return $lang;
    }
489385
public function get_roles($group = null)
	{
		// When group is empty, attempt to get groups from a current login
		if ($group === null)
		{
			if ($login = \Auth::instance()
				and is_array($groups = $login->get_groups())
				and isset($groups[0][1]))
			{
				$group = $groups[0][1];
			}
		}

		// if it's a group id, find the corresponding object
		elseif (is_numeric($group) and isset(static::$_valid_groups[$group]))
		{
			$group = static::$_valid_groups[$group];
		}

		// if the group was found, return the roles
		if ($group instanceOf Model\Auth_Group)
		{
			return $group->roles;
		}
		else
		{
			// no group found, so no roles either
			return array();
		}
	}
679528
private function checkLogin($login)
    {
        foreach ($this->mapQueue as $jukeboxMap) {
            if ($jukeboxMap->getPlayer()->getLogin() == $login) {
                return true;
            }
        }

        return false;
    }
1311073
public function userHasGroup($groupName, DeterminableUserInterface $user)
    {
        $userHasGroup = false;
        if (true === in_array($groupName, $user->getGroups())) {
            $userHasGroup = true;
        }
        return $userHasGroup;
    }
310423
public function findByLogin($login)
	{
		$model = $this->createModel();

		$user = $model->where($model->getLoginName(), '=', $login)->find();

		if ( ! $user->loaded() )
		{
			throw new UserNotFoundException("A user could not be found with a login value of [$login].");
		}

		return $user;
	}
640548
public function getPlayerRecord($login)
    {
        return isset($this->recordsPerPlayer[$login]) ? $this->recordsPerPlayer[$login] : null;
    }
685466
public static function getByLogin($username)
    {    
        $fields = self::getDbConnection()->fetchAssoc( 'SELECT * FROM '.User::TABLE.' WHERE login = ?', array( $username ) );
        if (!$fields) return false;
        return self::fetch($fields);    
  	}
1228961
public function getUser($userLogin)
    {
        Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
        $this->checkUserExists($userLogin);

        $user = $this->model->getUser($userLogin);

        $user = $this->userFilter->filterUser($user);
        $user = $this->enrichUser($user);

        return $user;
    }
1208904
private function getPasswordToResetTo($login)
    {
        $optionName = self::getPasswordResetInfoOptionName($login);
        $optionValue = Option::get($optionName);
        $optionValue = json_decode($optionValue, $isAssoc = true);
        return $optionValue;
    }
659328
public function getConnection($login) {

        if (isset($this->servers[$login])) {
            if (!isset($this->connections[$login])) {
                $conf = $this->servers[$login];
                $this->connections[$login] = Connection::factory($conf['host'], $conf['port'], 1, $conf['user'], $conf['password']);
            }

            return $this->connections[$login];
        }
        return null;
    }
1368430
public function getPlayer($login)
    {
        if (isset($this->loggedInPlayers[$login])) {
            return $this->loggedInPlayers[$login];
        }

        return $this->playerQueryBuilder->findByLogin($login);
    }
762342
public function searchUserByLogin($username, $parentGroupId = null)
    {
        try {
            $user = $this->userService->loadUserByLogin($username);
        } catch (ApiExceptions\NotFoundException $e) {
            return null;
        }

        if ($user && $parentGroupId) {
            $userGroups = $this->userService->loadUserGroupsOfUser($user);

            foreach ($userGroups as $userGroup) {
                if ($userGroup->getVersionInfo()->getContentInfo()->id == $parentGroupId) {
                    return $user;
                }
            }
            // user not found in $parentGroupId
            return null;
        }

        return $user;
    }
37444
public function filterLogins($logins)
    {
        if ($this->access->hasSuperUserAccess()) {
            return $logins;
        }

        if (!$this->access->isUserHasSomeAdminAccess()) {
            // keep only own user if it is in the list
            foreach ($logins as $login) {
                if ($this->isOwnLogin($login)) {
                    return array($login);
                }
            }

            return array();
        }

        foreach ($logins as $index => $login) {
            if (!$this->isNonSuperUserAllowedToSeeThisLogin($login)) {
                unset($logins[$index]);
            }
        }

        return array_values($logins);
    }
215231
public function getUserGroups(string $userId = ''): array
    {
        // if not specified, get current user's id
        if (empty($userId)) {
            $userId = $this->Auth->user('id');
        }

        $groups = TableRegistry::get('Groups.Groups');

        $query = $groups->find('list', [
            'keyField' => 'id',
            'valueField' => 'name'
        ]);
        $query->matching('Users', function ($q) use ($userId) {
            return $q->where(['Users.id' => $userId]);
        });

        return $query->toArray();
    }
884226
public function voteKarmaPlus($login)
    {
        $this->checkAliasName($login);

        return $this->adapter->put(sprintf('/users/%s/vote', $login));
    }