Commits

Sebastian Sdorra  committed a8cc573

clear cache if permission has changed

  • Participants
  • Parent commits 0cac888
  • Branches issue-340

Comments (0)

Files changed (1)

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

 import sonia.scm.repository.RepositoryDAO;
 import sonia.scm.repository.RepositoryEvent;
 import sonia.scm.repository.RepositoryManager;
+import sonia.scm.store.StoredAssignedPermissionEvent;
 import sonia.scm.user.User;
 import sonia.scm.user.UserDAO;
 import sonia.scm.user.UserEvent;
    * @param event
    */
   @Subscribe
+  public void onEvent(StoredAssignedPermissionEvent event)
+  {
+    if (event.getEventType().isPost())
+    {
+      if (logger.isDebugEnabled())
+      {
+        logger.debug("clear cache, because permission {} has changed",
+          event.getPermission().getId());
+      }
+
+      cache.clear();
+    }
+  }
+
+  /**
+   * Method description
+   *
+   *
+   * @param event
+   */
+  @Subscribe
   public void onEvent(UserEvent event)
   {
     if (event.getEventType().isPost())