diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/DefaultRoleManager.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/DefaultRoleManager.java index 719f852d6..ce00d0906 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/DefaultRoleManager.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/DefaultRoleManager.java @@ -45,7 +45,7 @@ public class DefaultRoleManager private RBACManager manager; private boolean initialized; - + public void initialize() throws InitializationException { @@ -164,13 +164,13 @@ public class DefaultRoleManager manager.savePermission( editAllUsers ); } - if ( !manager.permissionExists( "Generate All Reports" ) ) + if ( !manager.permissionExists( "Generate Reports" ) ) { - Permission editAllUsers = manager.createPermission( "Generate All Reports", "generate-reports", + Permission editAllUsers = manager.createPermission( "Generate Reports", "generate-reports", manager.getGlobalResource().getIdentifier() ); manager.savePermission( editAllUsers ); - } + } if ( !manager.permissionExists( "Grant Roles" ) ) { @@ -214,7 +214,7 @@ public class DefaultRoleManager admin.addPermission( manager.getPermission( "Run Indexer" ) ); admin.addPermission( manager.getPermission( "Add Repository" ) ); admin.addPermission( manager.getPermission( "Access Reports") ); - admin.addPermission( manager.getPermission( "Generate All Reports") ); + admin.addPermission( manager.getPermission( "Generate Reports") ); admin.addPermission( manager.getPermission( "Regenerate Index" ) ); admin.setAssignable( true ); manager.saveRole( admin ); @@ -273,26 +273,16 @@ public class DefaultRoleManager deleteRepo.setResource( repoResource ); deleteRepo = manager.savePermission( deleteRepo ); - Permission getReports = manager.createPermission( "Access Reports - " + repositoryName ); - getReports.setOperation( manager.getOperation( "access-reports" ) ); - getReports.setResource( repoResource ); - getReports = manager.savePermission( getReports ); - - Permission regenReports = manager.createPermission( "generate Reports - " + repositoryName ); - regenReports.setOperation( manager.getOperation( "generate-reports" ) ); - regenReports.setResource( repoResource ); - regenReports = manager.savePermission( regenReports ); - // make the roles Role repositoryObserver = manager.createRole( "Repository Observer - " + repositoryName ); - repositoryObserver.addPermission( getReports ); + repositoryObserver.addPermission( manager.getPermission( "Access Reports" ) ); repositoryObserver.setAssignable( true ); repositoryObserver = manager.saveRole( repositoryObserver ); Role repositoryManager = manager.createRole( "Repository Manager - " + repositoryName ); repositoryManager.addPermission( editRepo ); repositoryManager.addPermission( deleteRepo ); - repositoryManager.addPermission( regenReports ); + repositoryManager.addPermission( manager.getPermission( "Generate Reports" ) ); repositoryManager.addChildRoleName( repositoryObserver.getName() ); repositoryManager.setAssignable( true ); manager.saveRole( repositoryManager ); diff --git a/archiva-webapp/src/main/resources/META-INF/plexus/plexus-security.properties b/archiva-webapp/src/main/resources/META-INF/plexus/plexus-security.properties new file mode 100644 index 000000000..c47486b91 --- /dev/null +++ b/archiva-webapp/src/main/resources/META-INF/plexus/plexus-security.properties @@ -0,0 +1,20 @@ +# +# operations +# +addRepositoryOperation=add-repository +editRepositoryOperation=edit-repository +deleteRepositoryOperation=delete-repository + +editConfiguration=edit-configuration + +runIndexer=run-indexer +regenerateIndex=regenerate-index + +accessReports=access-reports +generateReports=generate-reports + +editAllUsers=edit-all-users +editUser=edit-user + +grantRoles=grant-roles +removeRoles=remove-roles \ No newline at end of file diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp index b7909d252..bc1c0505c 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp @@ -108,10 +108,10 @@ Browse - +
Manage