Cache results of isAdmin and isManager
commit96348f2713371161f056dbad3a465a6cdedba70b
authorAndreas Gohr <andi@splitbrain.org>
Mon, 11 May 2020 13:03:50 +0000 (11 15:03 +0200)
committerAndreas Gohr <andi@splitbrain.org>
Mon, 11 May 2020 13:09:59 +0000 (11 15:09 +0200)
treee2277918acbee2e069229a4fb5fa7c9ae26aa71b
parent41f652aca5fa49d0f600d1b82dabe9fcef395f06
Cache results of isAdmin and isManager

isAdmin() is called within the ACL check (and probably various other
places in DokuWiki core). In a Wiki with lots of ACL checks (most
noticable with the indexmenu) and users with a lot of groups (as typical
in corporate ActiveDirectory environments) this check can take a
significant portion of the time of a request time doing exactly the same
thing again and again.

This introduces a static request level cache for the result of the
isAdmin and isManager checks based on the requested user and groups.

A new parameter allows to skip the cache, though I don't think there
should be a good reason to skip the cache except for testing purposes.
inc/auth.php