Add an $excludingBackend optional parameter

to the userExists method both in OCP\User and in OC_User.
This commit is contained in:
Lorenzo M. Catucci 2012-12-06 18:09:47 +01:00
parent 588bbd2c9f
commit 15afbfd198
2 changed files with 9 additions and 4 deletions

View File

@ -65,12 +65,12 @@ class User {
/**
* @brief check if a user exists
* @param string $uid the username
* @param string $excludingBackend (default none)
* @return boolean
*/
public static function userExists( $uid ) {
return \OC_USER::userExists( $uid );
public static function userExists( $uid, $excludingBackend = null ) {
return \OC_USER::userExists( $uid, $excludingBackend );
}
/**
* @brief Loggs the user out including all the session data
* @returns true

View File

@ -407,10 +407,15 @@ class OC_User {
/**
* @brief check if a user exists
* @param string $uid the username
* @param string $excludingBackend (default none)
* @return boolean
*/
public static function userExists($uid) {
public static function userExists($uid, $excludingBackend=null) {
foreach(self::$_usedBackends as $backend) {
if (!is_null($excludingBackend) && !strcmp(get_class($backend),$excludingBackend)) {
OC_Log::write('OC_User', $excludingBackend . 'excluded from user existance check.', OC_Log::DEBUG);
continue;
}
$result=$backend->userExists($uid);
if($result===true) {
return true;