summaryrefslogtreecommitdiffstats
path: root/lib/user.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/user.php')
-rw-r--r--lib/user.php50
1 files changed, 30 insertions, 20 deletions
diff --git a/lib/user.php b/lib/user.php
index f1903093d6d..e3c9c23effa 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -21,7 +21,7 @@
*/
/**
- * This class provides wrapper methods for user management. Multiple backends are
+ * This class provides wrapper methods for user management. Multiple backends are
* supported. User management operations are delegated to the configured backend for
* execution.
*
@@ -50,8 +50,8 @@ class OC_User {
*
* Makes a list of backends that can be used by other modules
*/
- public static function registerBackend( $name ){
- self::$_backends[] = $name;
+ public static function registerBackend( $backend ){
+ self::$_backends[] = $backend;
return true;
}
@@ -83,28 +83,38 @@ class OC_User {
* Set the User Authentication Module
*/
public static function useBackend( $backend = 'database' ){
- // You'll never know what happens
- if( null === $backend OR !is_string( $backend )){
- $backend = 'database';
- }
+ if($backend instanceof OC_User_Interface){
+ self::$_usedBackends[get_class($backend)]=$backend;
+ }else{
+ // You'll never know what happens
+ if( null === $backend OR !is_string( $backend )){
+ $backend = 'database';
+ }
- // Load backend
- switch( $backend ){
- case 'database':
- case 'mysql':
- case 'sqlite':
- self::$_usedBackends[$backend] = new OC_User_Database();
- break;
- default:
- $className = 'OC_USER_' . strToUpper($backend);
- self::$_usedBackends[$backend] = new $className();
- break;
+ // Load backend
+ switch( $backend ){
+ case 'database':
+ case 'mysql':
+ case 'sqlite':
+ self::$_usedBackends[$backend] = new OC_User_Database();
+ break;
+ default:
+ $className = 'OC_USER_' . strToUpper($backend);
+ self::$_usedBackends[$backend] = new $className();
+ break;
+ }
}
-
true;
}
/**
+ * remove all used backends
+ */
+ public static function clearBackends(){
+ self::$_usedBackends=array();
+ }
+
+ /**
* @brief Create a new user
* @param $uid The username of the user to create
* @param $password The password of the new user
@@ -200,7 +210,7 @@ class OC_User {
if( $run ){
$uid=self::checkPassword( $uid, $password );
if($uid){
- session_regenerate_id();
+ session_regenerate_id(true);
self::setUserId($uid);
OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>$password ));
return true;