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
This commit is contained in:
Maria Odea B. Ching 2006-09-14 11:27:42 +00:00
parent 18c425ea7c
commit 28baa27be4
3 changed files with 183 additions and 15 deletions

View File

@ -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 )

View File

@ -57,7 +57,7 @@
<ww:iterator id="role" value="assignedRoles">
<tr class="a">
<td>
<em>${role.name}</em><br/>
<em>${role}</em><br/>
</td>
</tr>
</ww:iterator>
@ -82,7 +82,7 @@
<ww:form action="removeRoleFromUser" method="post">
<ww:hidden name="principal" value="${username}"/>
<ww:hidden name="username" value="${username}"/>
<ww:radio name="roleName" list="assignedRoles" listKey="name" listValue="name" labelposition="left"/>
<ww:radio name="roleName" list="assignedRoles" labelposition="left"/>
<ww:submit value="Remove"/>
</ww:form>
</pss:ifAuthorized>
@ -96,4 +96,4 @@
</body>
</html>
</html>

View File

@ -88,6 +88,180 @@
</component>
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>
<configuration>
<!-- HSQLDB Configuration -->
<!--
NOTE: NO NOT USE THIS CONFIGURATION FOR A PRODUCTION SYSTEM.
HSQLDB keeps all data in memory at all times.
NOTE: JPOX 1.1.1 won't create the tables on start
http://www.jpox.org/servlet/jira/browse/CORE-2946
-->
<!--
<driverName>org.hsqldb.jdbcDriver</driverName>
<url>jdbc:hsqldb:mem:test</url>
<userName>sa</userName>
<password></password>
-->
<!-- Apache Derby Configuration -->
<driverName>org.apache.derby.jdbc.EmbeddedDriver</driverName>
<url>jdbc:derby:${basedir}/target/repoaccess/database;create=true</url>
<userName>sa</userName>
<password></password>
<!-- MySql Configuration -->
<!--
<driverName>com.mysql.jdbc.Driver</driverName>
<url>jdbc:mysql://localhost/archiva</url>
<userName>archiva</userName>
<password>archiva</password>
-->
<!-- Postgresql Configuration -->
<!--
<driverName>org.postgresql.Driver</driverName>
<url>jdbc:postgresql://localhost/continuum</url>
<userName>username</userName>
<password></password>
-->
<!-- JPOX and JDO configuration -->
<persistenceManagerFactoryClass>org.jpox.PersistenceManagerFactoryImpl</persistenceManagerFactoryClass>
<otherProperties>
<property>
<name>javax.jdo.PersistenceManagerFactoryClass</name>
<value>org.jpox.PersistenceManagerFactoryImpl</value>
</property>
<property>
<name>org.jpox.autoCreateSchema</name>
<value>true</value>
</property>
<property>
<name>org.jpox.autoStartMechanism</name>
<value>SchemaTable</value>
</property>
<property>
<name>org.jpox.autoStartMechanismMode</name>
<value>Ignored</value>
</property>
<property>
<name>org.jpox.validateTables</name>
<value>false</value>
</property>
<property>
<name>org.jpox.validateConstraints</name>
<value>false</value>
</property>
<property>
<name>org.jpox.transactionIsolation</name>
<value>READ_UNCOMMITTED</value>
</property>
<property>
<name>org.jpox.poid.transactionIsolation</name>
<value>READ_UNCOMMITTED</value>
</property>
</otherProperties>
</configuration>
</component>
</components>
</plexus>
<!--
~ Copyright 2005-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.
-->
<plexus>
<components>
<!--
| Logger manager
-->
<component>
<role>org.codehaus.plexus.logging.LoggerManager</role>
<implementation>org.codehaus.plexus.logging.log4j.Log4JLoggerManager</implementation>
<lifecycle-handler>basic</lifecycle-handler>
<configuration>
<threshold>DEBUG</threshold>
<default-appender>console</default-appender>
<appenders>
<appender>
<id>console</id>
<threshold>DEBUG</threshold>
<type>org.apache.log4j.ConsoleAppender</type>
<!-- <conversion-pattern>%d [%t] %-5p %-30c{1} - %m%n</conversion-pattern> -->
<conversion-pattern>%r [%t] %-5p %c %x - %m%n</conversion-pattern>
</appender>
</appenders>
<levels>
<!-- Help identify bugs during testing -->
<level>
<hierarchy>org.apache.maven</hierarchy>
<level>DEBUG</level>
</level>
<level>
<hierarchy>org.codehaus.plexus.security</hierarchy>
<level>DEBUG</level>
</level>
<!-- squelch noisy objects (for now) -->
<level>
<hierarchy>org.codehaus.plexus.mailsender.MailSender</hierarchy>
<level>INFO</level>
</level>
<level>
<hierarchy>org.quartz</hierarchy>
<level>INFO</level>
</level>
<level>
<hierarchy>org.apache.jasper</hierarchy>
<level>INFO</level>
</level>
<level>
<hierarchy>com.opensymphony.xwork</hierarchy>
<level>DEBUG</level>
</level>
<level>
<hierarchy>com.opensymphony.webwork</hierarchy>
<level>DEBUG</level>
</level>
<level>
<hierarchy>org.codehaus.plexus.PlexusContainer</hierarchy>
<level>INFO</level>
</level>
<level>
<hierarchy>JPOX</hierarchy>
<level>WARN</level>
</level>
<level>
<hierarchy>freemarker</hierarchy>
<level>WARN</level>
</level>
<level>
<hierarchy>freemarker</hierarchy>
<level>WARN</level>
</level>
</levels>
</configuration>
</component>
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>