]> source.dussan.org Git - archiva.git/commitdiff
MRM-242 added a new base role for the repository managers to inherit
authorJesse McConnell <jmcconnell@apache.org>
Tue, 5 Dec 2006 16:37:53 +0000 (16:37 +0000)
committerJesse McConnell <jmcconnell@apache.org>
Tue, 5 Dec 2006 16:37:53 +0000 (16:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@482705 13f79535-47bb-0310-9956-ffa450edef68

archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleConstants.java
archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaRoleProfileManager.java
archiva-security/src/main/java/org/apache/maven/archiva/security/BaseRepositoryManagerRoleProfile.java [new file with mode: 0644]
archiva-security/src/main/java/org/apache/maven/archiva/security/RepositoryManagerDynamicRoleProfile.java
archiva-security/src/main/resources/META-INF/plexus/components.xml

index 17e085878108810a81fe1c1661f39c5e629db34b..1ab7f4be5c338dbce8d9fb2c95a15dd3c69c727f 100644 (file)
@@ -29,6 +29,8 @@ public class ArchivaRoleConstants
 
     public static final String GUEST_ROLE = "Guest";
 
+    public static final String BASE_REPOSITORY_MANAGER = "Repository Manager Base";
+
     // dynamic role prefixes
     public static final String REPOSITORY_MANAGER_ROLE_PREFIX = "Repository Manager";
 
index 1eb72ffb9c130b5ea6e60c541d726e750c9340c7..2d3aec8af43be818134795ea68cc96ac5927ce27 100644 (file)
@@ -32,6 +32,8 @@ public class ArchivaRoleProfileManager
     public void initialize()
         throws RoleProfileException
     {
+        getRole( "archiva-repository-manager-base" );
+
         mergeRoleProfiles( "system-administrator", "archiva-system-administrator" );
         mergeRoleProfiles( "user-administrator", "archiva-user-administrator" );
         mergeRoleProfiles( "guest", "archiva-guest" );
diff --git a/archiva-security/src/main/java/org/apache/maven/archiva/security/BaseRepositoryManagerRoleProfile.java b/archiva-security/src/main/java/org/apache/maven/archiva/security/BaseRepositoryManagerRoleProfile.java
new file mode 100644 (file)
index 0000000..a165e9b
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.maven.archiva.security;
+
+import org.codehaus.plexus.rbac.profile.AbstractRoleProfile;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @plexus.component role="org.codehaus.plexus.rbac.profile.RoleProfile"
+ * role-hint="archiva-repository-manager-base"
+ */
+public class BaseRepositoryManagerRoleProfile
+    extends AbstractRoleProfile
+{
+    /**
+     * Create the Role name for a Repository Manager, using the provided repository id.
+     *
+     */
+    public String getRoleName( )
+    {
+        return ArchivaRoleConstants.BASE_REPOSITORY_MANAGER;
+    }
+
+    public List getOperations()
+    {
+        List operations = new ArrayList();
+
+        operations.add( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION );
+
+        return operations;
+    }
+
+    public boolean isPermanent()
+    {
+        return true;
+    }
+
+    public boolean isAssignable()
+    {
+        return false;
+    }
+}
index c94fbac30a0e586a3f3e79f5194baf07b628f2bc..c7c4b4b4f8e99f51842b420bb9469e9ac0c34e3e 100644 (file)
@@ -52,6 +52,12 @@ public class RepositoryManagerDynamicRoleProfile
         return operations;
     }
 
+
+    public List getChildRoles()
+    {
+        return Collections.singletonList( ArchivaRoleConstants.BASE_REPOSITORY_MANAGER );
+    }
+
     public List getDynamicChildRoles( String string )
     {
         return Collections.singletonList(
index 3f5190db04abcf1863d8e2e82d28690ab687e5ff..5c34b87fefc96d373e20a0dab6f776ad3530d54d 100644 (file)
         </requirement>
       </requirements>
     </component>
+    <component>
+      <role>org.codehaus.plexus.rbac.profile.RoleProfile</role>
+      <role-hint>archiva-repository-manager-base</role-hint>
+      <implementation>org.apache.maven.archiva.security.BaseRepositoryManagerRoleProfile</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.security.rbac.RBACManager</role>
+        </requirement>
+        <requirement>
+          <role>org.codehaus.plexus.PlexusContainer</role>
+          <field-name>container</field-name>
+        </requirement>
+      </requirements>
+    </component>
     <component>
       <role>org.codehaus.plexus.rbac.profile.DynamicRoleProfile</role>
       <role-hint>archiva-repository-manager</role-hint>