From 25f80763dd71190679289de2b8d29f28021aedb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Wed, 11 Mar 2015 19:49:14 +0100 Subject: Get total number of users in ad, needed for paging --- lib/plugins/authad/auth.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'lib/plugins/authad') diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index 88b56046c..a0a1143db 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -116,6 +116,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { // other can do's are changed in $this->_loadServerConfig() base on domain setup $this->cando['modName'] = true; $this->cando['modMail'] = true; + $this->cando['getUserCount'] = true; } /** @@ -325,6 +326,26 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin { return false; } + /** + * @param array $filter + * @return int + */ + public function getUserCount($filter = array()) { + + $adldap = $this->_adldap(null); + if(!$adldap) { + dbglog("authad/auth.php: _adldap not set."); + return -1; + } + + $result = $adldap->user()->all(); + if (!$result) { + dbglog("authad/auth.php: getting all users failed."); + return -1; + } + return count($result); + } + /** * Bulk retrieval of user data * -- cgit v1.2.3