Commits

Sebastian Sdorra committed 9c7f85b

fix IllegalArgumentException with nested privileged actions

  • Participants
  • Parent commits b9f8c03

Comments (0)

Files changed (1)

File scm-webapp/src/main/java/sonia/scm/web/security/DefaultAdministrationContext.java

 
 import sonia.scm.SCMContext;
 import sonia.scm.group.GroupNames;
+import sonia.scm.security.Role;
 import sonia.scm.security.ScmRealm;
 import sonia.scm.user.User;
 import sonia.scm.util.AssertUtil;
 
     if (ThreadContext.getSecurityManager() != null)
     {
-      doRunAsInWebSessionContext(action);
+      Subject subject = SecurityUtils.getSubject();
+
+      if (subject.hasRole(Role.ADMIN))
+      {
+        logger.debug(
+          "user is already an admin, we need no system account session");
+      }
+      else
+      {
+        doRunAsInWebSessionContext(action);
+      }
     }
     else
     {