aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/plugins/authplain/auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/authplain/auth.php')
-rw-r--r--lib/plugins/authplain/auth.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php
index 374e7179c..d95c86de2 100644
--- a/lib/plugins/authplain/auth.php
+++ b/lib/plugins/authplain/auth.php
@@ -46,6 +46,7 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin
}
$this->cando['getUsers'] = true;
$this->cando['getUserCount'] = true;
+ $this->cando['getGroups'] = true;
}
$this->pregsplit_safe = version_compare(PCRE_VERSION, '6.7', '>=');
@@ -319,6 +320,29 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin
}
/**
+ * Retrieves groups.
+ * Loads complete user data into memory before searching for groups.
+ *
+ * @param int $start index of first group to be returned
+ * @param int $limit max number of groups to be returned
+ * @return array
+ */
+ public function retrieveGroups($start = 0, $limit = 0)
+ {
+ $groups = [];
+
+ if ($this->users === null) $this->_loadUserData();
+ foreach($this->users as $user => $info) {
+ $groups = array_merge($groups, array_diff($info['grps'], $groups));
+ }
+
+ if($limit > 0) {
+ return array_splice($groups, $start, $limit);
+ }
+ return array_splice($groups, $start);
+ }
+
+ /**
* Only valid pageid's (no namespaces) for usernames
*
* @param string $user