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 | |
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
-rw-r--r-- | inc/auth.php | 58 | ||||
-rw-r--r-- | inc/auth/basic.class.php | 4 | ||||
-rw-r--r-- | inc/lang/de/lang.php | 2 | ||||
-rw-r--r-- | inc/lang/en/lang.php | 2 |
4 files changed, 38 insertions, 28 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'])); diff --git a/inc/auth/basic.class.php b/inc/auth/basic.class.php index cf19e2c79..8905f283d 100644 --- a/inc/auth/basic.class.php +++ b/inc/auth/basic.class.php @@ -10,6 +10,8 @@ class auth_basic { + var $success = TRUE; + /** * Check user+password [ MUST BE OVERRIDDEN ] * @@ -156,4 +158,4 @@ class auth_basic { # msg("authorisation method does not support alteration of group memberships", -1); # return false; # } -}
\ No newline at end of file +} diff --git a/inc/lang/de/lang.php b/inc/lang/de/lang.php index 717200396..1f6818c29 100644 --- a/inc/lang/de/lang.php +++ b/inc/lang/de/lang.php @@ -171,4 +171,6 @@ $lang['subscribe_noaddress']= 'Weil Deine E-Mail-Adresse fehlt, kannst Du leider $lang['unsubscribe_success']= 'Das Abonnement von %s für die Seite %s wurde aufgelöst'; $lang['unsubscribe_error'] = 'Das Abonnement von %s für die Seite %s konnte nicht aufgelöst werden'; +$lang['authmodfailed'] = 'Benutzerüberprüfung nicht möglich. Bitte wenden Sie sich an den Systembetreuer.'; + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index e615b4afd..a0cd67029 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -190,4 +190,6 @@ $lang['subscribe_noaddress']= 'There is no address associated with your login, y $lang['unsubscribe_success']= 'Removed %s from subscription list for %s'; $lang['unsubscribe_error'] = 'Error removing %s from subscription list for %s'; +$lang['authmodfailed'] = 'User authentification not possible. Please inform your system administrator.'; + //Setup VIM: ex: et ts=2 enc=utf-8 : |