diff options
author | Matthias Grimm <matthiasgrimm@users.sourceforge.net> | 2005-11-05 13:49:32 +0100 |
---|---|---|
committer | Matthias Grimm <matthiasgrimm@users.sourceforge.net> | 2005-11-05 13:49:32 +0100 |
commit | d2dde4eb797d69646f31f2b86b686db7707427d3 (patch) | |
tree | d10fd3af72fe2ba7ee39d43d87eede0cc91d6146 /inc/auth.php | |
parent | 85c8619a725d6a5007e0803e1997f40d423949c8 (diff) | |
download | rpg-d2dde4eb797d69646f31f2b86b686db7707427d3.tar.gz rpg-d2dde4eb797d69646f31f2b86b686db7707427d3.tar.bz2 |
OO_auth_fixes
This patch allows the OO auth module to fail. The basic class got
a new property $success that is checked in auth.php. Derived classes
might change this calue in their constructors.
Beautifying the whitespaces in auth.php completes this patch.
darcs-hash:20051105124932-4145d-dfcfa6c3b87d0087b4bffe3e5a29db000b10b242.gz
Diffstat (limited to 'inc/auth.php')
-rw-r--r-- | inc/auth.php | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/inc/auth.php b/inc/auth.php index 76ce525cf..26d208a1f 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -23,51 +23,55 @@ $auth_class = "auth_".$conf['authtype']; if (!class_exists($auth_class)) $auth_class = "auth_basic"; $auth = new $auth_class(); + if ($auth->success == false) { + msg($lang['authmodfailed'],-1); + unset($auth); + } // interface between current dokuwiki/old auth system and new style auth object function auth_canDo($fn) { - global $auth; - return method_exists($auth, $fn); - } + global $auth; + return method_exists($auth, $fn); + } - // mandatory functions - these should exist + // mandatory functions - these should exist function auth_checkPass($user,$pass) { - global $auth; - return method_exists($auth,'checkPass') ? $auth->checkPass($user, $pass) : false; - } + global $auth; + return method_exists($auth,'checkPass') ? $auth->checkPass($user, $pass) : false; + } - function auth_getUserData($user) { - global $auth; - return method_exists($auth, 'getUserData') ? $auth->getUserData($user) : false; - } + function auth_getUserData($user) { + global $auth; + return method_exists($auth, 'getUserData') ? $auth->getUserData($user) : false; + } - // optional functions, behave gracefully if these don't exist; - // potential calling code should query whether these exist in advance + // optional functions, behave gracefully if these don't exist; + // potential calling code should query whether these exist in advance function auth_createUser($user,$pass,$name,$mail) { - global $auth; - return method_exists($auth, 'createUser') ? $auth->createUser($user,$pass,$name,$mail) : null; - } + global $auth; + return method_exists($auth, 'createUser') ? $auth->createUser($user,$pass,$name,$mail) : null; + } - function auth_modifyUser($user, $changes) { - global $auth; - return method_exists($auth, 'modifyUser') ? $auth->modifyUser($user,$changes) : false; - } + function auth_modifyUser($user, $changes) { + global $auth; + return method_exists($auth, 'modifyUser') ? $auth->modifyUser($user,$changes) : false; + } function auth_deleteUsers($users) { - global $auth; - return method_exists($auth, 'deleteUsers') ? $auth->deleteUsers($users) : 0; - } + global $auth; + return method_exists($auth, 'deleteUsers') ? $auth->deleteUsers($users) : 0; + } - // other functions, will only be accessed by new code - //- these must query auth_canDo() or test method existence themselves. + // other functions, will only be accessed by new code + //- these must query auth_canDo() or test method existence themselves. } else { // old style auth functions require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.php'); $auth = null; - // new function, allows other parts of dokuwiki to know what they can and can't do - function auth_canDo($fn) { return function_exists("auth_$fn"); } + // new function, allows other parts of dokuwiki to know what they can and can't do + function auth_canDo($fn) { return function_exists("auth_$fn"); } } if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5($conf['title'])); |