From c179167850b6c44679deb9edd4a816243addb52d Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 3 Dec 2007 21:15:32 +0100 Subject: getUserData should really be implemented always... (FS#1272) ... but with this patch DokuWiki will not break completely when left out for trustExternal() auth backends darcs-hash:20071203201532-7ad00-72dbc2d16e4c8c09cca9558286164f4d858c19ce.gz --- feed.php | 8 ++++---- inc/auth/basic.class.php | 7 +++++-- inc/common.php | 1 + inc/infoutils.php | 7 ++----- lib/plugins/acl/admin.php | 6 +++++- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/feed.php b/feed.php index b632918d4..32885fcef 100644 --- a/feed.php +++ b/feed.php @@ -236,11 +236,11 @@ function rss_buildItems(&$rss,&$data,$opt){ if($user && $conf['useacl'] && $auth){ $userInfo = $auth->getUserData($user); $item->author = $userInfo['name']; - if($opt['guardmail']) { - //cannot obfuscate because some RSS readers may check validity - $item->authorEmail = $user.'@'.$recent['ip']; - }else{ + if($userInfo && !$opt['guardmail']){ $item->authorEmail = $userInfo['mail']; + }else{ + //cannot obfuscate because some RSS readers may check validity + $item->authorEmail = $user.'@'.$recent['ip']; } }elseif($user){ // this happens when no ACL but some Apache auth is used diff --git a/inc/auth/basic.class.php b/inc/auth/basic.class.php index 077b92d62..bf251bae0 100644 --- a/inc/auth/basic.class.php +++ b/inc/auth/basic.class.php @@ -109,7 +109,8 @@ class auth_basic { * If this function is implemented it will be used to * authenticate a user - all other DokuWiki internals * will not be used for authenticating, thus - * implementing the functions below becomes optional. + * implementing the checkPass() function is not needed + * anymore. * * The function can be used to authenticate against third * party cookies or Apache auth mechanisms and replaces @@ -159,6 +160,8 @@ class auth_basic { * Checks if the given user exists and the given * plaintext password is correct * + * May be ommited if trustExternal is used. + * * @author Andreas Gohr * @return bool */ @@ -181,7 +184,7 @@ class auth_basic { * @return array containing user data or false */ function getUserData($user) { - msg("no valid authorisation system in use", -1); + if(!$this->cando['external']) msg("no valid authorisation system in use", -1); return false; } diff --git a/inc/common.php b/inc/common.php index 96980e7ee..ec500d906 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1061,6 +1061,7 @@ function subscriber_addresslist($id){ foreach ($mlist as $who) { $who = rtrim($who); $info = $auth->getUserData($who); + if($info === false) continue; $level = auth_aclcheck($id,$who,$info['grps']); if ($level >= AUTH_READ) { if (strcasecmp($info['mail'],$conf['notify']) != 0) { diff --git a/inc/infoutils.php b/inc/infoutils.php index f08acb318..c9e553ba7 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -165,11 +165,8 @@ function check(){ } if($INFO['userinfo']['name']){ - global $auth; - msg('You are currently logged in as '.$_SESSION[DOKU_COOKIE]['auth']['user'].' ('.$INFO['userinfo']['name'].')',0); - - if($auth) $info = $auth->getUserData($_SESSION[DOKU_COOKIE]['auth']['user']); - msg('You are part of the groups '.implode($info['grps'],', '),0); + msg('You are currently logged in as '.$_SERVER['REMOTE_USER'].' ('.$INFO['userinfo']['name'].')',0); + msg('You are part of the groups '.join($INFO['userinfo']['grps'],', '),0); }else{ msg('You are currently not logged in',0); } diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php index e15d8aa9a..1e44b1ee5 100644 --- a/lib/plugins/acl/admin.php +++ b/lib/plugins/acl/admin.php @@ -348,7 +348,11 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin { }else{ $user = auth_nameencode($who); $info = $auth->getUserData($user); - $groups = $info['groups']; + if($info === false){ + $groups = array(); + }else{ + $groups = $info['groups']; + } } // check the permissions -- cgit v1.2.3