continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcconn...@apache.org
Subject svn commit: r449868 - in /maven/continuum/branches/rbac-integration: continuum-core/ continuum-core/src/main/java/org/apache/maven/continuum/ continuum-core/src/main/java/org/apache/maven/continuum/core/action/ continuum-core/src/main/resources/META-IN...
Date Tue, 26 Sep 2006 00:06:21 GMT
Author: jmcconnell
Date: Mon Sep 25 17:06:20 2006
New Revision: 449868

URL: http://svn.apache.org/viewvc?view=rev&rev=449868
Log:
added an action for generating the manager and user roles for when a new maven project is
added

Added:
    maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
  (with props)
Modified:
    maven/continuum/branches/rbac-integration/continuum-core/pom.xml
    maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
    maven/continuum/branches/rbac-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
    maven/continuum/branches/rbac-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
    maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupDeveloperDynamicRoleProfile.java
    maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupUserDynamicRoleProfile.java
    maven/continuum/branches/rbac-integration/continuum-security/src/main/resources/META-INF/plexus/components.xml

Modified: maven/continuum/branches/rbac-integration/continuum-core/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-core/pom.xml?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-core/pom.xml (original)
+++ maven/continuum/branches/rbac-integration/continuum-core/pom.xml Mon Sep 25 17:06:20 2006
@@ -157,6 +157,26 @@
       <groupId>org.apache.maven.continuum</groupId>
       <artifactId>continuum-release</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.continuum</groupId>
+      <artifactId>continuum-security</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-rbac-profile</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <artifactId>plexus-security-authorization-rbac-model</artifactId>
+      <version>1.0-SNAPSHOT</version>
+    </dependency>
+     <dependency>
+      <artifactId>plexus-security-authorization-rbac-store-memory</artifactId>
+      <groupId>org.codehaus.plexus.security</groupId>
+      <version>1.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   <profiles>
     <profile>

Modified: maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
(original)
+++ maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java
Mon Sep 25 17:06:20 2006
@@ -1045,6 +1045,8 @@
 
                 int projectGroupId = AbstractContinuumAction.getProjectGroupId( pgContext
);
 
+
+
                 projectGroup = store.getProjectGroupWithProjects( projectGroupId );
             }
         }
@@ -1092,6 +1094,9 @@
         {
             throw new ContinuumException( "Error adding projects from modules", e );
         }
+        context.put( AbstractContinuumAction.KEY_PROJECT_GROUP_ID, new Integer( projectGroup.getId()
) );
+        // add the relevent security administration roles for this project
+        executeAction( "add-assignable-roles", context );
 
         return result;
     }
@@ -2252,6 +2257,7 @@
         }
         catch ( ActionNotFoundException e )
         {
+            e.printStackTrace( );
             throw new ContinuumException( "Error while executing the action '" + actionName
+ "'.", e );
         }
         catch ( ContinuumException e )

Added: maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java?view=auto&rev=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
(added)
+++ maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
Mon Sep 25 17:06:20 2006
@@ -0,0 +1,63 @@
+package org.apache.maven.continuum.core.action;
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+import org.codehaus.plexus.rbac.profile.RoleProfileException;
+import org.codehaus.plexus.rbac.profile.RoleProfileManager;
+import org.codehaus.plexus.security.rbac.Role;
+
+import java.util.Map;
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AddAssignableRolesAction:
+ *
+ * @author: Jesse McConnell <jmcconnell@apache.org>
+ * @version: $ID:$
+ *
+ * @plexus.component
+ *   role="org.codehaus.plexus.action.Action"
+ *   role-hint="add-assignable-roles"
+ */
+public class AddAssignableRolesAction
+    extends AbstractContinuumAction
+{
+//    private ContinuumStore store;
+
+    private RoleProfileManager roleManager;
+
+    public void execute( Map context )
+        throws ContinuumException, ContinuumStoreException
+    {
+        int projectGroupId =  getProjectGroupId( context );
+
+  //      ProjectGroup projectGroup = store.getProjectGroupWithBuildDetails( projectGroupId
);
+
+        //todo make the resource the name of the project group and hide the id from the user
+
+        try
+        {
+            Role developer = roleManager.getDynamicRole( "continuum-group-developer", ""
+ projectGroupId );
+
+            Role user = roleManager.getDynamicRole( "continuum-group-user", ""  + projectGroupId
);
+        }
+        catch ( RoleProfileException rpe )
+        {
+            throw new ContinuumException( "error generating dynamic role for project " +
projectGroupId );
+        }
+    }
+}

Propchange: maven/continuum/branches/rbac-integration/continuum-core/src/main/java/org/apache/maven/continuum/core/action/AddAssignableRolesAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: maven/continuum/branches/rbac-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/branches/rbac-integration/continuum-core/src/main/resources/META-INF/plexus/components.xml
Mon Sep 25 17:06:20 2006
@@ -564,6 +564,22 @@
      -->
     <component>
       <role>org.codehaus.plexus.action.Action</role>
+      <role-hint>add-assignable-roles</role-hint>
+      <implementation>org.apache.maven.continuum.core.action.AddAssignableRolesAction</implementation>
+      <requirements>
+        <!--
+        <requirement>
+          <role>org.apache.maven.continuum.store.ContinuumStore</role>
+        </requirement>
+        -->
+        <requirement>
+          <role>org.codehaus.plexus.rbac.profile.RoleProfileManager</role>
+          <role-hint>continuum</role-hint>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.action.Action</role>
       <role-hint>add-build-definition-to-project</role-hint>
       <implementation>org.apache.maven.continuum.core.action.AddBuildDefinitionToProjectAction</implementation>
       <requirements>

Modified: maven/continuum/branches/rbac-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
(original)
+++ maven/continuum/branches/rbac-integration/continuum-core/src/test/resources/org/apache/maven/continuum/DefaultContinuumTest.xml
Mon Sep 25 17:06:20 2006
@@ -28,5 +28,27 @@
       </configuration>
     </component>
 
+     <component>
+      <role>org.codehaus.plexus.rbac.profile.DynamicRoleProfile</role>
+      <role-hint>continuum-group-developer</role-hint>
+      <implementation>org.apache.maven.continuum.security.profile.ProjectGroupDeveloperDynamicRoleProfile</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.security.rbac.RBACManager</role>
+          <role-hint>memory</role-hint>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.rbac.profile.DynamicRoleProfile</role>
+      <role-hint>continuum-group-user</role-hint>
+      <implementation>org.apache.maven.continuum.security.profile.ProjectGroupUserDynamicRoleProfile</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.security.rbac.RBACManager</role>
+          <role-hint>memory</role-hint>
+        </requirement>
+      </requirements>
+    </component>
   </components>
 </plexus>

Modified: maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupDeveloperDynamicRoleProfile.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupDeveloperDynamicRoleProfile.java?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupDeveloperDynamicRoleProfile.java
(original)
+++ maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupDeveloperDynamicRoleProfile.java
Mon Sep 25 17:06:20 2006
@@ -27,6 +27,10 @@
  *
  * @author: Jesse McConnell <jmcconnell@apache.org>
  * @version: $ID:$
+ *
+ * @plexus.component
+ *   role="org.codehaus.plexus.rbac.profile.RoleProfile"
+ *   role-hint="continuum-group-developer"
  */
 public class ProjectGroupDeveloperDynamicRoleProfile
     extends AbstractDynamicRoleProfile

Modified: maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupUserDynamicRoleProfile.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupUserDynamicRoleProfile.java?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupUserDynamicRoleProfile.java
(original)
+++ maven/continuum/branches/rbac-integration/continuum-security/src/main/java/org/apache/maven/continuum/security/profile/ProjectGroupUserDynamicRoleProfile.java
Mon Sep 25 17:06:20 2006
@@ -26,6 +26,10 @@
  *
  * @author: Jesse McConnell <jmcconnell@apache.org>
  * @version: $ID:$
+ *
+ * @plexus.component
+ *   role="org.codehaus.plexus.rbac.profile.RoleProfile"
+ *   role-hint="continuum-group-user"
  */
 public class ProjectGroupUserDynamicRoleProfile
     extends AbstractDynamicRoleProfile

Modified: maven/continuum/branches/rbac-integration/continuum-security/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/rbac-integration/continuum-security/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=449868&r1=449867&r2=449868
==============================================================================
--- maven/continuum/branches/rbac-integration/continuum-security/src/main/resources/META-INF/plexus/components.xml
(original)
+++ maven/continuum/branches/rbac-integration/continuum-security/src/main/resources/META-INF/plexus/components.xml
Mon Sep 25 17:06:20 2006
@@ -20,5 +20,39 @@
         </requirement>
       </requirements>
     </component>
+    <component>
+      <role>org.codehaus.plexus.rbac.profile.DynamicRoleProfile</role>
+      <role-hint>continuum-group-developer</role-hint>
+      <implementation>org.apache.maven.continuum.security.profile.ProjectGroupDeveloperDynamicRoleProfile</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.security.rbac.RBACManager</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.rbac.profile.DynamicRoleProfile</role>
+      <role-hint>continuum-group-user</role-hint>
+      <implementation>org.apache.maven.continuum.security.profile.ProjectGroupUserDynamicRoleProfile</implementation>
+      <requirements>
+        <requirement>
+          <role>org.codehaus.plexus.security.rbac.RBACManager</role>
+        </requirement>
+      </requirements>
+    </component>
+    <component>
+      <role>org.codehaus.plexus.rbac.profile.RoleProfile</role>
+      <role-hint>continuum-system-administrator</role-hint>
+      <implementation>org.apache.maven.continuum.security.profile.ContinuumSystemAdministratorRoleProfile</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>
   </components>
 </component-set>



Mime
View raw message