Extensions Wiki » Extensions » Reset LDAP group cache snippet

Reset LDAP group cache snippet

Last modified by Thomas Mortagne on 2012/05/04 11:24
cogForce reseting the cache of LDAP groups
TypeSnippet
Developed by

Thomas Mortagne

LicenseGNU Lesser General Public License 2.1

Table of contents

Description

When using LDAP authentication you can (and should) setup a group cache which keep LDAP group in memory for some time to not redownload all of it every time someone authenticate. This can speedup quite a lot the authentication when there is a lot of groups of with a group containing a lot of users. See xwiki.authentication.ldap.groupcache_expiration property in xwiki.cfg and Authentication documentation.

This also mean that if you add or remove a user from a LDAP group you will not see it applied right away on XWiki.

To force applying to change you can execute the following groovy code which will force reseting the whole LDAP group cache:

{{groovy}}
com.xpn.xwiki.plugin.ldap.XWikiLDAPUtils.cachePool.clear()
{{/groovy}}
Note that there is an option for that in the LDAP administration UI since 4.0 Milestone 1.
Tags:
Created by Thomas Mortagne on 2012/05/04 11:18

Download XWiki