Hi Andrey, Here it is: https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-security/xwiki-platform-security-bridge/src/main/java/org/xwiki/security/authorization/internal/DefaultSecurityCacheRulesInvalidatorListener.java
This is the listener you need to replace, and you need to care about the readWriteLock mechanism in place in the original version. For the rest, your implementation looks ok, but it is harsh to clean the whole cache, and it would be better to be more granular if possible (at least per wiki, per user, per group, per spaceā¦, regarding the per group case, be careful of the special case adding a user to a group introduce, since you also need to drop that new user in addition to the group it joins). Regards, On Mon, Apr 25, 2016 at 6:37 PM, abtv <[email protected]> wrote: > I haven't found SecurityCacheRulesInvalidatorListener class/interface and > implemented it in the following (code below). Can I clean cache like this? > > public class CleanCacheEvent extends AbstractWikiEvent { > public CleanCacheEvent(){ > super(); > } > } > > @Component > @Named("SecurityCacheRulesInvalidatorListener") > @Singleton > public class CustomSecurityCacheRulesInvalidatorListener extends > AbstractEventListener { > @Inject > private SecurityCache securityCache; > > @Inject > private SecurityReferenceFactory securityReferenceFactory; > > public CustomSecurityCacheRulesInvalidatorListener() { > super("SecurityCacheRulesInvalidatorListener", new > CleanCacheEvent()); > } > > public void onEvent(Event event, Object source, Object data) { > System.out.println("on invalidator listener event"); > SecurityReference root = > securityReferenceFactory.newEntityReference(null); > securityCache.remove(root); > System.out.println("cache was cleaned"); > } > } > > > > -- > View this message in context: > http://xwiki.475771.n2.nabble.com/How-to-invalidate-security-cache-tp7599138p7599203.html > Sent from the XWiki- Dev mailing list archive at Nabble.com. > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > -- Denis Gervalle SOFTEC sa - CEO _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

