Commits

Sebastian Sdorra committed 3f31b2a

grant owner permissions to each repository for admins

  • Participants
  • Parent commits cb3f696
  • Branches apache-shiro

Comments (0)

Files changed (1)

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

 import sonia.scm.group.Group;
 import sonia.scm.group.GroupManager;
 import sonia.scm.repository.Permission;
+import sonia.scm.repository.PermissionType;
 import sonia.scm.repository.Repository;
 import sonia.scm.repository.RepositoryDAO;
 import sonia.scm.repository.RepositoryListener;
   private AuthorizationInfo createAuthorizationInfo(User user, Groups groups)
   {
     Set<String> roles = Sets.newHashSet();
+    List<org.apache.shiro.authz.Permission> permissions = null;
 
     roles.add(ROLE_USER);
 
       }
 
       roles.add(ROLE_ADMIN);
+      permissions = Lists.newArrayList();
+      permissions.add(new RepositoryPermission("*", PermissionType.OWNER));
+    }
+    else
+    {
+      permissions = collectRepositoryPermissions(user, roles);
     }
 
     SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(roles);
 
-    info.addObjectPermissions(collectRepositoryPermissions(user,
-      groups.getGroups()));
+    info.addObjectPermissions(permissions);
 
     return info;
   }