allow a more flexible way of using user backends

remotes/origin/stable5
Robin Appelman 13 years ago
parent e031b9b880
commit 33b8de91ea
  1. 2
      lib/base.php
  2. 8
      lib/user.php

@ -345,7 +345,7 @@ class OC{
$_SESSION['user_id'] = ''; $_SESSION['user_id'] = '';
} }
OC_User::useBackend( OC_Config::getValue( "userbackend", "database" )); OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database()); OC_Group::useBackend(new OC_Group_Database());
// Load Apps // Load Apps

@ -50,8 +50,8 @@ class OC_User {
* *
* Makes a list of backends that can be used by other modules * Makes a list of backends that can be used by other modules
*/ */
public static function registerBackend( $name ){ public static function registerBackend( $backend ){
self::$_backends[] = $name; self::$_backends[] = $backend;
return true; return true;
} }
@ -83,6 +83,9 @@ class OC_User {
* Set the User Authentication Module * Set the User Authentication Module
*/ */
public static function useBackend( $backend = 'database' ){ public static function useBackend( $backend = 'database' ){
if($backend instanceof OC_User_Backend){
self::$_usedBackends[get_class($backend)]=$backend;
}else{
// You'll never know what happens // You'll never know what happens
if( null === $backend OR !is_string( $backend )){ if( null === $backend OR !is_string( $backend )){
$backend = 'database'; $backend = 'database';
@ -100,6 +103,7 @@ class OC_User {
self::$_usedBackends[$backend] = new $className(); self::$_usedBackends[$backend] = new $className();
break; break;
} }
}
true; true;
} }

Loading…
Cancel
Save