archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r755486 - in /archiva/trunk/archiva-modules/archiva-web: archiva-security/src/main/resources/META-INF/redback/ archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/
Date Wed, 18 Mar 2009 06:15:37 GMT
Author: brett
Date: Wed Mar 18 06:15:36 2009
New Revision: 755486

URL: http://svn.apache.org/viewvc?rev=755486&view=rev
Log:
[MRM-1133] delete artifact role not added on upgrade from previous version

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml?rev=755486&r1=755485&r2=755486&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-security/src/main/resources/META-INF/redback/redback.xml
Wed Mar 18 06:15:36 2009
@@ -196,8 +196,7 @@
               <id>archiva-delete-artifact</id>
               <name>Delete Artifact</name>
               <operation>archiva-delete-artifact</operation>
-              <resource>global</resource>
-              <permanent>true</permanent>
+              <resource>${resource}</resource>
             </permission>
             <permission>
               <id>archiva-edit-repository</id>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java?rev=755486&r1=755485&r2=755486&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java
Wed Mar 18 06:15:36 2009
@@ -54,7 +54,10 @@
 import org.apache.maven.archiva.repository.RepositoryNotFoundException;
 import org.apache.maven.archiva.repository.ManagedRepositoryContent;
 import org.apache.maven.archiva.repository.RepositoryContentFactory;
+import org.apache.maven.archiva.security.AccessDeniedException;
+import org.apache.maven.archiva.security.ArchivaSecurityException;
 import org.apache.maven.archiva.security.ArchivaXworkUser;
+import org.apache.maven.archiva.security.PrincipalNotFoundException;
 import org.apache.maven.archiva.security.UserRepositories;
 import org.codehaus.plexus.redback.rbac.RbacManagerException;
 
@@ -186,7 +189,7 @@
 
     public void prepare()
     {
-        managedRepos = new ArrayList<String>( configuration.getConfiguration().getManagedRepositoriesAsMap().keySet()
);
+        managedRepos = getManagableRepos();
     }
 
     public String input()
@@ -412,6 +415,28 @@
         this.auditListeners.remove( listener );
     }
 
+    private List<String> getManagableRepos()
+    {
+        try
+        {
+            return userRepositories.getManagableRepositoryIds( getPrincipal() );
+        }
+        catch ( PrincipalNotFoundException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        catch ( AccessDeniedException e )
+        {
+            log.warn( e.getMessage(), e );
+            // TODO: pass this onto the screen.
+        }
+        catch ( ArchivaSecurityException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        return Collections.emptyList();
+    }
+
     private void triggerAuditEvent( String user, String repositoryId, String resource, String
action )
     {
         AuditEvent event = new AuditEvent( repositoryId, user, resource, action );

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java?rev=755486&r1=755485&r2=755486&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/SecuritySynchronization.java
Wed Mar 18 06:15:36 2009
@@ -102,6 +102,11 @@
                     roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
                                                      repoConfig.getId() );
                 }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                     repoConfig.getId() );
+                }
 
                 if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
                                                        repoConfig.getId() ) )
@@ -109,6 +114,11 @@
                     roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
                                                      repoConfig.getId() );
                 }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                     repoConfig.getId() );
+                }
             }
             catch ( RoleManagerException e )
             {



Mime
View raw message