Piwik\Plugins\UsersManager\Model::getUser PHP Method

getUser() public method

public getUser ( $userLogin )
    public function getUser($userLogin)
    {
        $db = $this->getDb();
        $matchedUsers = $db->fetchAll("SELECT * FROM " . $this->table . " WHERE login = ?", $userLogin);
        // for BC in 2.15 LTS, if there is a user w/ an exact match to the requested login, return that user.
        // this is done since before this change, login was case sensitive. until 3.0, we want to maintain
        // this behavior.
        foreach ($matchedUsers as $user) {
            if ($user['login'] == $userLogin) {
                return $user;
            }
        }
        return reset($matchedUsers);
    }

Usage Example

Example #1
0
File: Auth.php Project: piwik/piwik
 private function authenticateWithTokenOrHashToken($token, $login)
 {
     $user = $this->userModel->getUser($login);
     if (!empty($user['token_auth']) && (SessionInitializer::getHashTokenAuth($login, $user['token_auth']) === $token || $user['token_auth'] === $token)) {
         return $this->authenticationSuccess($user);
     }
     return new AuthResult(AuthResult::FAILURE, $login, $token);
 }
All Usage Examples Of Piwik\Plugins\UsersManager\Model::getUser