Skip to content

Commit

Permalink
dev: moved getUserByName from authpluginbase to limesurveyapi
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Apr 2, 2013
1 parent 6f4cc78 commit 07a4a09
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion application/core/plugins/Authdb/Authdb.php
Expand Up @@ -77,7 +77,7 @@ public function newUserSession()
$password = $this->getPassword();
$onepass = $this->getOnePass();

$user = $this->getUserByName($username);
$user = $this->api->getUserByName($username);

if ($user !== null)
{
Expand Down
2 changes: 1 addition & 1 deletion application/core/plugins/Authwebserver/Authwebserver.php
Expand Up @@ -47,7 +47,7 @@ public function newUserSession()
/* @var $identity LSUserIdentity */
$sUser = $this->getUserName();

$oUser = $this->getUserByName($sUser);
$oUser = $this->api->getUserByName($sUser);
if (is_null($oUser))
{
if (function_exists("hook_get_auth_webserver_profile"))
Expand Down
13 changes: 0 additions & 13 deletions application/libraries/PluginManager/AuthPluginBase.php
Expand Up @@ -24,20 +24,7 @@ protected function getPassword()
{
return $this->_password;
}

/**
* Get the user object for a given username
*
* @param string $username
* @return User|null Returns the user, or null when not found
*/
protected function getUserByName($username)
{
$user = User::model()->findByAttributes(array('users_name' => $username));

return $user;
}

/**
* Get the username (if set)
*
Expand Down
23 changes: 19 additions & 4 deletions application/libraries/PluginManager/LimesurveyApi.php
Expand Up @@ -198,13 +198,28 @@ public function getOldResponseTables($surveyId)
return $tables;
}
/**
* Retrieves user details for a user
* Returns null if the user does not exist anymore for some reason (should not really happen)
* @return User
*/
* Retrieves user details for a user
* Returns null if the user does not exist anymore for some reason (should not really happen)
*
* @param int $iUserID The userid
* @return User
*/
public function getUser($iUserID){
return User::model()->findByPk($iUserID);
}

/**
* Get the user object for a given username
*
* @param string $username
* @return User|null Returns the user, or null when not found
*/
protected function getUserByName($username)
{
$user = User::model()->findByAttributes(array('users_name' => $username));

return $user;
}


/**
Expand Down

0 comments on commit 07a4a09

Please sign in to comment.