From 28baa27be4c3a5143f40ec9fd4685049467fe6cf Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Thu, 14 Sep 2006 11:27:42 +0000 Subject: [PATCH] Submitted by Joakim Erdfelt Fix for plexus security error when running archiva webapp. (several outstanding bugs were fixed in plexus-security-authorizer, but those bug fixes impacted archiva-webapp.) git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@443318 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/web/util/DefaultRoleManager.java | 18 +- .../main/webapp/WEB-INF/jsp/admin/user.jsp | 6 +- .../repository/RepositoryAccessTest.xml | 174 ++++++++++++++++++ 3 files changed, 183 insertions(+), 15 deletions(-) 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 bc4134337..7b3236082 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 @@ -70,12 +70,13 @@ public class DefaultRoleManager editUser = manager.savePermission( editUser ); // todo this one role a user will go away when we have expressions in the resources - Role userRole = manager.createRole( "Personal Role - " + principal ); + String personalRoleName = "Personal Role - " + principal; + Role userRole = manager.createRole( personalRoleName ); userRole.addPermission( editUser ); userRole = manager.saveRole( userRole ); UserAssignment assignment = manager.createUserAssignment( principal ); - assignment.addRole( userRole ); + assignment.addRoleName( personalRoleName ); manager.saveUserAssignment( assignment ); } @@ -89,16 +90,9 @@ public class DefaultRoleManager public void addAdminUser( String principal ) throws RbacStoreException { - try - { - UserAssignment assignment = manager.createUserAssignment( principal ); - assignment.addRole( manager.getRole( "System Administrator" ) ); - manager.saveUserAssignment( assignment ); - } - catch ( RbacObjectNotFoundException ne ) - { - throw new RbacStoreException( "unable to find administrator role, this of course is bad", ne ); - } + UserAssignment assignment = manager.createUserAssignment( principal ); + assignment.addRoleName( ArchivaDefaults.SYSTEM_ADMINISTRATOR ); + manager.saveUserAssignment( assignment ); } public void addRepository( String repositoryName ) diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/user.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/user.jsp index 337e7ad99..d2ab3e566 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/user.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/user.jsp @@ -57,7 +57,7 @@ - ${role.name}
+ ${role}
@@ -82,7 +82,7 @@ - + @@ -96,4 +96,4 @@ - \ No newline at end of file + diff --git a/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/servlet/repository/RepositoryAccessTest.xml b/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/servlet/repository/RepositoryAccessTest.xml index d6a4b48b6..7dba3665d 100644 --- a/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/servlet/repository/RepositoryAccessTest.xml +++ b/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/servlet/repository/RepositoryAccessTest.xml @@ -88,6 +88,180 @@ + + org.codehaus.plexus.jdo.JdoFactory + org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory + + + + + + + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${basedir}/target/repoaccess/database;create=true + sa + + + + + + + + + + org.jpox.PersistenceManagerFactoryImpl + + + javax.jdo.PersistenceManagerFactoryClass + org.jpox.PersistenceManagerFactoryImpl + + + org.jpox.autoCreateSchema + true + + + org.jpox.autoStartMechanism + SchemaTable + + + org.jpox.autoStartMechanismMode + Ignored + + + org.jpox.validateTables + false + + + org.jpox.validateConstraints + false + + + org.jpox.transactionIsolation + READ_UNCOMMITTED + + + org.jpox.poid.transactionIsolation + READ_UNCOMMITTED + + + + + + + + + + + + + + org.codehaus.plexus.logging.LoggerManager + org.codehaus.plexus.logging.log4j.Log4JLoggerManager + basic + + + DEBUG + console + + + console + DEBUG + org.apache.log4j.ConsoleAppender + + %r [%t] %-5p %c %x - %m%n + + + + + + org.apache.maven + DEBUG + + + org.codehaus.plexus.security + DEBUG + + + + org.codehaus.plexus.mailsender.MailSender + INFO + + + org.quartz + INFO + + + org.apache.jasper + INFO + + + com.opensymphony.xwork + DEBUG + + + com.opensymphony.webwork + DEBUG + + + org.codehaus.plexus.PlexusContainer + INFO + + + JPOX + WARN + + + freemarker + WARN + + + freemarker + WARN + + + + + + org.codehaus.plexus.jdo.JdoFactory org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory