Commits

Sebastian Sdorra  committed be5d7ad

clear authorization cache, when a group has changed

  • Participants
  • Parent commits bf08aa4
  • Branches issue-423

Comments (0)

Files changed (1)

File scm-webapp/src/main/java/sonia/scm/security/AuthorizationCollector.java

  */
 
 
+
 package sonia.scm.security;
 
 //~--- non-JDK imports --------------------------------------------------------
 
 import sonia.scm.cache.Cache;
 import sonia.scm.cache.CacheManager;
+import sonia.scm.group.GroupEvent;
 import sonia.scm.group.GroupNames;
 import sonia.scm.repository.PermissionType;
 import sonia.scm.repository.Repository;
    * Method description
    *
    *
-   * @param user
-   * @param groups
+   * @param event
+   */
+  @Subscribe
+  public void onEvent(GroupEvent event)
+  {
+    if (event.getEventType().isPost())
+    {
+      if (logger.isDebugEnabled())
+      {
+        logger.debug("clear cache, because group {} has changed",
+          event.getItem().getId());
+      }
+
+      cache.clear();
+    }
+  }
+
+  /**
+   * Method description
+   *
+   *
    *
    * @param principals
    *
    * @param user
    * @param groups
    *
-   * @return
    */
   private void collectGlobalPermissions(Builder<Permission> builder,
     final User user, final GroupNames groups)
    * @param user
    * @param groups
    *
-   * @return
    */
   private void collectRepositoryPermissions(Builder<Permission> builder,
     User user, GroupNames groups)
    * Method description
    *
    *
-   * @param permissions
    *
    * @param builder
    * @param repository