continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r442474 - /maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
Date Tue, 12 Sep 2006 06:24:26 GMT
Author: carlos
Date: Mon Sep 11 23:24:25 2006
New Revision: 442474

URL: http://svn.apache.org/viewvc?view=rev&rev=442474
Log:
Create default project group on initialization

Modified:
    maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java

Modified: maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java?view=diff&rev=442474&r1=442473&r2=442474
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-security/continuum-security-acegi/src/main/java/org/apache/maven/continuum/security/acegi/acl/AclInitializer.java
Mon Sep 11 23:24:25 2006
@@ -18,6 +18,8 @@
 
 import org.acegisecurity.acl.basic.NamedEntityObjectIdentity;
 import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.store.ContinuumStore;
+import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.user.acegi.acl.basic.ExtendedSimpleAclEntry;
 
 /**
@@ -31,12 +33,38 @@
 {
     public static final int PARENT_PROJECT_GROUP_ACL_ID = 0;
 
+    /**
+     * @plexus.requirement
+     */
+    private ContinuumStore store;
+
     protected void insertDefaultData()
     {
-        /* admin can do anything with project number 1 */
+        /* 
+         * admin can do anything with project group number 0,
+         * which is just a placeholder that other project group ACLs must extend 
+         */
         ExtendedSimpleAclEntry aclEntry = new ExtendedSimpleAclEntry();
         aclEntry.setAclObjectIdentity( new NamedEntityObjectIdentity( ProjectGroup.class.getName(),
Integer
             .toString( PARENT_PROJECT_GROUP_ACL_ID ) ) );
+        aclEntry.setRecipient( "ROLE_admin" );
+        aclEntry.addPermission( ExtendedSimpleAclEntry.ADMINISTRATION );
+        getDao().create( aclEntry );
+
+        /* add ACL for default project group */
+
+        ProjectGroup defaultProjectGroup;
+        try
+        {
+            defaultProjectGroup = store.getProjectGroupByGroupId( ContinuumStore.DEFAULT_GROUP_ID
);
+        }
+        catch ( ContinuumStoreException e )
+        {
+            throw new RuntimeException( "Default project group was not found", e );
+        }
+        aclEntry = new ExtendedSimpleAclEntry();
+        aclEntry.setAclObjectIdentity( new NamedEntityObjectIdentity( ProjectGroup.class.getName(),
Integer
+            .toString( defaultProjectGroup.getId() ) ) );
         aclEntry.setRecipient( "ROLE_admin" );
         aclEntry.addPermission( ExtendedSimpleAclEntry.ADMINISTRATION );
         getDao().create( aclEntry );



Mime
View raw message