diff options
author | Andreas Gohr <andi@splitbrain.org> | 2020-05-01 19:50:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 19:50:22 +0200 |
commit | 392db49b487deb36ed61be81cce84dc11d321ed9 (patch) | |
tree | 62c30a6e45843012e3c48fced2bd7967e188f3ee | |
parent | 7052c26d560477c3b156438d7c21972ddcd7acfc (diff) | |
parent | fdd649a2fff333f4ce68742e14b35f57f8086757 (diff) | |
download | dokuwiki-392db49b487deb36ed61be81cce84dc11d321ed9.tar.gz dokuwiki-392db49b487deb36ed61be81cce84dc11d321ed9.zip |
Merge pull request #3026 from splitbrain/authadmeh
Rough fix for ActiveDirectory caching
-rw-r--r-- | lib/plugins/authad/auth.php | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php index 2d6226706..27a6b229e 100644 --- a/lib/plugins/authad/auth.php +++ b/lib/plugins/authad/auth.php @@ -64,8 +64,6 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin */ protected $pattern = array(); - protected $actualstart = 0; - protected $grpsusers = array(); /** @@ -460,12 +458,18 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin */ protected function fillGroupUserArray($filter, $numberOfAdds) { - $this->grpsusers[$this->filterToString($filter)]; - $i = 0; + if (isset($this->grpsusers[$this->filterToString($filter)])) { + $actualstart = count($this->grpsusers[$this->filterToString($filter)]); + } else { + $this->grpsusers[$this->filterToString($filter)] = []; + $actualstart = 0; + } + + $i=0; $count = 0; $this->constructPattern($filter); foreach ($this->users as $user => &$info) { - if ($i++ < $this->actualstart) { + if ($i++ < $actualstart) { continue; } if ($info === false) { @@ -476,7 +480,6 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin if (($numberOfAdds > 0) && (++$count >= $numberOfAdds)) break; } } - $this->actualstart = $i; return $count; } @@ -495,12 +498,12 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin $adldap = $this->initAdLdap(null); if (!$adldap) return array(); - if (!$this->users) { + //if (!$this->users) { //get info for given user $result = $adldap->user()->all(false, $this->constructSearchString($filter)); if (!$result) return array(); $this->users = array_fill_keys($result, false); - } + //} $i = 0; $count = 0; @@ -528,6 +531,10 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin if (!isset($this->grpsusers[$this->filterToString($filter)]) || count($this->grpsusers[$this->filterToString($filter)]) < ($start+$limit) ) { + if(!isset($this->grpsusers[$this->filterToString($filter)])) { + $this->grpsusers[$this->filterToString($filter)] = []; + } + $this->fillGroupUserArray( $filter, $start+$limit - count($this->grpsusers[$this->filterToString($filter)]) +1 |