From 2046a6546c8ed62b9a7b33305b6201458f2f8291 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 12 Mar 2014 15:38:28 +0000 Subject: Allow user info to be retrieved without groups Some parts of dokuwiki (e.g. recent changes, old revisions) can requests lots of user info (to provide editor names) without requiring any group information. This change also implements caching of user info by authmysql & authpgsql plugins to avoid repeated querying of the DB to retrieve the same user information. --- lib/plugins/auth.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/plugins/auth.php') diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php index b04735639..f9e5cded9 100644 --- a/lib/plugins/auth.php +++ b/lib/plugins/auth.php @@ -15,6 +15,9 @@ if(!defined('DOKU_INC')) die(); class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { public $success = true; + const IGNORE_GROUPS = false; + const REQUIRE_GROUPS = true; + /** * Possible things an auth backend module may be able to * do. The things a backend can do need to be set to true @@ -234,9 +237,10 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * * @author Andreas Gohr * @param string $user the user name + * @param bool $requireGroups whether or not the returned data must include groups * @return array containing user data or false */ - public function getUserData($user) { + public function getUserData($user, $requireGroups=true) { if(!$this->cando['external']) msg("no valid authorisation system in use", -1); return false; } -- cgit v1.2.3 From 06e3e0c7b506a637df1ea27c6a8a439756e7139d Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 14 Mar 2014 17:58:53 +0000 Subject: use $requireGroups constants in auth classes; comments; code improvements --- lib/plugins/auth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/plugins/auth.php') diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php index f9e5cded9..9275611be 100644 --- a/lib/plugins/auth.php +++ b/lib/plugins/auth.php @@ -232,7 +232,7 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * at least these fields: * * name string full name of the user - * mail string email addres of the user + * mail string email address of the user * grps array list of groups the user is in * * @author Andreas Gohr @@ -240,7 +240,7 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * @param bool $requireGroups whether or not the returned data must include groups * @return array containing user data or false */ - public function getUserData($user, $requireGroups=true) { + public function getUserData($user, $requireGroups=self::REQUIRE_GROUPS) { if(!$this->cando['external']) msg("no valid authorisation system in use", -1); return false; } -- cgit v1.2.3 From 2dc9e90007f12ac996b0e74479137a9dc6243c3c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 4 May 2014 19:20:11 +0100 Subject: KISS - remove class constants for REQUIRE_GROUPS & IGNORE_GROUPS and replace with boolean values --- lib/plugins/auth.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/plugins/auth.php') diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php index 9275611be..b38b591a3 100644 --- a/lib/plugins/auth.php +++ b/lib/plugins/auth.php @@ -15,9 +15,6 @@ if(!defined('DOKU_INC')) die(); class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { public $success = true; - const IGNORE_GROUPS = false; - const REQUIRE_GROUPS = true; - /** * Possible things an auth backend module may be able to * do. The things a backend can do need to be set to true @@ -240,7 +237,7 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin { * @param bool $requireGroups whether or not the returned data must include groups * @return array containing user data or false */ - public function getUserData($user, $requireGroups=self::REQUIRE_GROUPS) { + public function getUserData($user, $requireGroups=true) { if(!$this->cando['external']) msg("no valid authorisation system in use", -1); return false; } -- cgit v1.2.3