You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2012/04/06 11:59:32 UTC

svn commit: r1310268 [8/42] - in /archiva/redback/redback-core/trunk: ./ redback-authentication/ redback-authentication/redback-authentication-api/ redback-authentication/redback-authentication-api/src/ redback-authentication/redback-authentication-api...

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,129 @@
+package org.codehaus.redback.integration.interceptor;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.plexus.redback.rbac.Resource;
+
+/**
+ * SecureActionBundle:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ */
+public class SecureActionBundle
+{
+    private boolean requiresAuthentication = false;
+
+    private List<AuthorizationTuple> authorizationTuples = new ArrayList<AuthorizationTuple>();
+
+    public static final SecureActionBundle OPEN;
+
+    public static final SecureActionBundle AUTHONLY;
+
+    static
+    {
+        OPEN = new SecureActionBundle();
+        AUTHONLY = new SecureActionBundle();
+        AUTHONLY.setRequiresAuthentication( true );
+    }
+
+    /**
+     * Add an authorization tuple
+     *
+     * @param operation
+     * @param resource
+     * @throws SecureActionException
+     */
+    public void addRequiredAuthorization( String operation, String resource )
+        throws SecureActionException
+    {
+        if ( operation != null && resource != null )
+        {
+            authorizationTuples.add( new AuthorizationTuple( operation, resource ) );
+        }
+        else
+        {
+            throw new SecureActionException( "operation and resource are required to be non-null" );
+        }
+    }
+
+    /**
+     * add an authorization tuple, assuming the resource part of it is Resource.GLOBAL
+     *
+     * @param operation
+     * @throws SecureActionException
+     */
+    public void addRequiredAuthorization( String operation )
+        throws SecureActionException
+    {
+        if ( operation != null )
+        {
+            authorizationTuples.add( new AuthorizationTuple( operation, Resource.GLOBAL ) );
+        }
+        else
+        {
+            throw new SecureActionException( "operation is required to be non-null" );
+        }
+    }
+
+    public List<AuthorizationTuple> getAuthorizationTuples()
+    {
+        return authorizationTuples;
+    }
+
+    public boolean requiresAuthentication()
+    {
+        return requiresAuthentication;
+    }
+
+    public void setRequiresAuthentication( boolean requiresAuthentication )
+    {
+        this.requiresAuthentication = requiresAuthentication;
+    }
+
+    public static class AuthorizationTuple
+    {
+        private String operation;
+
+        private String resource;
+
+        public AuthorizationTuple( String operation, String resource )
+        {
+            this.operation = operation;
+            this.resource = resource;
+        }
+
+        public String getOperation()
+        {
+            return operation;
+        }
+
+        public String getResource()
+        {
+            return resource;
+        }
+
+
+        public String toString()
+        {
+            return "AuthorizationTuple[" + operation + "," + resource + "]";
+        }
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionBundle.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,37 @@
+package org.codehaus.redback.integration.interceptor;
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+/**
+ * SecureActionException:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ */
+public class SecureActionException
+    extends Exception
+{
+
+    public SecureActionException( String string )
+    {
+        super( string );
+    }
+
+    public SecureActionException( String string, Throwable throwable )
+    {
+        super( string, throwable );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/interceptor/SecureActionException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,32 @@
+package org.codehaus.redback.integration.mail;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.keys.AuthenticationKey;
+
+/**
+ * Mail generator component.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+public interface MailGenerator
+{
+    String ROLE = MailGenerator.class.getName();
+
+    String generateMail( String templateName, AuthenticationKey authkey, String baseUrl );
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,34 @@
+package org.codehaus.redback.integration.mail;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.keys.AuthenticationKey;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public interface Mailer
+{
+    void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
+
+    void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl );
+
+    void sendMessage( Collection<String> recipients, String subject, String content );
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/Mailer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,147 @@
+package org.codehaus.redback.integration.mail;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import org.codehaus.plexus.redback.configuration.UserConfiguration;
+import org.codehaus.plexus.redback.keys.AuthenticationKey;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.policy.UserValidationSettings;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.util.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.stereotype.Service;
+
+/**
+ * Mailer
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service("mailer")
+public class MailerImpl
+    implements Mailer
+{
+    protected Logger log = LoggerFactory.getLogger( getClass() );
+    
+    @Inject  @Named(value="mailGenerator#velocity")
+    private MailGenerator generator;
+
+    @Inject  @Named(value="mailSender")
+    private JavaMailSender javaMailSender;
+
+    @Inject
+    private SecuritySystem securitySystem;
+
+    @Inject  @Named(value="userConfiguration")
+    private UserConfiguration config;
+
+    public void sendAccountValidationEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
+    {
+        String content = generator.generateMail( "newAccountValidationEmail", authkey, baseUrl );
+
+        UserSecurityPolicy policy = securitySystem.getPolicy();
+        UserValidationSettings validation = policy.getUserValidationSettings();
+        sendMessage( recipients, validation.getEmailSubject(), content );
+    }
+
+    public void sendPasswordResetEmail( Collection<String> recipients, AuthenticationKey authkey, String baseUrl )
+    {
+        String content = generator.generateMail( "passwordResetEmail", authkey, baseUrl );
+
+        UserSecurityPolicy policy = securitySystem.getPolicy();
+        UserValidationSettings validation = policy.getUserValidationSettings();
+        sendMessage( recipients, validation.getEmailSubject(), content );
+    }
+
+    public void sendMessage( Collection<String> recipients, String subject, String content )
+    {
+        if ( recipients.isEmpty() )
+        {
+            log.warn( "Mail Not Sent - No mail recipients for email. subject [" + subject + "]" );
+            return;
+        }
+
+        String fromAddress = config.getString( "email.from.address" );
+        String fromName = config.getString( "email.from.name" );
+
+        if ( StringUtils.isEmpty( fromAddress ) )
+        {
+            fromAddress = System.getProperty( "user.name" ) + "@localhost";
+        }
+
+        
+
+        // TODO: Allow for configurable message headers.
+
+        try
+        {
+            
+            MimeMessage message = javaMailSender.createMimeMessage();
+            
+            message.setSubject( subject );
+            message.setText( content );
+
+            InternetAddress from = new InternetAddress( fromAddress, fromName );
+
+            message.setFrom( from );
+
+            List<Address> tos = new ArrayList<Address>();
+            
+            for ( String mailbox : recipients )
+            {
+                InternetAddress to = new InternetAddress( mailbox.trim() );
+
+                tos.add( to );                
+            }
+
+            message.setRecipients(Message.RecipientType.TO, tos.toArray(new Address[tos.size()]));
+
+            log.debug("mail content {}", content );
+
+            javaMailSender.send( message );
+        }
+        catch ( AddressException e )
+        {
+            log.error( "Unable to send message, subject [" + subject + "]", e );
+        }
+        catch ( MessagingException e )
+        {
+            log.error( "Unable to send message, subject [" + subject + "]", e );
+        }       
+        catch ( UnsupportedEncodingException e )
+        {
+            log.error( "Unable to send message, subject [" + subject + "]", e );
+        }                
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/MailerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,149 @@
+package org.codehaus.redback.integration.mail;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
+import org.codehaus.plexus.redback.configuration.UserConfiguration;
+import org.codehaus.plexus.redback.keys.AuthenticationKey;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.StringWriter;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
+/**
+ * Mail generator component implementation using velocity.
+ *
+ * @author <a href="mailto:brett@apache.org">Brett Porter</a>
+ * @version $Id$
+ */
+@Service( "mailGenerator#velocity" )
+public class VelocityMailGenerator
+    implements MailGenerator
+{
+    private Logger log = LoggerFactory.getLogger( VelocityMailGenerator.class );
+
+    @Inject
+    @Named( value = "userConfiguration" )
+    private UserConfiguration config;
+
+    // FIXME use the spring directly 
+    @Inject
+    @Named( value = "velocityEngine#redback" )
+    private VelocityEngine velocityEngine;
+
+    public String generateMail( String templateName, AuthenticationKey authkey, String baseUrl )
+    {
+        VelocityContext context = createVelocityContext( authkey, baseUrl );
+
+        String packageName = getClass().getPackage().getName().replace( '.', '/' );
+        String templateFile = packageName + "/template/" + templateName + ".vm";
+
+        StringWriter writer = new StringWriter();
+
+        try
+        {
+            velocityEngine.mergeTemplate( templateFile, context, writer );
+        }
+        catch ( ResourceNotFoundException e )
+        {
+            log.error( "No such template: '{}'.", templateFile );
+        }
+        catch ( ParseErrorException e )
+        {
+            log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+        }
+        catch ( MethodInvocationException e )
+        {
+            log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+        }
+        catch ( Exception e )
+        {
+            log.error( "Unable to generate email for template '" + templateFile + "': " + e.getMessage(), e );
+        }
+
+        return writer.getBuffer().toString();
+    }
+
+    private VelocityContext createVelocityContext( AuthenticationKey authkey, String appUrl )
+    {
+        VelocityContext context = new VelocityContext();
+
+        context.put( "applicationUrl", config.getString( "application.url", appUrl ) );
+
+        String feedback = config.getString( "email.feedback.path" );
+
+        if ( feedback != null )
+        {
+            if ( feedback.startsWith( "/" ) )
+            {
+                feedback = appUrl + feedback;
+            }
+
+            context.put( "feedback", feedback );
+        }
+
+        context.put( "urlPath", config.getString( "email.url.path", "security/login!login.action" ) );
+
+        context.put( "authkey", authkey.getKey() );
+
+        context.put( "accountId", authkey.getForPrincipal() );
+
+        SimpleDateFormat dateformatter = new SimpleDateFormat( config.getString( "application.timestamp" ), Locale.US );
+
+        context.put( "requestedOn", dateformatter.format( authkey.getDateCreated() ) );
+
+        if ( authkey.getDateExpires() != null )
+        {
+            context.put( "expiresOn", dateformatter.format( authkey.getDateExpires() ) );
+        }
+        else
+        {
+            context.put( "expiresOn", "(does not expire)" );
+        }
+        return context;
+    }
+
+
+    public UserConfiguration getConfig()
+    {
+        return config;
+    }
+
+    public void setConfig( UserConfiguration config )
+    {
+        this.config = config;
+    }
+
+    public VelocityEngine getVelocityEngine()
+    {
+        return velocityEngine;
+    }
+
+    public void setVelocityEngine( VelocityEngine velocityEngine )
+    {
+        this.velocityEngine = velocityEngine;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/mail/VelocityMailGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,65 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.users.User;
+
+/**
+ * AdminEditUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class AdminEditUserCredentials
+    extends EditUserCredentials
+{
+    private boolean locked;
+
+    private boolean passwordChangeRequired;
+
+    public AdminEditUserCredentials()
+    {
+        super();
+    }
+
+    public AdminEditUserCredentials( User user )
+    {
+        super( user );
+        this.locked = user.isLocked();
+        this.passwordChangeRequired = user.isPasswordChangeRequired();
+    }
+
+    public boolean isLocked()
+    {
+        return locked;
+    }
+
+    public void setLocked( boolean locked )
+    {
+        this.locked = locked;
+    }
+
+    public boolean isPasswordChangeRequired()
+    {
+        return passwordChangeRequired;
+    }
+
+    public void setPasswordChangeRequired( boolean passwordChangeRequired )
+    {
+        this.passwordChangeRequired = passwordChangeRequired;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/AdminEditUserCredentials.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,32 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+/**
+ * CreateRoleDetails
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CreateRoleDetails
+    extends RoleDetails
+{
+    public CreateRoleDetails()
+    {
+        super();
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateRoleDetails.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,37 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+/**
+ * CreateUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class CreateUserCredentials
+    extends UserCredentials
+{
+    public CreateUserCredentials()
+    {
+        super();
+    }
+
+    public boolean isEdit()
+    {
+        return false;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/CreateUserCredentials.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,57 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.rbac.Permission;
+import org.codehaus.plexus.redback.rbac.Role;
+
+/**
+ * EditRoleDetails - Existing user Role Details.
+ * <p/>
+ * This is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class EditRoleDetails
+    extends RoleDetails
+{
+    public EditRoleDetails( Role role )
+    {
+        super.setName( role.getName() );
+        super.setDescription( role.getDescription() );
+        
+        for ( String r : role.getChildRoleNames() )
+        {
+            super.addChildRoleName( r );
+        }
+
+        for ( Permission perm : role.getPermissions() )
+        {
+            super.addPermission( perm.getName(), perm.getOperation().getName(), perm.getResource().getIdentifier() );
+        }
+    }
+
+    public void setName( String name )
+    {
+        // Prevent Change (This is an edit after all)
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditRoleDetails.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,60 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.redback.integration.util.DateUtils;
+
+/**
+ * EditUserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class EditUserCredentials
+    extends UserCredentials
+{
+    public EditUserCredentials()
+    {
+        super();
+    }
+
+    public EditUserCredentials( String username )
+    {
+        super();
+        super.setUsername( username );
+    }
+
+    public EditUserCredentials( User user )
+    {
+        super();
+        super.setUsername( user.getUsername() );
+        super.setFullName( user.getFullName() );
+        super.setEmail( user.getEmail() );
+        super.setPassword( "" );
+        super.setConfirmPassword( "" );
+
+        super.setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
+        super.setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
+        super.setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
+    }
+
+    public boolean isEdit()
+    {
+        return true;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/EditUserCredentials.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,108 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * RoleDetails - this is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class RoleDetails
+{
+    private String name;
+
+    private String description;
+
+    private boolean assignable;
+
+    private List<String> childRoleNames = new ArrayList<String>();
+
+    private List<SimplePermission> permissions = new ArrayList<SimplePermission>();
+
+    public void addChildRoleName( String name )
+    {
+        childRoleNames.add( name );
+    }
+
+    public void addPermission( String permissionName, String operationName, String resourceIdentifier )
+    {
+        SimplePermission permission = new SimplePermission();
+        permission.setName( permissionName );
+        permission.setOperationName( operationName );
+        permission.setResourceIdentifier( resourceIdentifier );
+
+        permissions.add( permission );
+    }
+
+    public List<String> getChildRoleNames()
+    {
+        return childRoleNames;
+    }
+
+    public boolean isAssignable()
+    {
+        return assignable;
+    }
+
+    public void setAssignable( boolean assignable )
+    {
+        this.assignable = assignable;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public List<SimplePermission> getPermissions()
+    {
+        return permissions;
+    }
+
+    public void setPermissions( List<SimplePermission> permissions )
+    {
+        this.permissions = permissions;
+    }
+
+    public void setChildRoleNames( List<String> childRoleNames )
+    {
+        this.childRoleNames = childRoleNames;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/RoleDetails.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,66 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+/**
+ * SimplePermission - this is a placeholder for information passed back
+ * and forth between the Action and the Client.
+ * <p/>
+ * We intentionally do not hook up the actual object to prevent
+ * creative injection of fields and values by the untrusted client.
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class SimplePermission
+{
+    private String name;
+
+    private String operationName;
+
+    private String resourceIdentifier;
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getOperationName()
+    {
+        return operationName;
+    }
+
+    public void setOperationName( String operationName )
+    {
+        this.operationName = operationName;
+    }
+
+    public String getResourceIdentifier()
+    {
+        return resourceIdentifier;
+    }
+
+    public void setResourceIdentifier( String resourceIdentifier )
+    {
+        this.resourceIdentifier = resourceIdentifier;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/SimplePermission.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,173 @@
+package org.codehaus.redback.integration.model;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.io.Serializable;
+
+/**
+ * UserCredentials
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public abstract class UserCredentials
+    implements Serializable
+{
+    // Potentially Editable Field.
+    private String username;
+
+    // Editable Fields.
+    private String password;
+
+    private String confirmPassword;
+
+    private String fullName;
+
+    private String email;
+
+    // Display Only Fields.
+    private String timestampAccountCreation;
+
+    private String timestampLastLogin;
+
+    private String timestampLastPasswordChange;
+
+    public User createUser( UserManager um )
+    {
+        User user = um.createUser( username, fullName, email );
+
+        user.setPassword( password );
+
+        return user;
+    }
+
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "UserCredentials[" );
+        sb.append( "username=" ).append( username );
+        sb.append( ",fullName=" ).append( fullName );
+        sb.append( ",email=" ).append( email );
+        sb.append( ",password=" );
+        if ( StringUtils.isNotEmpty( password ) )
+        {
+            sb.append( "<***>" );
+        }
+        else
+        {
+            sb.append( "<empty>" );
+        }
+        sb.append( ",confirmPassword=" );
+        if ( StringUtils.isNotEmpty( confirmPassword ) )
+        {
+            sb.append( "<***>" );
+        }
+        else
+        {
+            sb.append( "<empty>" );
+        }
+
+        return sb.append( "]" ).toString();
+    }
+
+    public String getConfirmPassword()
+    {
+        return confirmPassword;
+    }
+
+    public void setConfirmPassword( String confirmPassword )
+    {
+        this.confirmPassword = confirmPassword;
+    }
+
+    public String getEmail()
+    {
+        return email;
+    }
+
+    public void setEmail( String email )
+    {
+        this.email = email;
+    }
+
+    public String getFullName()
+    {
+        return fullName;
+    }
+
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword( String password )
+    {
+        this.password = password;
+    }
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+
+    public abstract boolean isEdit();
+
+    public String getTimestampAccountCreation()
+    {
+        return timestampAccountCreation;
+    }
+
+    public String getTimestampLastLogin()
+    {
+        return timestampLastLogin;
+    }
+
+    public String getTimestampLastPasswordChange()
+    {
+        return timestampLastPasswordChange;
+    }
+
+    public void setTimestampAccountCreation( String timestampAccountCreation )
+    {
+        this.timestampAccountCreation = timestampAccountCreation;
+    }
+
+    public void setTimestampLastLogin( String timestampLastLogin )
+    {
+        this.timestampLastLogin = timestampLastLogin;
+    }
+
+    public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
+    {
+        this.timestampLastPasswordChange = timestampLastPasswordChange;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/model/UserCredentials.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,156 @@
+package org.codehaus.redback.integration.reports;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.RbacManagerException;
+import org.codehaus.plexus.redback.rbac.Role;
+import org.codehaus.plexus.redback.rbac.UserAssignment;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.redback.integration.util.RoleSorter;
+import org.codehaus.redback.integration.util.UserComparator;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CsvRolesMatrix
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "report#rolesmatrix-csv" )
+public class CsvRolesMatrix
+    implements Report
+{
+    @Inject
+    private SecuritySystem securitySystem;
+
+    @Inject
+    @Named( value = "rBACManager#jdo" )
+    private RBACManager rbacManager;
+
+    public String getName()
+    {
+        return "Roles Matrix";
+    }
+
+    public String getType()
+    {
+        return "csv";
+    }
+
+    public void writeReport( OutputStream os )
+        throws ReportException
+    {
+        UserManager userManager = securitySystem.getUserManager();
+
+        List<User> allUsers = userManager.getUsers();
+        List<Role> allRoles;
+        Map<String, List<String>> assignmentsMap;
+
+        try
+        {
+            allRoles = rbacManager.getAllRoles();
+            Collections.sort( allRoles, new RoleSorter() );
+
+            assignmentsMap = new HashMap<String, List<String>>();
+
+            for ( UserAssignment assignment : rbacManager.getAllUserAssignments() )
+            {
+                assignmentsMap.put( assignment.getPrincipal(), assignment.getRoleNames() );
+            }
+        }
+        catch ( RbacManagerException e )
+        {
+            throw new ReportException( "Unable to obtain list of all roles.", e );
+        }
+
+        Collections.sort( allUsers, new UserComparator( "username", true ) );
+
+        PrintWriter out = new PrintWriter( os );
+
+        writeCsvHeader( out, allRoles );
+
+        for ( User user : allUsers )
+        {
+            writeCsvRow( out, user, assignmentsMap, allRoles );
+        }
+
+        out.flush();
+    }
+
+    private void writeCsvHeader( PrintWriter out, List<Role> allRoles )
+    {
+        out.print( "Username,Full Name,Email Address" );
+        for ( Role role : allRoles )
+        {
+            out.print( "," + escapeCell( role.getName() ) );
+        }
+        out.println();
+    }
+
+    private void writeCsvRow( PrintWriter out, User user, Map<String, List<String>> assignmentsMap,
+                              List<Role> allRoles )
+    {
+        out.print( escapeCell( user.getUsername() ) );
+        out.print( "," + escapeCell( user.getFullName() ) );
+        out.print( "," + escapeCell( user.getEmail() ) );
+
+        List<String> assignedRoleNames = assignmentsMap.get( user.getPrincipal().toString() );
+        if ( assignedRoleNames == null )
+        {
+            assignedRoleNames = new ArrayList<String>();
+        }
+
+        for ( Role role : allRoles )
+        {
+            out.print( ',' );
+            if ( assignedRoleNames.contains( role.getName() ) )
+            {
+                out.print( 'Y' );
+            }
+        }
+        out.println();
+    }
+
+    private String escapeCell( String cell )
+    {
+        return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
+    }
+
+    public String getId()
+    {
+        return "rolesmatrix";
+    }
+
+    public String getMimeType()
+    {
+        return "text/csv";
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvRolesMatrix.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,179 @@
+package org.codehaus.redback.integration.reports;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.redback.integration.util.UserComparator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * CsvUserList
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "report#userlist-csv" )
+public class CsvUserList
+    implements Report
+{
+    private Logger log = LoggerFactory.getLogger( CsvUserList.class );
+
+    @Inject
+    private SecuritySystem securitySystem;
+
+    private Map<String, String> fields;
+
+    public CsvUserList()
+    {
+        fields = new HashMap<String, String>();
+        fields.put( "username", "User Name" );
+        fields.put( "fullName", "Full Name" );
+        fields.put( "email", "Email Address" );
+        fields.put( "permanent", "Permanent User" );
+        fields.put( "locked", "Locked User" );
+        fields.put( "validated", "Validated User" );
+        fields.put( "passwordChangeRequired", "Must Change Password On Next Login" );
+        fields.put( "countFailedLoginAttempts", "Failed Login Attempts" );
+        fields.put( "lastPasswordChange", "Last Password Change" );
+        fields.put( "accountCreationDate", "Date Created" );
+        fields.put( "lastLoginDate", "Date Last Logged In" );
+    }
+
+    public String getId()
+    {
+        return "userlist";
+    }
+
+    public String getMimeType()
+    {
+        return "text/csv";
+    }
+
+    public String getName()
+    {
+        return "User List";
+    }
+
+    public String getType()
+    {
+        return "csv";
+    }
+
+    public void writeReport( OutputStream os )
+        throws ReportException
+    {
+        UserManager userManager = securitySystem.getUserManager();
+
+        List<User> allUsers = userManager.getUsers();
+
+        Collections.sort( allUsers, new UserComparator( "username", true ) );
+
+        PrintWriter out = new PrintWriter( os );
+
+        writeCsvHeader( out );
+
+        Iterator<User> itUsers = allUsers.iterator();
+        while ( itUsers.hasNext() )
+        {
+            User user = (User) itUsers.next();
+            writeCsvRow( out, user );
+        }
+
+        out.flush();
+    }
+
+    private void writeCsvHeader( PrintWriter out )
+    {
+        boolean hasPreviousField = false;
+        for ( String heading : fields.values() )
+        {
+            if ( hasPreviousField )
+            {
+                out.print( "," );
+            }
+            out.print( escapeCell( heading ) );
+            hasPreviousField = true;
+        }
+        out.println();
+    }
+
+    @SuppressWarnings( "unchecked" )
+    private void writeCsvRow( PrintWriter out, User user )
+        throws ReportException
+    {
+        try
+        {
+            boolean hasPreviousField = false;
+            Map<String, Object> propMap = PropertyUtils.describe( user );
+            for ( String propName : fields.keySet() )
+            {
+                Object propValue = propMap.get( propName );
+
+                if ( hasPreviousField )
+                {
+                    out.print( "," );
+                }
+
+                if ( propValue != null )
+                {
+                    out.print( escapeCell( propValue.toString() ) );
+                }
+                hasPreviousField = true;
+            }
+            out.println();
+        }
+        catch ( IllegalAccessException e )
+        {
+            String emsg = "Unable to produce " + getName() + " report.";
+            log.error( emsg, e );
+            throw new ReportException( emsg, e );
+        }
+        catch ( InvocationTargetException e )
+        {
+            String emsg = "Unable to produce " + getName() + " report.";
+            log.error( emsg, e );
+            throw new ReportException( emsg, e );
+        }
+        catch ( NoSuchMethodException e )
+        {
+            String emsg = "Unable to produce " + getName() + " report.";
+            log.error( emsg, e );
+            throw new ReportException( emsg, e );
+        }
+    }
+
+    private String escapeCell( String cell )
+    {
+        return "\"" + StringEscapeUtils.escapeJava( cell ) + "\"";
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/CsvUserList.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,66 @@
+package org.codehaus.redback.integration.reports;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import java.io.OutputStream;
+
+/**
+ * Report
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface Report
+{
+    /**
+     * The Name of the Report (for display to the user)
+     *
+     * @return the name of the report.
+     */
+    String getName();
+
+    /**
+     * The type of report (example: 'csv', 'xls', 'pdf')
+     * Used in the display of the report links to the user.
+     *
+     * @return the type of report.
+     */
+    String getType();
+
+    /**
+     * The mimetype of the report. (used to set download content type correctly)
+     *
+     * @return the mimetype.
+     */
+    String getMimeType();
+
+    /**
+     * The ID for this report.
+     *
+     * @return the ID for this report.
+     */
+    String getId();
+
+    /**
+     * Write Report to provided outputstream.
+     *
+     * @param os the outputstream to write to.
+     * @throws ReportException if there was a problem in generating the report.
+     */
+    void writeReport( OutputStream os )
+        throws ReportException;
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/Report.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,48 @@
+package org.codehaus.redback.integration.reports;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+/**
+ * ReportException
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class ReportException
+    extends Exception
+{
+
+    public ReportException()
+    {
+        super();
+    }
+
+    public ReportException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public ReportException( String message )
+    {
+        super( message );
+    }
+
+    public ReportException( Throwable cause )
+    {
+        super( cause );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,101 @@
+package org.codehaus.redback.integration.reports;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ReportManager
+ *
+ * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+@Service( "reportManager" )
+public class ReportManager
+{
+
+    @Inject
+    private List<Report> availableReports;
+
+    @Inject
+    private ApplicationContext applicationContext;
+
+    private Map<String, Map<String, Report>> reportMap;
+
+    public Report findReport( String id, String type )
+        throws ReportException
+    {
+        if ( StringUtils.isBlank( id ) )
+        {
+            throw new ReportException( "Unable to generate report from empty report id." );
+        }
+
+        if ( StringUtils.isBlank( type ) )
+        {
+            throw new ReportException( "Unable to generate report from empty report type." );
+        }
+
+        Map<String, Report> typeMap = reportMap.get( id );
+        if ( typeMap == null )
+        {
+            throw new ReportException( "Unable to find report id [" + id + "]" );
+        }
+
+        Report requestedReport = typeMap.get( type );
+
+        if ( requestedReport == null )
+        {
+            throw new ReportException( "Unable to find report id [" + id + "] type [" + type + "]" );
+        }
+
+        return requestedReport;
+    }
+
+    public Map<String, Map<String, Report>> getReportMap()
+    {
+        return Collections.unmodifiableMap( reportMap );
+    }
+
+    @SuppressWarnings( "unchecked" )
+    @PostConstruct
+    public void initialize()
+    {
+        reportMap = new HashMap<String, Map<String, Report>>();
+
+        for ( Report report : availableReports )
+        {
+            Map<String, Report> typeMap = reportMap.get( report.getId() );
+            if ( typeMap == null )
+            {
+                typeMap = new HashMap<String, Report>();
+            }
+
+            typeMap.put( report.getType(), report );
+            reportMap.put( report.getId(), typeMap );
+        }
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/reports/ReportManager.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,75 @@
+package org.codehaus.redback.integration.role;
+
+/*
+ * Copyright 2005-2006 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.redback.integration.security.role.RedbackRoleConstants;
+
+/**
+ * RoleConstants:
+ *
+ * @author: Jesse McConnell <je...@codehaus.org>
+ * @version: $Id$
+ * @deprecated use {@link RedbackRoleConstants}
+ */
+public class RoleConstants
+{
+    public static final String ADMINISTRATOR_ACCOUNT_NAME = RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME;
+
+    // roles
+    public static final String SYSTEM_ADMINISTRATOR_ROLE = RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE;
+
+    public static final String USER_ADMINISTRATOR_ROLE = RedbackRoleConstants.USER_ADMINISTRATOR_ROLE;
+
+    public static final String REGISTERED_USER_ROLE = RedbackRoleConstants.REGISTERED_USER_ROLE;
+
+    public static final String GUEST_ROLE = RedbackRoleConstants.GUEST_ROLE;
+
+    // guest access operation
+    public static final String GUEST_ACCESS_OPERATION = RedbackRoleConstants.GUEST_ACCESS_OPERATION;
+
+    // operations against configuration
+    public static final String CONFIGURATION_EDIT_OPERATION = RedbackRoleConstants.CONFIGURATION_EDIT_OPERATION;
+
+    // operations against user
+    public static final String USER_MANAGEMENT_USER_CREATE_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION;
+
+    public static final String USER_MANAGEMENT_USER_EDIT_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION;
+
+    public static final String USER_MANAGEMENT_USER_ROLE_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_USER_ROLE_OPERATION;
+
+    public static final String USER_MANAGEMENT_USER_DELETE_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION;
+
+    public static final String USER_MANAGEMENT_USER_LIST_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION;
+
+    // operations against user assignment.
+    public static final String USER_MANAGEMENT_ROLE_GRANT_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_ROLE_GRANT_OPERATION;
+
+    public static final String USER_MANAGEMENT_ROLE_DROP_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_ROLE_DROP_OPERATION;
+
+    // operations against rbac objects.
+    public static final String USER_MANAGEMENT_RBAC_ADMIN_OPERATION =
+        RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION;
+
+    public static final String USER_MANAGEMENT_MANAGE_DATA = RedbackRoleConstants.USER_MANAGEMENT_MANAGE_DATA;
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/role/RoleConstants.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,38 @@
+package org.codehaus.redback.integration.taglib.jsp;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+
+/**
+ * IfAuthorizedTag:
+ *
+ * @author Jesse McConnell <je...@codehaus.org>
+ * @version $Id$
+ */
+public class ElseAuthorizedTag
+    extends ConditionalTagSupport
+{
+    protected boolean condition()
+        throws JspTagException
+    {
+        Boolean authzStatus = (Boolean) pageContext.getAttribute( "ifAuthorizedTag" );
+
+        if ( authzStatus != null )
+        {
+            pageContext.removeAttribute( "ifAuthorizedTag" );
+
+            return !authzStatus.booleanValue();
+        }
+
+        authzStatus = (Boolean) pageContext.getAttribute( "ifAnyAuthorizedTag" );
+
+        if ( authzStatus != null )
+        {
+            pageContext.removeAttribute( "ifAnyAuthorizedTag" );
+
+            return !authzStatus.booleanValue();
+        }
+
+        throw new JspTagException( "ElseAuthorizedTag should follow either IfAuthorized or IfAnyAuthorized" );
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/ElseAuthorizedTag.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java
URL: http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java?rev=1310268&view=auto
==============================================================================
--- archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java (added)
+++ archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java Fri Apr  6 09:58:14 2012
@@ -0,0 +1,92 @@
+package org.codehaus.redback.integration.taglib.jsp;
+
+/*
+ * Copyright 2005 The Codehaus.
+ *
+ * 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.
+ */
+
+import org.codehaus.plexus.redback.authorization.AuthorizationException;
+import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.system.SecuritySystemConstants;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.jsp.JspTagException;
+import javax.servlet.jsp.jstl.core.ConditionalTagSupport;
+import java.util.StringTokenizer;
+
+/**
+ * IfAnyAuthorizedTag:
+ *
+ * @author Jesse McConnell <je...@codehaus.org>
+ * @version $Id$
+ */
+public class IfAnyAuthorizedTag
+    extends ConditionalTagSupport
+{
+    /**
+     * comma delimited list of permissions to check
+     */
+    private String permissions;
+
+    private String resource;
+
+    public void setPermissions( String permissions )
+    {
+        this.permissions = permissions;
+    }
+
+    public void setResource( String resource )
+    {
+        this.resource = resource;
+    }
+
+    protected boolean condition()
+        throws JspTagException
+    {
+        ApplicationContext applicationContext =
+            WebApplicationContextUtils.getRequiredWebApplicationContext( pageContext.getServletContext() );
+
+        SecuritySession securitySession =
+            (SecuritySession) pageContext.getSession().getAttribute( SecuritySystemConstants.SECURITY_SESSION_KEY );
+
+        try
+        {
+            final SecuritySystem securitySystem = applicationContext.getBean( "securitySystem", SecuritySystem.class );
+            if ( securitySystem == null )
+            {
+                throw new JspTagException( "unable to locate the security system" );
+            }
+
+            StringTokenizer strtok = new StringTokenizer( permissions, "," );
+
+            while ( strtok.hasMoreTokens() )
+            {
+                String permission = strtok.nextToken().trim();
+
+                if ( securitySystem.isAuthorized( securitySession, permission, resource ) )
+                {
+                    return true;
+                }
+            }
+        }
+        catch ( AuthorizationException ae )
+        {
+            throw new JspTagException( "error with authorization", ae );
+        }
+
+        return false;
+    }
+}

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: archiva/redback/redback-core/trunk/redback-integrations/redback-common-integrations/src/main/java/org/codehaus/redback/integration/taglib/jsp/IfAnyAuthorizedTag.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision