]> source.dussan.org Git - archiva.git/commitdiff
package move to o.a.a.r module redback-rest-api
authorOlivier Lamy <olamy@apache.org>
Sun, 8 Apr 2012 20:27:54 +0000 (20:27 +0000)
committerOlivier Lamy <olamy@apache.org>
Sun, 8 Apr 2012 20:27:54 +0000 (20:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1311083 13f79535-47bb-0310-9956-ffa450edef68

49 files changed:
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Application.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ApplicationRoles.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Operation.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Permission.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RedbackRestError.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RegistrationKey.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Resource.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Role.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RoleTemplate.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/User.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/LoginService.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/PasswordService.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RedbackServiceException.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RoleManagementService.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UserService.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UtilServices.java [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RoleManagementService.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UserService.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UtilServices.java [deleted file]
redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/apache/archiva/redback/rest/api/RedbackRestModel.gwt.xml [new file with mode: 0644]
redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/codehaus/redback/rest/api/RedbackRestModel.gwt.xml [deleted file]
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/DefaultLoginService.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/DefaultPasswordService.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/DefaultRoleManagementService.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/DefaultUserService.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/DefaultUtilServices.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/interceptors/PasswordRuleViolationExceptionMapper.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/interceptors/RedbackServiceExceptionMapper.java
redback-integrations/redback-rest/redback-rest-services/src/main/java/org/codehaus/redback/rest/services/utils/PasswordValidator.java
redback-integrations/redback-rest/redback-rest-services/src/test/java/org/codehaus/redback/rest/services/AbstractRestServicesTest.java
redback-integrations/redback-rest/redback-rest-services/src/test/java/org/codehaus/redback/rest/services/FakeCreateAdminServiceImpl.java
redback-integrations/redback-rest/redback-rest-services/src/test/java/org/codehaus/redback/rest/services/LoginServiceTest.java
redback-integrations/redback-rest/redback-rest-services/src/test/java/org/codehaus/redback/rest/services/RoleManagementServiceTest.java
redback-integrations/redback-rest/redback-rest-services/src/test/java/org/codehaus/redback/rest/services/UserServiceTest.java

diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Application.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Application.java
new file mode 100644 (file)
index 0000000..49b2a6f
--- /dev/null
@@ -0,0 +1,95 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ */
+@XmlRootElement( name = "application" )
+public class Application
+    implements Serializable
+{
+    /**
+     * Field version
+     */
+    private String version;
+
+    /**
+     * Field id
+     */
+    private String id;
+
+    /**
+     * Field description
+     */
+    private String description;
+
+    /**
+     * Field longDescription
+     */
+    private String longDescription;
+
+    public Application()
+    {
+        // no op
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getLongDescription()
+    {
+        return longDescription;
+    }
+
+    public void setLongDescription( String longDescription )
+    {
+        this.longDescription = longDescription;
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ApplicationRoles.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ApplicationRoles.java
new file mode 100644 (file)
index 0000000..8c4985b
--- /dev/null
@@ -0,0 +1,123 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.Collection;
+
+
+/**
+ * @author Olivier Lamy
+ * @since 1.5
+ */
+@XmlRootElement( name = "applicationRole" )
+public class ApplicationRoles
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private Collection<String> globalRoles;
+
+    private Collection<RoleTemplate> roleTemplates;
+
+    private Collection<String> resources;
+
+
+    public ApplicationRoles()
+    {
+        // no op
+    }
+
+    public ApplicationRoles( String name, String description, Collection<String> globalRoles,
+                             Collection<RoleTemplate> roleTemplates, Collection<String> resources )
+    {
+        this.name = name;
+        this.description = description;
+        this.globalRoles = globalRoles;
+        this.roleTemplates = roleTemplates;
+        this.resources = resources;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public Collection<String> getGlobalRoles()
+    {
+        return globalRoles;
+    }
+
+    public void setGlobalRoles( Collection<String> globalRoles )
+    {
+        this.globalRoles = globalRoles;
+    }
+
+    public Collection<RoleTemplate> getRoleTemplates()
+    {
+        return roleTemplates;
+    }
+
+    public void setRoleTemplates( Collection<RoleTemplate> roleTemplates )
+    {
+        this.roleTemplates = roleTemplates;
+    }
+
+    public Collection<String> getResources()
+    {
+        return resources;
+    }
+
+    public void setResources( Collection<String> resources )
+    {
+        this.resources = resources;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "ApplicationRoles" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", globalRoles=" ).append( globalRoles );
+        sb.append( ", roleTemplates=" ).append( roleTemplates );
+        sb.append( ", resources=" ).append( resources );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/ErrorMessage.java
new file mode 100644 (file)
index 0000000..f635cbd
--- /dev/null
@@ -0,0 +1,74 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "errorMessage" )
+public class ErrorMessage
+    implements Serializable
+{
+    private String errorKey;
+
+    private String[] args;
+
+    private static final String[] EMPTY = new String[0];
+
+    public ErrorMessage()
+    {
+        // no op
+    }
+
+    public ErrorMessage( String errorKey )
+    {
+        this.errorKey = errorKey;
+        this.args = EMPTY;
+    }
+
+    public ErrorMessage( String errorKey, String[] args )
+    {
+        this.errorKey = errorKey;
+        this.args = args;
+    }
+
+    public String getErrorKey()
+    {
+        return errorKey;
+    }
+
+    public void setErrorKey( String errorKey )
+    {
+        this.errorKey = errorKey;
+    }
+
+    public String[] getArgs()
+    {
+        return args;
+    }
+
+    public void setArgs( String[] args )
+    {
+        this.args = args;
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Operation.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Operation.java
new file mode 100644 (file)
index 0000000..12844f6
--- /dev/null
@@ -0,0 +1,91 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "operation" )
+public class Operation
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private boolean permanent;
+
+    public Operation()
+    {
+        // no op
+    }
+
+    public Operation( org.apache.archiva.redback.rbac.Operation operation )
+    {
+        this.name = operation.getName();
+        this.description = operation.getDescription();
+        this.permanent = operation.isPermanent();
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Operation" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Permission.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Permission.java
new file mode 100644 (file)
index 0000000..ebe87e6
--- /dev/null
@@ -0,0 +1,99 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "permission" )
+public class Permission
+    implements Serializable
+{
+    private String name;
+
+    private String description;
+
+    private Operation operation;
+
+    private Resource resource;
+
+    private boolean permanent;
+
+    public Permission()
+    {
+        // no op
+    }
+
+    public Permission( org.apache.archiva.redback.rbac.Permission permission )
+    {
+        this.name = permission.getName();
+        this.description = permission.getDescription();
+        this.operation = permission.getOperation() == null ? null : new Operation( permission.getOperation() );
+        this.resource = permission.getResource() == null ? null : new Resource( permission.getResource() );
+        this.permanent = permission.isPermanent();
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public Operation getOperation()
+    {
+        return operation;
+    }
+
+    public void setOperation( Operation operation )
+    {
+        this.operation = operation;
+    }
+
+    public Resource getResource()
+    {
+        return resource;
+    }
+
+    public void setResource( Resource resource )
+    {
+        this.resource = resource;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Permission" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", operation=" ).append( operation );
+        sb.append( ", resource=" ).append( resource );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RedbackRestError.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RedbackRestError.java
new file mode 100644 (file)
index 0000000..86897a2
--- /dev/null
@@ -0,0 +1,69 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.archiva.redback.rest.api.services.RedbackServiceException;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "redbackRestError" )
+public class RedbackRestError
+    implements Serializable
+{
+
+    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>( 1 );
+
+    public RedbackRestError()
+    {
+        // no op
+    }
+
+    public RedbackRestError( RedbackServiceException e )
+    {
+        errorMessages.addAll( e.getErrorMessages() );
+        if ( e.getErrorMessages().isEmpty() && StringUtils.isNotEmpty( e.getMessage() ) )
+        {
+            errorMessages.add( new ErrorMessage( e.getMessage(), null ) );
+        }
+    }
+
+
+    public List<ErrorMessage> getErrorMessages()
+    {
+        return errorMessages;
+    }
+
+    public void setErrorMessages( List<ErrorMessage> errorMessages )
+    {
+        this.errorMessages = errorMessages;
+    }
+
+    public void addErrorMessage( ErrorMessage errorMessage )
+    {
+        this.errorMessages.add( errorMessage );
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RegistrationKey.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RegistrationKey.java
new file mode 100644 (file)
index 0000000..529a6d9
--- /dev/null
@@ -0,0 +1,53 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "registrationKey" )
+public class RegistrationKey
+    implements Serializable
+{
+    private String key;
+
+    public RegistrationKey()
+    {
+        // nope
+    }
+
+    public RegistrationKey( String key )
+    {
+        this.key = key;
+    }
+
+    public String getKey()
+    {
+        return key;
+    }
+
+    public void setKey( String key )
+    {
+        this.key = key;
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Resource.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Resource.java
new file mode 100644 (file)
index 0000000..e2bc006
--- /dev/null
@@ -0,0 +1,91 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "resource" )
+public class Resource
+    implements Serializable
+{
+    private String identifier;
+
+    private boolean pattern;
+
+    private boolean permanent;
+
+    public Resource()
+    {
+        // no op
+    }
+
+    public Resource( org.apache.archiva.redback.rbac.Resource resource )
+    {
+        this.identifier = resource.getIdentifier();
+        this.pattern = resource.isPattern();
+        this.permanent = resource.isPermanent();
+    }
+
+    public String getIdentifier()
+    {
+        return identifier;
+    }
+
+    public void setIdentifier( String identifier )
+    {
+        this.identifier = identifier;
+    }
+
+    public boolean isPattern()
+    {
+        return pattern;
+    }
+
+    public void setPattern( boolean pattern )
+    {
+        this.pattern = pattern;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Resource" );
+        sb.append( "{identifier='" ).append( identifier ).append( '\'' );
+        sb.append( ", pattern=" ).append( pattern );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Role.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/Role.java
new file mode 100644 (file)
index 0000000..bea7861
--- /dev/null
@@ -0,0 +1,282 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@XmlRootElement( name = "role" )
+public class Role
+    implements Serializable
+{
+    /**
+     * Field name
+     */
+    private String name;
+
+    /**
+     * Field description
+     */
+    private String description;
+
+    /**
+     * Field assignable
+     */
+    private boolean assignable = false;
+
+    /**
+     * Field childRoleNames
+     */
+    private List<String> childRoleNames = new ArrayList<String>(0);
+
+    /**
+     * Field permissions
+     */
+    private List<Permission> permissions = new ArrayList<Permission>(0);
+
+    /**
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<String> parentRoleNames = new ArrayList<String>(0);
+
+    /**
+     * user with a parent role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> parentsRolesUsers = new ArrayList<User>(0);
+
+    /**
+     * user with this role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> users = new ArrayList<User>(0);
+
+    /**
+     * users without this role or parent role
+     * some services doesn't populate this field getAllRoles in RoleManagementService
+     */
+    private List<User> otherUsers = new ArrayList<User>(0);
+
+    /**
+     * users to remove assignement to this role
+     */
+    private List<User> removedUsers = new ArrayList<User>(0);
+
+    /**
+     * Field permanent
+     */
+    private boolean permanent = false;
+
+    public Role()
+    {
+        // no op
+    }
+
+    public Role( String name )
+    {
+        this.name = name;
+    }
+
+    public Role( org.apache.archiva.redback.rbac.Role role )
+    {
+        this.name = role.getName();
+        this.description = role.getDescription();
+        this.assignable = role.isAssignable();
+        this.childRoleNames = role.getChildRoleNames() == null
+            ? new ArrayList<String>( 0 )
+            : new ArrayList<String>( role.getChildRoleNames() );
+
+        if ( role.getPermissions() == null )
+        {
+            this.permissions = new ArrayList<Permission>( 0 );
+        }
+        else
+        {
+            for ( org.apache.archiva.redback.rbac.Permission p : role.getPermissions() )
+            {
+                this.permissions.add( new Permission( p ) );
+            }
+        }
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public boolean isAssignable()
+    {
+        return assignable;
+    }
+
+    public void setAssignable( boolean assignable )
+    {
+        this.assignable = assignable;
+    }
+
+    public List<String> getChildRoleNames()
+    {
+        return childRoleNames;
+    }
+
+    public void setChildRoleNames( List<String> childRoleNames )
+    {
+        this.childRoleNames = childRoleNames;
+    }
+
+    public List<Permission> getPermissions()
+    {
+        return permissions;
+    }
+
+    public void setPermissions( List<Permission> permissions )
+    {
+        this.permissions = permissions;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    public List<String> getParentRoleNames()
+    {
+        return parentRoleNames;
+    }
+
+    public void setParentRoleNames( List<String> parentRoleNames )
+    {
+        this.parentRoleNames = parentRoleNames;
+    }
+
+    public List<User> getParentsRolesUsers()
+    {
+        return parentsRolesUsers;
+    }
+
+    public void setParentsRolesUsers( List<User> parentsRolesUsers )
+    {
+        this.parentsRolesUsers = parentsRolesUsers;
+    }
+
+    public List<User> getUsers()
+    {
+        return users;
+    }
+
+    public void setUsers( List<User> users )
+    {
+        this.users = users;
+    }
+
+    public List<User> getOtherUsers()
+    {
+        return otherUsers;
+    }
+
+    public void setOtherUsers( List<User> otherUsers )
+    {
+        this.otherUsers = otherUsers;
+    }
+
+    public List<User> getRemovedUsers()
+    {
+        return removedUsers;
+    }
+
+    public void setRemovedUsers( List<User> removedUsers )
+    {
+        this.removedUsers = removedUsers;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "Role" );
+        sb.append( "{name='" ).append( name ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", assignable=" ).append( assignable );
+        sb.append( ", childRoleNames=" ).append( childRoleNames );
+        sb.append( ", permissions=" ).append( permissions );
+        sb.append( ", parentRoleNames=" ).append( parentRoleNames );
+        sb.append( ", parentsRolesUsers=" ).append( parentsRolesUsers );
+        sb.append( ", users=" ).append( users );
+        sb.append( ", otherUsers=" ).append( otherUsers );
+        sb.append( ", removedUsers=" ).append( removedUsers );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( '}' );
+        return sb.toString();
+    }
+
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( o == null || getClass() != o.getClass() )
+        {
+            return false;
+        }
+
+        Role role = (Role) o;
+
+        if ( name != null ? !name.equals( role.name ) : role.name != null )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return name != null ? name.hashCode() : 0;
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RoleTemplate.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/RoleTemplate.java
new file mode 100644 (file)
index 0000000..78131a0
--- /dev/null
@@ -0,0 +1,138 @@
+package org.apache.archiva.redback.rest.api.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.5
+ */
+@XmlRootElement( name = "roleTemplate" )
+public class RoleTemplate
+    implements Serializable
+{
+    /**
+     * Field id
+     */
+    private String id;
+
+    private String namePrefix;
+
+    private String delimiter = " - ";
+
+    private String description;
+
+    private String resource;
+
+    private List<String> roles;
+
+    public RoleTemplate()
+    {
+        // no op
+    }
+
+    public RoleTemplate( String id, String namePrefix, String delimiter, String description, String resource,
+                         List<String> roles )
+    {
+        this.id = id;
+        this.namePrefix = namePrefix;
+        this.delimiter = delimiter;
+        this.description = description;
+        this.resource = resource;
+        this.roles = roles;
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    public String getNamePrefix()
+    {
+        return namePrefix;
+    }
+
+    public void setNamePrefix( String namePrefix )
+    {
+        this.namePrefix = namePrefix;
+    }
+
+    public String getDelimiter()
+    {
+        return delimiter;
+    }
+
+    public void setDelimiter( String delimiter )
+    {
+        this.delimiter = delimiter;
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public void setDescription( String description )
+    {
+        this.description = description;
+    }
+
+    public String getResource()
+    {
+        return resource;
+    }
+
+    public void setResource( String resource )
+    {
+        this.resource = resource;
+    }
+
+    public List<String> getRoles()
+    {
+        return roles;
+    }
+
+    public void setRoles( List<String> roles )
+    {
+        this.roles = roles;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "RoleTemplate" );
+        sb.append( "{id='" ).append( id ).append( '\'' );
+        sb.append( ", namePrefix='" ).append( namePrefix ).append( '\'' );
+        sb.append( ", delimiter='" ).append( delimiter ).append( '\'' );
+        sb.append( ", description='" ).append( description ).append( '\'' );
+        sb.append( ", resource='" ).append( resource ).append( '\'' );
+        sb.append( ", roles=" ).append( roles );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/User.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/model/User.java
new file mode 100644 (file)
index 0000000..e560efe
--- /dev/null
@@ -0,0 +1,292 @@
+package org.apache.archiva.redback.rest.api.model;
+
+import org.apache.archiva.redback.integration.util.DateUtils;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+@XmlRootElement( name = "user" )
+public class User
+    implements Serializable
+{
+    private String username;
+
+    private String fullName;
+
+    private String email;
+
+    private boolean validated;
+
+    private boolean locked;
+
+    private String password;
+
+    private boolean passwordChangeRequired;
+
+    private boolean permanent;
+
+    private String confirmPassword;
+
+    // Display Only Fields.
+    private String timestampAccountCreation;
+
+    private String timestampLastLogin;
+
+    private String timestampLastPasswordChange;
+
+    /**
+     * for password change only
+     *
+     * @since 1.4
+     */
+    private String previousPassword;
+
+    /**
+     * for roles update only <b>not return on user read</b>
+     *
+     * @since 1.5
+     */
+    private List<String> assignedRoles;
+
+    public User()
+    {
+        // no op
+    }
+
+    public User( String username, String fullName, String email, boolean validated, boolean locked )
+    {
+        this.username = username;
+        this.fullName = fullName;
+        this.email = email;
+        this.validated = validated;
+        this.locked = locked;
+    }
+
+    public User( org.apache.archiva.redback.users.User user )
+    {
+        setUsername( user.getUsername() );
+        this.setEmail( user.getEmail() );
+        this.setFullName( user.getFullName() );
+        this.setLocked( user.isLocked() );
+        this.setPassword( user.getPassword() );
+        this.setValidated( user.isValidated() );
+        this.setPasswordChangeRequired( user.isPasswordChangeRequired() );
+        this.setPermanent( user.isPermanent() );
+
+        setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
+        setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
+        setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
+    }
+
+
+    public String getUsername()
+    {
+        return username;
+    }
+
+    public void setUsername( String username )
+    {
+        this.username = username;
+    }
+
+    public String getFullName()
+    {
+        return fullName;
+    }
+
+    public void setFullName( String fullName )
+    {
+        this.fullName = fullName;
+    }
+
+    public String getEmail()
+    {
+        return email;
+    }
+
+    public void setEmail( String email )
+    {
+        this.email = email;
+    }
+
+    public boolean isValidated()
+    {
+        return validated;
+    }
+
+    public void setValidated( boolean validated )
+    {
+        this.validated = validated;
+    }
+
+    public boolean isLocked()
+    {
+        return locked;
+    }
+
+    public void setLocked( boolean isLocked )
+    {
+        this.locked = isLocked;
+    }
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword( String password )
+    {
+        this.password = password;
+    }
+
+    public boolean isPasswordChangeRequired()
+    {
+        return passwordChangeRequired;
+    }
+
+    public void setPasswordChangeRequired( boolean passwordChangeRequired )
+    {
+        this.passwordChangeRequired = passwordChangeRequired;
+    }
+
+    public boolean isPermanent()
+    {
+        return permanent;
+    }
+
+    public void setPermanent( boolean permanent )
+    {
+        this.permanent = permanent;
+    }
+
+    public String getConfirmPassword()
+    {
+        return confirmPassword;
+    }
+
+    public void setConfirmPassword( String confirmPassword )
+    {
+        this.confirmPassword = confirmPassword;
+    }
+
+    public String getTimestampAccountCreation()
+    {
+        return timestampAccountCreation;
+    }
+
+    public void setTimestampAccountCreation( String timestampAccountCreation )
+    {
+        this.timestampAccountCreation = timestampAccountCreation;
+    }
+
+    public String getTimestampLastLogin()
+    {
+        return timestampLastLogin;
+    }
+
+    public void setTimestampLastLogin( String timestampLastLogin )
+    {
+        this.timestampLastLogin = timestampLastLogin;
+    }
+
+    public String getTimestampLastPasswordChange()
+    {
+        return timestampLastPasswordChange;
+    }
+
+    public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
+    {
+        this.timestampLastPasswordChange = timestampLastPasswordChange;
+    }
+
+    public String getPreviousPassword()
+    {
+        return previousPassword;
+    }
+
+    public void setPreviousPassword( String previousPassword )
+    {
+        this.previousPassword = previousPassword;
+    }
+
+    public List<String> getAssignedRoles()
+    {
+        return assignedRoles;
+    }
+
+    public void setAssignedRoles( List<String> assignedRoles )
+    {
+        this.assignedRoles = assignedRoles;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "User" );
+        sb.append( "{username='" ).append( username ).append( '\'' );
+        sb.append( ", fullName='" ).append( fullName ).append( '\'' );
+        sb.append( ", email='" ).append( email ).append( '\'' );
+        sb.append( ", validated=" ).append( validated );
+        sb.append( ", locked=" ).append( locked );
+        sb.append( ", password='" ).append( password ).append( '\'' );
+        sb.append( ", passwordChangeRequired=" ).append( passwordChangeRequired );
+        sb.append( ", permanent=" ).append( permanent );
+        sb.append( ", confirmPassword='" ).append( confirmPassword ).append( '\'' );
+        sb.append( ", timestampAccountCreation='" ).append( timestampAccountCreation ).append( '\'' );
+        sb.append( ", timestampLastLogin='" ).append( timestampLastLogin ).append( '\'' );
+        sb.append( ", timestampLastPasswordChange='" ).append( timestampLastPasswordChange ).append( '\'' );
+        sb.append( ", previousPassword='" ).append( previousPassword ).append( '\'' );
+        sb.append( ", assignedRoles=" ).append( assignedRoles );
+        sb.append( '}' );
+        return sb.toString();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+        if ( !( o instanceof User ) )
+        {
+            return false;
+        }
+
+        User user = (User) o;
+
+        if ( !username.equals( user.username ) )
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return username.hashCode();
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/LoginService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/LoginService.java
new file mode 100644 (file)
index 0000000..c297b42
--- /dev/null
@@ -0,0 +1,92 @@
+package org.apache.archiva.redback.rest.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+@Path( "/loginService/" )
+public interface LoginService
+{
+
+    @Path( "addAuthenticationKey" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    String addAuthenticationKey( @QueryParam( "providerKey" ) String providedKey,
+                                 @QueryParam( "principal" ) String principal, @QueryParam( "purpose" ) String purpose,
+                                 @QueryParam( "expirationMinutes" ) int expirationMinutes )
+        throws RedbackServiceException;
+
+
+    @Path( "ping" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean ping()
+        throws RedbackServiceException;
+
+
+    @Path( "pingWithAutz" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = false, noPermission = true )
+    Boolean pingWithAutz()
+        throws RedbackServiceException;
+
+    @Path( "logIn" )
+    @GET
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    /**
+     * check username/password and create a http session.
+     * So no more need of reuse username/password for all ajaxRequest
+     */
+    User logIn( @QueryParam( "userName" ) String userName, @QueryParam( "password" ) String password )
+        throws RedbackServiceException;
+
+    @Path( "isLogged" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    /**
+     * simply check if current user has an http session opened with authz passed
+     * @since 1.4
+     */
+    Boolean isLogged()
+        throws RedbackServiceException;
+
+    @Path( "logout" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * clear user http session
+     * @since 1.4
+     */
+    Boolean logout()
+        throws RedbackServiceException;
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/PasswordService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/PasswordService.java
new file mode 100644 (file)
index 0000000..90828e4
--- /dev/null
@@ -0,0 +1,64 @@
+package org.apache.archiva.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/passwordService/" )
+public interface PasswordService
+{
+    @GET
+    @Path( "changePasswordWithKey" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * used to change the password on first user connection after registration use.
+     * the key is mandatory and a control will be done on the username provided.
+     * <b>need to be logged by {@link UserService#validateUserFromKey(String)}</b>
+     * @return username
+     */
+    User changePasswordWithKey( @QueryParam( "password" ) String password,
+                                  @QueryParam( "passwordConfirmation" ) String passwordConfirmation,
+                                  @QueryParam( "key" ) String key )
+        throws RedbackServiceException;
+
+    @GET
+    @Path( "changePassword" )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * used to change the password on passwordChangeRequired state.
+     */
+    User changePassword( @QueryParam( "userName" ) String userName,
+                            @QueryParam( "previousPassword" ) String previousPassword,
+                            @QueryParam( "password" ) String password,
+                            @QueryParam( "passwordConfirmation" ) String passwordConfirmation )
+        throws RedbackServiceException;
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RedbackServiceException.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RedbackServiceException.java
new file mode 100644 (file)
index 0000000..6c99322
--- /dev/null
@@ -0,0 +1,92 @@
+package org.apache.archiva.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.rest.api.model.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.3
+ */
+public class RedbackServiceException
+    extends Exception
+{
+    private int httpErrorCode = 500;
+
+    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>(0);
+
+    public RedbackServiceException( String s )
+    {
+        super( s );
+    }
+
+    public RedbackServiceException( String s, int httpErrorCode )
+    {
+        super( s );
+        this.httpErrorCode = httpErrorCode;
+    }
+
+    public RedbackServiceException( ErrorMessage errorMessage )
+    {
+        errorMessages.add( errorMessage );
+    }
+
+    public RedbackServiceException( ErrorMessage errorMessage, int httpErrorCode )
+    {
+        this.httpErrorCode = httpErrorCode;
+        errorMessages.add( errorMessage );
+    }
+
+    public RedbackServiceException( List<ErrorMessage> errorMessage )
+    {
+        errorMessages.addAll( errorMessage );
+    }
+
+    public int getHttpErrorCode()
+    {
+        return httpErrorCode;
+    }
+
+    public void setHttpErrorCode( int httpErrorCode )
+    {
+        this.httpErrorCode = httpErrorCode;
+    }
+
+    public List<ErrorMessage> getErrorMessages()
+    {
+        if ( errorMessages == null )
+        {
+            this.errorMessages = new ArrayList<ErrorMessage>();
+        }
+        return errorMessages;
+    }
+
+    public void setErrorMessages( List<ErrorMessage> errorMessages )
+    {
+        this.errorMessages = errorMessages;
+    }
+
+    public void addErrorMessage( ErrorMessage errorMessage )
+    {
+        this.errorMessages.add( errorMessage );
+    }
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RoleManagementService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/RoleManagementService.java
new file mode 100644 (file)
index 0000000..0a48f22
--- /dev/null
@@ -0,0 +1,309 @@
+package org.apache.archiva.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
+import org.apache.archiva.redback.rest.api.model.Application;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@Path( "/roleManagementService/" )
+public interface RoleManagementService
+{
+
+    @Path( "createTemplatedRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean createTemplatedRole( @QueryParam( "templateId" ) String templateId,
+                                 @QueryParam( "resource" ) String resource )
+        throws RedbackServiceException;
+
+    /**
+     * removes a role corresponding to the role Id that was manufactured with the given resource
+     * <p/>
+     * it also removes any user assignments for that role
+     *
+     * @param templateId
+     * @param resource
+     * @throws Exception
+     */
+    @Path( "removeTemplatedRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean removeTemplatedRole( @QueryParam( "templateId" ) String templateId,
+                                 @QueryParam( "resource" ) String resource )
+        throws RedbackServiceException;
+
+
+    /**
+     * allows for a role coming from a template to be renamed effectively swapping out the bits of it that
+     * were labeled with the oldResource with the newResource
+     * <p/>
+     * it also manages any user assignments for that role
+     *
+     * @param templateId
+     * @param oldResource
+     * @param newResource
+     * @throws Exception
+     */
+    @Path( "updateRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean updateRole( @QueryParam( "templateId" ) String templateId, @QueryParam( "oldResource" ) String oldResource,
+                        @QueryParam( "newResource" ) String newResource )
+        throws RedbackServiceException;
+
+
+    /**
+     * Assigns the role indicated by the roleId to the given principal
+     *
+     * @param roleId
+     * @param principal
+     * @throws Exception
+     */
+    @Path( "assignRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean assignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
+        throws RedbackServiceException;
+
+    /**
+     * Assigns the role indicated by the roleName to the given principal
+     *
+     * @param roleName
+     * @param principal
+     * @throws Exception
+     */
+    @Path( "assignRoleByName" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean assignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
+        throws RedbackServiceException;
+
+    /**
+     * Assigns the templated role indicated by the templateId
+     * <p/>
+     * fails if the templated role has not been created
+     *
+     * @param templateId
+     * @param resource
+     * @param principal
+     */
+    @Path( "assignTemplatedRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean assignTemplatedRole( @QueryParam( "templateId" ) String templateId,
+                                 @QueryParam( "resource" ) String resource,
+                                 @QueryParam( "principal" ) String principal )
+        throws RedbackServiceException;
+
+    /**
+     * Unassigns the role indicated by the role id from the given principal
+     *
+     * @param roleId
+     * @param principal
+     * @throws Exception
+     */
+    @Path( "unassignRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean unassignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
+        throws RedbackServiceException;
+
+    /**
+     * Unassigns the role indicated by the role name from the given principal
+     *
+     * @param roleName
+     * @param principal
+     * @throws Exception
+     */
+    @Path( "unassignRoleByName" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean unassignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
+        throws RedbackServiceException;
+
+    /**
+     * true of a role exists with the given roleId
+     *
+     * @param roleId
+     * @return
+     * @throws Exception
+     */
+    @Path( "roleExists" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean roleExists( @QueryParam( "roleId" ) String roleId )
+        throws RedbackServiceException;
+
+    /**
+     * true of a role exists with the given roleId
+     *
+     * @param templateId
+     * @param resource
+     * @return
+     * @throws Exception
+     */
+    @Path( "templatedRoleExists" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean templatedRoleExists( @QueryParam( "templateId" ) String templateId,
+                                 @QueryParam( "resource" ) String resource )
+        throws RedbackServiceException;
+
+
+    /**
+     * Check a role template is complete in the RBAC store.
+     *
+     * @param templateId the templated role
+     * @param resource   the resource to verify
+     * @throws Exception
+     */
+    @Path( "verifyTemplatedRole" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    Boolean verifyTemplatedRole( @QueryParam( "templateId" ) String templateId,
+                                 @QueryParam( "resource" ) String resource )
+        throws RedbackServiceException;
+
+    @Path( "getEffectivelyAssignedRoles/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.4
+     */
+    List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+
+    @Path( "allRoles" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    List<Role> getAllRoles()
+        throws RedbackServiceException;
+
+    @Path( "detailledAllRoles" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    List<Role> getDetailedAllRoles()
+        throws RedbackServiceException;
+
+
+    @Path( "getApplications/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    List<Application> getApplications( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+
+    @Path( "getRole/{roleName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Role getRole( @PathParam( "roleName" ) String roleName )
+        throws RedbackServiceException;
+
+    @Path( "updateRoleDescription" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName,
+                                   @QueryParam( "roleDescription" ) String description )
+        throws RedbackServiceException;
+
+    @Path( "updateRoleUsers" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * update users assigned to a role
+     * @since 1.5
+     */
+    Boolean updateRoleUsers( Role role )
+        throws RedbackServiceException;
+
+    @Path( "getApplicationRoles/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * @since 1.5
+     */
+    List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+    @Path( "updateUserRoles" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
+    /**
+     * update roles assigned to a user
+     * @since 1.5
+     */
+    Boolean updateUserRoles( User user )
+        throws RedbackServiceException;
+
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UserService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UserService.java
new file mode 100644 (file)
index 0000000..239169f
--- /dev/null
@@ -0,0 +1,260 @@
+package org.apache.archiva.redback.rest.api.services;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.authorization.RedbackAuthorization;
+import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.RegistrationKey;
+import org.apache.archiva.redback.rest.api.model.User;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.Collection;
+import java.util.List;
+
+@Path( "/userService/" )
+public interface UserService
+{
+    @Path( "getUser/{userName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    User getUser( @PathParam( "userName" ) String username )
+        throws RedbackServiceException;
+
+
+    @Path( "getUsers" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+    List<User> getUsers()
+        throws RedbackServiceException;
+
+    @Path( "createUser" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION )
+    Boolean createUser( User user )
+        throws RedbackServiceException;
+
+
+    /**
+     * will create admin user only if not exists !! if exists will return false
+     */
+    @Path( "createAdminUser" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean createAdminUser( User user )
+        throws RedbackServiceException;
+
+    @Path( "isAdminUserExists" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean isAdminUserExists()
+        throws RedbackServiceException;
+
+
+    @Path( "deleteUser/{userName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION )
+    Boolean deleteUser( @PathParam( "userName" ) String username )
+        throws RedbackServiceException;
+
+    @Path( "updateUser" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    Boolean updateUser( User user )
+        throws RedbackServiceException;
+
+    @Path( "lockUser/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Boolean lockUser( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+    @Path( "unlockUser/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Boolean unlockUser( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+
+    @Path( "passwordChangeRequired/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Boolean passwordChangeRequired( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+    @Path( "passwordChangeNotRequired/{username}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    /**
+     * @since 1.5
+     */
+    Boolean passwordChangeNotRequired( @PathParam( "username" ) String username )
+        throws RedbackServiceException;
+
+
+    @Path( "updateMe" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = false, noPermission = true )
+    /**
+     * update only the current user and this fields: fullname, email, password.
+     * the service verify the curent logged user with the one passed in the method
+     * @since 1.4
+     */
+    Boolean updateMe( User user )
+        throws RedbackServiceException;
+
+    @Path( "ping" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    Boolean ping()
+        throws RedbackServiceException;
+
+    @Path( "removeFromCache/{userName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    int removeFromCache( @PathParam( "userName" ) String username )
+        throws RedbackServiceException;
+
+    @Path( "getGuestUser" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    User getGuestUser()
+        throws RedbackServiceException;
+
+    @Path( "createGuestUser" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
+    User createGuestUser()
+        throws RedbackServiceException;
+
+    @Path( "registerUser" )
+    @POST
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * if redback is not configured for email validation is required, -1 is returned as key
+     * @since 1.4
+     */
+    RegistrationKey registerUser( User user )
+        throws RedbackServiceException;
+
+
+    @Path( "validateKey/{key}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * validate the key and the user with forcing a password change for next login.
+     * http session is created.
+     * @param key authentication key
+     * @since 1.4
+     */
+    Boolean validateUserFromKey( @PathParam( "key" ) String key )
+        throws RedbackServiceException;
+
+    @Path( "resetPassword/{user}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     *
+     * @param user username for send a password reset email
+     * @since 1.4
+     */
+    Boolean resetPassword( @PathParam( "user" ) String user )
+        throws RedbackServiceException;
+
+    @Path( "getUserPermissions/{userName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+    /**
+     * @since 1.4
+     */
+    Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName )
+        throws RedbackServiceException;
+
+    @Path( "getUserOperations/{userName}" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
+    /**
+     * @since 1.4
+     */
+    Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName )
+        throws RedbackServiceException;
+
+    @Path( "getCurrentUserPermissions" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * return the current logged user permissions, if no logged user guest permissions are returned
+     * @since 1.4
+     */
+    Collection<Permission> getCurrentUserPermissions()
+        throws RedbackServiceException;
+
+    @Path( "getCurrentUserOperations" )
+    @GET
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true, noPermission = true )
+    /**
+     * return the current logged user operations, if no logged user guest operations are returned
+     * @since 1.4
+     */
+    Collection<Operation> getCurrentUserOperations()
+        throws RedbackServiceException;
+
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UtilServices.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/apache/archiva/redback/rest/api/services/UtilServices.java
new file mode 100644 (file)
index 0000000..719343e
--- /dev/null
@@ -0,0 +1,56 @@
+package org.apache.archiva.redback.rest.api.services;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.archiva.redback.authorization.RedbackAuthorization;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4
+ */
+@Path( "/utilServices/" )
+public interface UtilServices
+{
+
+    @Path( "getBundleResources" )
+    @GET
+    @Produces( { MediaType.TEXT_PLAIN } )
+    @RedbackAuthorization( noRestriction = true )
+    String getI18nResources( @QueryParam( "locale" ) String locale )
+        throws RedbackServiceException;
+
+    /**
+     * <b>not intended to be exposed as a REST service.</b>
+     * will load i18N resource org/codehaus/plexus/redback/users/messages in default en then in the asked locale.
+     * @param locale
+     * @return
+     * @throws RedbackServiceException
+     */
+    Properties getI18nProperties( String locale )
+        throws RedbackServiceException;
+
+
+}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Application.java
deleted file mode 100644 (file)
index 88c7155..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- */
-@XmlRootElement( name = "application" )
-public class Application
-    implements Serializable
-{
-    /**
-     * Field version
-     */
-    private String version;
-
-    /**
-     * Field id
-     */
-    private String id;
-
-    /**
-     * Field description
-     */
-    private String description;
-
-    /**
-     * Field longDescription
-     */
-    private String longDescription;
-
-    public Application()
-    {
-        // no op
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String version )
-    {
-        this.version = version;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public String getLongDescription()
-    {
-        return longDescription;
-    }
-
-    public void setLongDescription( String longDescription )
-    {
-        this.longDescription = longDescription;
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ApplicationRoles.java
deleted file mode 100644 (file)
index c0ad1b2..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.Collection;
-
-
-/**
- * @author Olivier Lamy
- * @since 1.5
- */
-@XmlRootElement( name = "applicationRole" )
-public class ApplicationRoles
-    implements Serializable
-{
-    private String name;
-
-    private String description;
-
-    private Collection<String> globalRoles;
-
-    private Collection<RoleTemplate> roleTemplates;
-
-    private Collection<String> resources;
-
-
-    public ApplicationRoles()
-    {
-        // no op
-    }
-
-    public ApplicationRoles( String name, String description, Collection<String> globalRoles,
-                             Collection<RoleTemplate> roleTemplates, Collection<String> resources )
-    {
-        this.name = name;
-        this.description = description;
-        this.globalRoles = globalRoles;
-        this.roleTemplates = roleTemplates;
-        this.resources = resources;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public Collection<String> getGlobalRoles()
-    {
-        return globalRoles;
-    }
-
-    public void setGlobalRoles( Collection<String> globalRoles )
-    {
-        this.globalRoles = globalRoles;
-    }
-
-    public Collection<RoleTemplate> getRoleTemplates()
-    {
-        return roleTemplates;
-    }
-
-    public void setRoleTemplates( Collection<RoleTemplate> roleTemplates )
-    {
-        this.roleTemplates = roleTemplates;
-    }
-
-    public Collection<String> getResources()
-    {
-        return resources;
-    }
-
-    public void setResources( Collection<String> resources )
-    {
-        this.resources = resources;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "ApplicationRoles" );
-        sb.append( "{name='" ).append( name ).append( '\'' );
-        sb.append( ", description='" ).append( description ).append( '\'' );
-        sb.append( ", globalRoles=" ).append( globalRoles );
-        sb.append( ", roleTemplates=" ).append( roleTemplates );
-        sb.append( ", resources=" ).append( resources );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/ErrorMessage.java
deleted file mode 100644 (file)
index 9ff6d87..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "errorMessage" )
-public class ErrorMessage
-    implements Serializable
-{
-    private String errorKey;
-
-    private String[] args;
-
-    private static final String[] EMPTY = new String[0];
-
-    public ErrorMessage()
-    {
-        // no op
-    }
-
-    public ErrorMessage( String errorKey )
-    {
-        this.errorKey = errorKey;
-        this.args = EMPTY;
-    }
-
-    public ErrorMessage( String errorKey, String[] args )
-    {
-        this.errorKey = errorKey;
-        this.args = args;
-    }
-
-    public String getErrorKey()
-    {
-        return errorKey;
-    }
-
-    public void setErrorKey( String errorKey )
-    {
-        this.errorKey = errorKey;
-    }
-
-    public String[] getArgs()
-    {
-        return args;
-    }
-
-    public void setArgs( String[] args )
-    {
-        this.args = args;
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Operation.java
deleted file mode 100644 (file)
index 724b03e..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "operation" )
-public class Operation
-    implements Serializable
-{
-    private String name;
-
-    private String description;
-
-    private boolean permanent;
-
-    public Operation()
-    {
-        // no op
-    }
-
-    public Operation( org.apache.archiva.redback.rbac.Operation operation )
-    {
-        this.name = operation.getName();
-        this.description = operation.getDescription();
-        this.permanent = operation.isPermanent();
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public boolean isPermanent()
-    {
-        return permanent;
-    }
-
-    public void setPermanent( boolean permanent )
-    {
-        this.permanent = permanent;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "Operation" );
-        sb.append( "{name='" ).append( name ).append( '\'' );
-        sb.append( ", description='" ).append( description ).append( '\'' );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Permission.java
deleted file mode 100644 (file)
index 711b5b6..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "permission" )
-public class Permission
-    implements Serializable
-{
-    private String name;
-
-    private String description;
-
-    private Operation operation;
-
-    private Resource resource;
-
-    private boolean permanent;
-
-    public Permission()
-    {
-        // no op
-    }
-
-    public Permission( org.apache.archiva.redback.rbac.Permission permission )
-    {
-        this.name = permission.getName();
-        this.description = permission.getDescription();
-        this.operation = permission.getOperation() == null ? null : new Operation( permission.getOperation() );
-        this.resource = permission.getResource() == null ? null : new Resource( permission.getResource() );
-        this.permanent = permission.isPermanent();
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public Operation getOperation()
-    {
-        return operation;
-    }
-
-    public void setOperation( Operation operation )
-    {
-        this.operation = operation;
-    }
-
-    public Resource getResource()
-    {
-        return resource;
-    }
-
-    public void setResource( Resource resource )
-    {
-        this.resource = resource;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "Permission" );
-        sb.append( "{name='" ).append( name ).append( '\'' );
-        sb.append( ", description='" ).append( description ).append( '\'' );
-        sb.append( ", operation=" ).append( operation );
-        sb.append( ", resource=" ).append( resource );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RedbackRestError.java
deleted file mode 100644 (file)
index 030d306..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.codehaus.redback.rest.api.services.RedbackServiceException;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "redbackRestError" )
-public class RedbackRestError
-    implements Serializable
-{
-
-    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>( 1 );
-
-    public RedbackRestError()
-    {
-        // no op
-    }
-
-    public RedbackRestError( RedbackServiceException e )
-    {
-        errorMessages.addAll( e.getErrorMessages() );
-        if ( e.getErrorMessages().isEmpty() && StringUtils.isNotEmpty( e.getMessage() ) )
-        {
-            errorMessages.add( new ErrorMessage( e.getMessage(), null ) );
-        }
-    }
-
-
-    public List<ErrorMessage> getErrorMessages()
-    {
-        return errorMessages;
-    }
-
-    public void setErrorMessages( List<ErrorMessage> errorMessages )
-    {
-        this.errorMessages = errorMessages;
-    }
-
-    public void addErrorMessage( ErrorMessage errorMessage )
-    {
-        this.errorMessages.add( errorMessage );
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RegistrationKey.java
deleted file mode 100644 (file)
index 21c2c0b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "registrationKey" )
-public class RegistrationKey
-    implements Serializable
-{
-    private String key;
-
-    public RegistrationKey()
-    {
-        // nope
-    }
-
-    public RegistrationKey( String key )
-    {
-        this.key = key;
-    }
-
-    public String getKey()
-    {
-        return key;
-    }
-
-    public void setKey( String key )
-    {
-        this.key = key;
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Resource.java
deleted file mode 100644 (file)
index ae016ed..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "resource" )
-public class Resource
-    implements Serializable
-{
-    private String identifier;
-
-    private boolean pattern;
-
-    private boolean permanent;
-
-    public Resource()
-    {
-        // no op
-    }
-
-    public Resource( org.apache.archiva.redback.rbac.Resource resource )
-    {
-        this.identifier = resource.getIdentifier();
-        this.pattern = resource.isPattern();
-        this.permanent = resource.isPermanent();
-    }
-
-    public String getIdentifier()
-    {
-        return identifier;
-    }
-
-    public void setIdentifier( String identifier )
-    {
-        this.identifier = identifier;
-    }
-
-    public boolean isPattern()
-    {
-        return pattern;
-    }
-
-    public void setPattern( boolean pattern )
-    {
-        this.pattern = pattern;
-    }
-
-    public boolean isPermanent()
-    {
-        return permanent;
-    }
-
-    public void setPermanent( boolean permanent )
-    {
-        this.permanent = permanent;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "Resource" );
-        sb.append( "{identifier='" ).append( identifier ).append( '\'' );
-        sb.append( ", pattern=" ).append( pattern );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/Role.java
deleted file mode 100644 (file)
index b9ce7a6..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@XmlRootElement( name = "role" )
-public class Role
-    implements Serializable
-{
-    /**
-     * Field name
-     */
-    private String name;
-
-    /**
-     * Field description
-     */
-    private String description;
-
-    /**
-     * Field assignable
-     */
-    private boolean assignable = false;
-
-    /**
-     * Field childRoleNames
-     */
-    private List<String> childRoleNames = new ArrayList<String>(0);
-
-    /**
-     * Field permissions
-     */
-    private List<Permission> permissions = new ArrayList<Permission>(0);
-
-    /**
-     * some services doesn't populate this field getAllRoles in RoleManagementService
-     */
-    private List<String> parentRoleNames = new ArrayList<String>(0);
-
-    /**
-     * user with a parent role
-     * some services doesn't populate this field getAllRoles in RoleManagementService
-     */
-    private List<User> parentsRolesUsers = new ArrayList<User>(0);
-
-    /**
-     * user with this role
-     * some services doesn't populate this field getAllRoles in RoleManagementService
-     */
-    private List<User> users = new ArrayList<User>(0);
-
-    /**
-     * users without this role or parent role
-     * some services doesn't populate this field getAllRoles in RoleManagementService
-     */
-    private List<User> otherUsers = new ArrayList<User>(0);
-
-    /**
-     * users to remove assignement to this role
-     */
-    private List<User> removedUsers = new ArrayList<User>(0);
-
-    /**
-     * Field permanent
-     */
-    private boolean permanent = false;
-
-    public Role()
-    {
-        // no op
-    }
-
-    public Role( String name )
-    {
-        this.name = name;
-    }
-
-    public Role( org.apache.archiva.redback.rbac.Role role )
-    {
-        this.name = role.getName();
-        this.description = role.getDescription();
-        this.assignable = role.isAssignable();
-        this.childRoleNames = role.getChildRoleNames() == null
-            ? new ArrayList<String>( 0 )
-            : new ArrayList<String>( role.getChildRoleNames() );
-
-        if ( role.getPermissions() == null )
-        {
-            this.permissions = new ArrayList<Permission>( 0 );
-        }
-        else
-        {
-            for ( org.apache.archiva.redback.rbac.Permission p : role.getPermissions() )
-            {
-                this.permissions.add( new Permission( p ) );
-            }
-        }
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public boolean isAssignable()
-    {
-        return assignable;
-    }
-
-    public void setAssignable( boolean assignable )
-    {
-        this.assignable = assignable;
-    }
-
-    public List<String> getChildRoleNames()
-    {
-        return childRoleNames;
-    }
-
-    public void setChildRoleNames( List<String> childRoleNames )
-    {
-        this.childRoleNames = childRoleNames;
-    }
-
-    public List<Permission> getPermissions()
-    {
-        return permissions;
-    }
-
-    public void setPermissions( List<Permission> permissions )
-    {
-        this.permissions = permissions;
-    }
-
-    public boolean isPermanent()
-    {
-        return permanent;
-    }
-
-    public void setPermanent( boolean permanent )
-    {
-        this.permanent = permanent;
-    }
-
-    public List<String> getParentRoleNames()
-    {
-        return parentRoleNames;
-    }
-
-    public void setParentRoleNames( List<String> parentRoleNames )
-    {
-        this.parentRoleNames = parentRoleNames;
-    }
-
-    public List<User> getParentsRolesUsers()
-    {
-        return parentsRolesUsers;
-    }
-
-    public void setParentsRolesUsers( List<User> parentsRolesUsers )
-    {
-        this.parentsRolesUsers = parentsRolesUsers;
-    }
-
-    public List<User> getUsers()
-    {
-        return users;
-    }
-
-    public void setUsers( List<User> users )
-    {
-        this.users = users;
-    }
-
-    public List<User> getOtherUsers()
-    {
-        return otherUsers;
-    }
-
-    public void setOtherUsers( List<User> otherUsers )
-    {
-        this.otherUsers = otherUsers;
-    }
-
-    public List<User> getRemovedUsers()
-    {
-        return removedUsers;
-    }
-
-    public void setRemovedUsers( List<User> removedUsers )
-    {
-        this.removedUsers = removedUsers;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "Role" );
-        sb.append( "{name='" ).append( name ).append( '\'' );
-        sb.append( ", description='" ).append( description ).append( '\'' );
-        sb.append( ", assignable=" ).append( assignable );
-        sb.append( ", childRoleNames=" ).append( childRoleNames );
-        sb.append( ", permissions=" ).append( permissions );
-        sb.append( ", parentRoleNames=" ).append( parentRoleNames );
-        sb.append( ", parentsRolesUsers=" ).append( parentsRolesUsers );
-        sb.append( ", users=" ).append( users );
-        sb.append( ", otherUsers=" ).append( otherUsers );
-        sb.append( ", removedUsers=" ).append( removedUsers );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( '}' );
-        return sb.toString();
-    }
-
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( o == null || getClass() != o.getClass() )
-        {
-            return false;
-        }
-
-        Role role = (Role) o;
-
-        if ( name != null ? !name.equals( role.name ) : role.name != null )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return name != null ? name.hashCode() : 0;
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/RoleTemplate.java
deleted file mode 100644 (file)
index cce9f27..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.5
- */
-@XmlRootElement( name = "roleTemplate" )
-public class RoleTemplate
-    implements Serializable
-{
-    /**
-     * Field id
-     */
-    private String id;
-
-    private String namePrefix;
-
-    private String delimiter = " - ";
-
-    private String description;
-
-    private String resource;
-
-    private List<String> roles;
-
-    public RoleTemplate()
-    {
-        // no op
-    }
-
-    public RoleTemplate( String id, String namePrefix, String delimiter, String description, String resource,
-                         List<String> roles )
-    {
-        this.id = id;
-        this.namePrefix = namePrefix;
-        this.delimiter = delimiter;
-        this.description = description;
-        this.resource = resource;
-        this.roles = roles;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-
-    public void setId( String id )
-    {
-        this.id = id;
-    }
-
-    public String getNamePrefix()
-    {
-        return namePrefix;
-    }
-
-    public void setNamePrefix( String namePrefix )
-    {
-        this.namePrefix = namePrefix;
-    }
-
-    public String getDelimiter()
-    {
-        return delimiter;
-    }
-
-    public void setDelimiter( String delimiter )
-    {
-        this.delimiter = delimiter;
-    }
-
-    public String getDescription()
-    {
-        return description;
-    }
-
-    public void setDescription( String description )
-    {
-        this.description = description;
-    }
-
-    public String getResource()
-    {
-        return resource;
-    }
-
-    public void setResource( String resource )
-    {
-        this.resource = resource;
-    }
-
-    public List<String> getRoles()
-    {
-        return roles;
-    }
-
-    public void setRoles( List<String> roles )
-    {
-        this.roles = roles;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "RoleTemplate" );
-        sb.append( "{id='" ).append( id ).append( '\'' );
-        sb.append( ", namePrefix='" ).append( namePrefix ).append( '\'' );
-        sb.append( ", delimiter='" ).append( delimiter ).append( '\'' );
-        sb.append( ", description='" ).append( description ).append( '\'' );
-        sb.append( ", resource='" ).append( resource ).append( '\'' );
-        sb.append( ", roles=" ).append( roles );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/model/User.java
deleted file mode 100644 (file)
index 17ed43c..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-package org.codehaus.redback.rest.api.model;
-
-import org.apache.archiva.redback.integration.util.DateUtils;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.List;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.
- */
-
-@XmlRootElement( name = "user" )
-public class User
-    implements Serializable
-{
-    private String username;
-
-    private String fullName;
-
-    private String email;
-
-    private boolean validated;
-
-    private boolean locked;
-
-    private String password;
-
-    private boolean passwordChangeRequired;
-
-    private boolean permanent;
-
-    private String confirmPassword;
-
-    // Display Only Fields.
-    private String timestampAccountCreation;
-
-    private String timestampLastLogin;
-
-    private String timestampLastPasswordChange;
-
-    /**
-     * for password change only
-     *
-     * @since 1.4
-     */
-    private String previousPassword;
-
-    /**
-     * for roles update only <b>not return on user read</b>
-     *
-     * @since 1.5
-     */
-    private List<String> assignedRoles;
-
-    public User()
-    {
-        // no op
-    }
-
-    public User( String username, String fullName, String email, boolean validated, boolean locked )
-    {
-        this.username = username;
-        this.fullName = fullName;
-        this.email = email;
-        this.validated = validated;
-        this.locked = locked;
-    }
-
-    public User( org.apache.archiva.redback.users.User user )
-    {
-        setUsername( user.getUsername() );
-        this.setEmail( user.getEmail() );
-        this.setFullName( user.getFullName() );
-        this.setLocked( user.isLocked() );
-        this.setPassword( user.getPassword() );
-        this.setValidated( user.isValidated() );
-        this.setPasswordChangeRequired( user.isPasswordChangeRequired() );
-        this.setPermanent( user.isPermanent() );
-
-        setTimestampAccountCreation( DateUtils.formatWithAge( user.getAccountCreationDate(), "ago" ) );
-        setTimestampLastLogin( DateUtils.formatWithAge( user.getLastLoginDate(), "ago" ) );
-        setTimestampLastPasswordChange( DateUtils.formatWithAge( user.getLastPasswordChange(), "ago" ) );
-    }
-
-
-    public String getUsername()
-    {
-        return username;
-    }
-
-    public void setUsername( String username )
-    {
-        this.username = username;
-    }
-
-    public String getFullName()
-    {
-        return fullName;
-    }
-
-    public void setFullName( String fullName )
-    {
-        this.fullName = fullName;
-    }
-
-    public String getEmail()
-    {
-        return email;
-    }
-
-    public void setEmail( String email )
-    {
-        this.email = email;
-    }
-
-    public boolean isValidated()
-    {
-        return validated;
-    }
-
-    public void setValidated( boolean validated )
-    {
-        this.validated = validated;
-    }
-
-    public boolean isLocked()
-    {
-        return locked;
-    }
-
-    public void setLocked( boolean isLocked )
-    {
-        this.locked = isLocked;
-    }
-
-    public String getPassword()
-    {
-        return password;
-    }
-
-    public void setPassword( String password )
-    {
-        this.password = password;
-    }
-
-    public boolean isPasswordChangeRequired()
-    {
-        return passwordChangeRequired;
-    }
-
-    public void setPasswordChangeRequired( boolean passwordChangeRequired )
-    {
-        this.passwordChangeRequired = passwordChangeRequired;
-    }
-
-    public boolean isPermanent()
-    {
-        return permanent;
-    }
-
-    public void setPermanent( boolean permanent )
-    {
-        this.permanent = permanent;
-    }
-
-    public String getConfirmPassword()
-    {
-        return confirmPassword;
-    }
-
-    public void setConfirmPassword( String confirmPassword )
-    {
-        this.confirmPassword = confirmPassword;
-    }
-
-    public String getTimestampAccountCreation()
-    {
-        return timestampAccountCreation;
-    }
-
-    public void setTimestampAccountCreation( String timestampAccountCreation )
-    {
-        this.timestampAccountCreation = timestampAccountCreation;
-    }
-
-    public String getTimestampLastLogin()
-    {
-        return timestampLastLogin;
-    }
-
-    public void setTimestampLastLogin( String timestampLastLogin )
-    {
-        this.timestampLastLogin = timestampLastLogin;
-    }
-
-    public String getTimestampLastPasswordChange()
-    {
-        return timestampLastPasswordChange;
-    }
-
-    public void setTimestampLastPasswordChange( String timestampLastPasswordChange )
-    {
-        this.timestampLastPasswordChange = timestampLastPasswordChange;
-    }
-
-    public String getPreviousPassword()
-    {
-        return previousPassword;
-    }
-
-    public void setPreviousPassword( String previousPassword )
-    {
-        this.previousPassword = previousPassword;
-    }
-
-    public List<String> getAssignedRoles()
-    {
-        return assignedRoles;
-    }
-
-    public void setAssignedRoles( List<String> assignedRoles )
-    {
-        this.assignedRoles = assignedRoles;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "User" );
-        sb.append( "{username='" ).append( username ).append( '\'' );
-        sb.append( ", fullName='" ).append( fullName ).append( '\'' );
-        sb.append( ", email='" ).append( email ).append( '\'' );
-        sb.append( ", validated=" ).append( validated );
-        sb.append( ", locked=" ).append( locked );
-        sb.append( ", password='" ).append( password ).append( '\'' );
-        sb.append( ", passwordChangeRequired=" ).append( passwordChangeRequired );
-        sb.append( ", permanent=" ).append( permanent );
-        sb.append( ", confirmPassword='" ).append( confirmPassword ).append( '\'' );
-        sb.append( ", timestampAccountCreation='" ).append( timestampAccountCreation ).append( '\'' );
-        sb.append( ", timestampLastLogin='" ).append( timestampLastLogin ).append( '\'' );
-        sb.append( ", timestampLastPasswordChange='" ).append( timestampLastPasswordChange ).append( '\'' );
-        sb.append( ", previousPassword='" ).append( previousPassword ).append( '\'' );
-        sb.append( ", assignedRoles=" ).append( assignedRoles );
-        sb.append( '}' );
-        return sb.toString();
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-        if ( !( o instanceof User ) )
-        {
-            return false;
-        }
-
-        User user = (User) o;
-
-        if ( !username.equals( user.username ) )
-        {
-            return false;
-        }
-
-        return true;
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return username.hashCode();
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/LoginService.java
deleted file mode 100644 (file)
index 6b488c1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.archiva.redback.authorization.RedbackAuthorization;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-@Path( "/loginService/" )
-public interface LoginService
-{
-
-    @Path( "addAuthenticationKey" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    String addAuthenticationKey( @QueryParam( "providerKey" ) String providedKey,
-                                 @QueryParam( "principal" ) String principal, @QueryParam( "purpose" ) String purpose,
-                                 @QueryParam( "expirationMinutes" ) int expirationMinutes )
-        throws RedbackServiceException;
-
-
-    @Path( "ping" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    Boolean ping()
-        throws RedbackServiceException;
-
-
-    @Path( "pingWithAutz" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = false, noPermission = true )
-    Boolean pingWithAutz()
-        throws RedbackServiceException;
-
-    @Path( "logIn" )
-    @GET
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    /**
-     * check username/password and create a http session.
-     * So no more need of reuse username/password for all ajaxRequest
-     */
-    User logIn( @QueryParam( "userName" ) String userName, @QueryParam( "password" ) String password )
-        throws RedbackServiceException;
-
-    @Path( "isLogged" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    /**
-     * simply check if current user has an http session opened with authz passed
-     * @since 1.4
-     */
-    Boolean isLogged()
-        throws RedbackServiceException;
-
-    @Path( "logout" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * clear user http session
-     * @since 1.4
-     */
-    Boolean logout()
-        throws RedbackServiceException;
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/PasswordService.java
deleted file mode 100644 (file)
index 4e92eb3..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.archiva.redback.authorization.RedbackAuthorization;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Path( "/passwordService/" )
-public interface PasswordService
-{
-    @GET
-    @Path( "changePasswordWithKey" )
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * used to change the password on first user connection after registration use.
-     * the key is mandatory and a control will be done on the username provided.
-     * <b>need to be logged by {@link UserService#validateUserFromKey(String)}</b>
-     * @return username
-     */
-    User changePasswordWithKey( @QueryParam( "password" ) String password,
-                                  @QueryParam( "passwordConfirmation" ) String passwordConfirmation,
-                                  @QueryParam( "key" ) String key )
-        throws RedbackServiceException;
-
-    @GET
-    @Path( "changePassword" )
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * used to change the password on passwordChangeRequired state.
-     */
-    User changePassword( @QueryParam( "userName" ) String userName,
-                            @QueryParam( "previousPassword" ) String previousPassword,
-                            @QueryParam( "password" ) String password,
-                            @QueryParam( "passwordConfirmation" ) String passwordConfirmation )
-        throws RedbackServiceException;
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RedbackServiceException.java
deleted file mode 100644 (file)
index f22b116..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.rest.api.model.ErrorMessage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.3
- */
-public class RedbackServiceException
-    extends Exception
-{
-    private int httpErrorCode = 500;
-
-    private List<ErrorMessage> errorMessages = new ArrayList<ErrorMessage>(0);
-
-    public RedbackServiceException( String s )
-    {
-        super( s );
-    }
-
-    public RedbackServiceException( String s, int httpErrorCode )
-    {
-        super( s );
-        this.httpErrorCode = httpErrorCode;
-    }
-
-    public RedbackServiceException( ErrorMessage errorMessage )
-    {
-        errorMessages.add( errorMessage );
-    }
-
-    public RedbackServiceException( ErrorMessage errorMessage, int httpErrorCode )
-    {
-        this.httpErrorCode = httpErrorCode;
-        errorMessages.add( errorMessage );
-    }
-
-    public RedbackServiceException( List<ErrorMessage> errorMessage )
-    {
-        errorMessages.addAll( errorMessage );
-    }
-
-    public int getHttpErrorCode()
-    {
-        return httpErrorCode;
-    }
-
-    public void setHttpErrorCode( int httpErrorCode )
-    {
-        this.httpErrorCode = httpErrorCode;
-    }
-
-    public List<ErrorMessage> getErrorMessages()
-    {
-        if ( errorMessages == null )
-        {
-            this.errorMessages = new ArrayList<ErrorMessage>();
-        }
-        return errorMessages;
-    }
-
-    public void setErrorMessages( List<ErrorMessage> errorMessages )
-    {
-        this.errorMessages = errorMessages;
-    }
-
-    public void addErrorMessage( ErrorMessage errorMessage )
-    {
-        this.errorMessages.add( errorMessage );
-    }
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RoleManagementService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/RoleManagementService.java
deleted file mode 100644 (file)
index 4a9c547..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.Application;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@Path( "/roleManagementService/" )
-public interface RoleManagementService
-{
-
-    @Path( "createTemplatedRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean createTemplatedRole( @QueryParam( "templateId" ) String templateId,
-                                 @QueryParam( "resource" ) String resource )
-        throws RedbackServiceException;
-
-    /**
-     * removes a role corresponding to the role Id that was manufactured with the given resource
-     * <p/>
-     * it also removes any user assignments for that role
-     *
-     * @param templateId
-     * @param resource
-     * @throws Exception
-     */
-    @Path( "removeTemplatedRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean removeTemplatedRole( @QueryParam( "templateId" ) String templateId,
-                                 @QueryParam( "resource" ) String resource )
-        throws RedbackServiceException;
-
-
-    /**
-     * allows for a role coming from a template to be renamed effectively swapping out the bits of it that
-     * were labeled with the oldResource with the newResource
-     * <p/>
-     * it also manages any user assignments for that role
-     *
-     * @param templateId
-     * @param oldResource
-     * @param newResource
-     * @throws Exception
-     */
-    @Path( "updateRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean updateRole( @QueryParam( "templateId" ) String templateId, @QueryParam( "oldResource" ) String oldResource,
-                        @QueryParam( "newResource" ) String newResource )
-        throws RedbackServiceException;
-
-
-    /**
-     * Assigns the role indicated by the roleId to the given principal
-     *
-     * @param roleId
-     * @param principal
-     * @throws Exception
-     */
-    @Path( "assignRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean assignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
-        throws RedbackServiceException;
-
-    /**
-     * Assigns the role indicated by the roleName to the given principal
-     *
-     * @param roleName
-     * @param principal
-     * @throws Exception
-     */
-    @Path( "assignRoleByName" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean assignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
-        throws RedbackServiceException;
-
-    /**
-     * Assigns the templated role indicated by the templateId
-     * <p/>
-     * fails if the templated role has not been created
-     *
-     * @param templateId
-     * @param resource
-     * @param principal
-     */
-    @Path( "assignTemplatedRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean assignTemplatedRole( @QueryParam( "templateId" ) String templateId,
-                                 @QueryParam( "resource" ) String resource,
-                                 @QueryParam( "principal" ) String principal )
-        throws RedbackServiceException;
-
-    /**
-     * Unassigns the role indicated by the role id from the given principal
-     *
-     * @param roleId
-     * @param principal
-     * @throws Exception
-     */
-    @Path( "unassignRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean unassignRole( @QueryParam( "roleId" ) String roleId, @QueryParam( "principal" ) String principal )
-        throws RedbackServiceException;
-
-    /**
-     * Unassigns the role indicated by the role name from the given principal
-     *
-     * @param roleName
-     * @param principal
-     * @throws Exception
-     */
-    @Path( "unassignRoleByName" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean unassignRoleByName( @QueryParam( "roleName" ) String roleName, @QueryParam( "principal" ) String principal )
-        throws RedbackServiceException;
-
-    /**
-     * true of a role exists with the given roleId
-     *
-     * @param roleId
-     * @return
-     * @throws Exception
-     */
-    @Path( "roleExists" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean roleExists( @QueryParam( "roleId" ) String roleId )
-        throws RedbackServiceException;
-
-    /**
-     * true of a role exists with the given roleId
-     *
-     * @param templateId
-     * @param resource
-     * @return
-     * @throws Exception
-     */
-    @Path( "templatedRoleExists" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean templatedRoleExists( @QueryParam( "templateId" ) String templateId,
-                                 @QueryParam( "resource" ) String resource )
-        throws RedbackServiceException;
-
-
-    /**
-     * Check a role template is complete in the RBAC store.
-     *
-     * @param templateId the templated role
-     * @param resource   the resource to verify
-     * @throws Exception
-     */
-    @Path( "verifyTemplatedRole" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    Boolean verifyTemplatedRole( @QueryParam( "templateId" ) String templateId,
-                                 @QueryParam( "resource" ) String resource )
-        throws RedbackServiceException;
-
-    @Path( "getEffectivelyAssignedRoles/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.4
-     */
-    List<Role> getEffectivelyAssignedRoles( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-
-    @Path( "allRoles" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    List<Role> getAllRoles()
-        throws RedbackServiceException;
-
-    @Path( "detailledAllRoles" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    List<Role> getDetailedAllRoles()
-        throws RedbackServiceException;
-
-
-    @Path( "getApplications/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    List<Application> getApplications( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-
-    @Path( "getRole/{roleName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Role getRole( @PathParam( "roleName" ) String roleName )
-        throws RedbackServiceException;
-
-    @Path( "updateRoleDescription" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Boolean updateRoleDescription( @QueryParam( "roleName" ) String roleName,
-                                   @QueryParam( "roleDescription" ) String description )
-        throws RedbackServiceException;
-
-    @Path( "updateRoleUsers" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * update users assigned to a role
-     * @since 1.5
-     */
-    Boolean updateRoleUsers( Role role )
-        throws RedbackServiceException;
-
-    @Path( "getApplicationRoles/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * @since 1.5
-     */
-    List<ApplicationRoles> getApplicationRoles( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-    @Path( "updateUserRoles" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_RBAC_ADMIN_OPERATION )
-    /**
-     * update roles assigned to a user
-     * @since 1.5
-     */
-    Boolean updateUserRoles( User user )
-        throws RedbackServiceException;
-
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UserService.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UserService.java
deleted file mode 100644 (file)
index b05768f..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.RegistrationKey;
-import org.codehaus.redback.rest.api.model.User;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import java.util.Collection;
-import java.util.List;
-
-@Path( "/userService/" )
-public interface UserService
-{
-    @Path( "getUser/{userName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    User getUser( @PathParam( "userName" ) String username )
-        throws RedbackServiceException;
-
-
-    @Path( "getUsers" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
-    List<User> getUsers()
-        throws RedbackServiceException;
-
-    @Path( "createUser" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_CREATE_OPERATION )
-    Boolean createUser( User user )
-        throws RedbackServiceException;
-
-
-    /**
-     * will create admin user only if not exists !! if exists will return false
-     */
-    @Path( "createAdminUser" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
-    @RedbackAuthorization( noRestriction = true )
-    Boolean createAdminUser( User user )
-        throws RedbackServiceException;
-
-    @Path( "isAdminUserExists" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    Boolean isAdminUserExists()
-        throws RedbackServiceException;
-
-
-    @Path( "deleteUser/{userName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_DELETE_OPERATION )
-    Boolean deleteUser( @PathParam( "userName" ) String username )
-        throws RedbackServiceException;
-
-    @Path( "updateUser" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    Boolean updateUser( User user )
-        throws RedbackServiceException;
-
-    @Path( "lockUser/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Boolean lockUser( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-    @Path( "unlockUser/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Boolean unlockUser( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-
-    @Path( "passwordChangeRequired/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Boolean passwordChangeRequired( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-    @Path( "passwordChangeNotRequired/{username}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    /**
-     * @since 1.5
-     */
-    Boolean passwordChangeNotRequired( @PathParam( "username" ) String username )
-        throws RedbackServiceException;
-
-
-    @Path( "updateMe" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = false, noPermission = true )
-    /**
-     * update only the current user and this fields: fullname, email, password.
-     * the service verify the curent logged user with the one passed in the method
-     * @since 1.4
-     */
-    Boolean updateMe( User user )
-        throws RedbackServiceException;
-
-    @Path( "ping" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    Boolean ping()
-        throws RedbackServiceException;
-
-    @Path( "removeFromCache/{userName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    int removeFromCache( @PathParam( "userName" ) String username )
-        throws RedbackServiceException;
-
-    @Path( "getGuestUser" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    User getGuestUser()
-        throws RedbackServiceException;
-
-    @Path( "createGuestUser" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_EDIT_OPERATION )
-    User createGuestUser()
-        throws RedbackServiceException;
-
-    @Path( "registerUser" )
-    @POST
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * if redback is not configured for email validation is required, -1 is returned as key
-     * @since 1.4
-     */
-    RegistrationKey registerUser( User user )
-        throws RedbackServiceException;
-
-
-    @Path( "validateKey/{key}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * validate the key and the user with forcing a password change for next login.
-     * http session is created.
-     * @param key authentication key
-     * @since 1.4
-     */
-    Boolean validateUserFromKey( @PathParam( "key" ) String key )
-        throws RedbackServiceException;
-
-    @Path( "resetPassword/{user}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     *
-     * @param user username for send a password reset email
-     * @since 1.4
-     */
-    Boolean resetPassword( @PathParam( "user" ) String user )
-        throws RedbackServiceException;
-
-    @Path( "getUserPermissions/{userName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
-    /**
-     * @since 1.4
-     */
-    Collection<Permission> getUserPermissions( @PathParam( "userName" ) String userName )
-        throws RedbackServiceException;
-
-    @Path( "getUserOperations/{userName}" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( permissions = RedbackRoleConstants.USER_MANAGEMENT_USER_LIST_OPERATION )
-    /**
-     * @since 1.4
-     */
-    Collection<Operation> getUserOperations( @PathParam( "userName" ) String userName )
-        throws RedbackServiceException;
-
-    @Path( "getCurrentUserPermissions" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * return the current logged user permissions, if no logged user guest permissions are returned
-     * @since 1.4
-     */
-    Collection<Permission> getCurrentUserPermissions()
-        throws RedbackServiceException;
-
-    @Path( "getCurrentUserOperations" )
-    @GET
-    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true, noPermission = true )
-    /**
-     * return the current logged user operations, if no logged user guest operations are returned
-     * @since 1.4
-     */
-    Collection<Operation> getCurrentUserOperations()
-        throws RedbackServiceException;
-
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UtilServices.java b/redback-integrations/redback-rest/redback-rest-api/src/main/java/org/codehaus/redback/rest/api/services/UtilServices.java
deleted file mode 100644 (file)
index 22936e1..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.codehaus.redback.rest.api.services;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.archiva.redback.authorization.RedbackAuthorization;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 1.4
- */
-@Path( "/utilServices/" )
-public interface UtilServices
-{
-
-    @Path( "getBundleResources" )
-    @GET
-    @Produces( { MediaType.TEXT_PLAIN } )
-    @RedbackAuthorization( noRestriction = true )
-    String getI18nResources( @QueryParam( "locale" ) String locale )
-        throws RedbackServiceException;
-
-    /**
-     * <b>not intended to be exposed as a REST service.</b>
-     * will load i18N resource org/codehaus/plexus/redback/users/messages in default en then in the asked locale.
-     * @param locale
-     * @return
-     * @throws RedbackServiceException
-     */
-    Properties getI18nProperties( String locale )
-        throws RedbackServiceException;
-
-
-}
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/apache/archiva/redback/rest/api/RedbackRestModel.gwt.xml b/redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/apache/archiva/redback/rest/api/RedbackRestModel.gwt.xml
new file mode 100644 (file)
index 0000000..aacb3b8
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you 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.
+  -->
+<module>
+  <source path="model" />
+</module>
\ No newline at end of file
diff --git a/redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/codehaus/redback/rest/api/RedbackRestModel.gwt.xml b/redback-integrations/redback-rest/redback-rest-api/src/main/resources/org/codehaus/redback/rest/api/RedbackRestModel.gwt.xml
deleted file mode 100644 (file)
index aacb3b8..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements.  See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership.  The ASF licenses this file
-  ~ to you 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.
-  -->
-<module>
-  <source path="model" />
-</module>
\ No newline at end of file
index 02a67cb1b9291b447ccdef7fce417cce28d075a8..f361d54f4a9ce6ea2a28b25b4e02987f5235f87b 100644 (file)
@@ -31,9 +31,9 @@ import org.apache.archiva.redback.keys.memory.MemoryKeyManager;
 import org.apache.archiva.redback.system.SecuritySession;
 import org.apache.archiva.redback.system.SecuritySystem;
 import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.LoginService;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.LoginService;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
index 9dbc7fe66ee66d0d83376bf35e27d5e9e8912769..0ad7c177c98f49cf12d4fea641c013010201bd8b 100644 (file)
@@ -28,9 +28,9 @@ import org.apache.archiva.redback.keys.KeyManagerException;
 import org.apache.archiva.redback.system.SecuritySystem;
 import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.services.PasswordService;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.services.PasswordService;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
 import org.codehaus.redback.rest.services.utils.PasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -74,7 +74,7 @@ public class DefaultPasswordService
         this.passwordValidator = passwordValidator;
     }
 
-    public org.codehaus.redback.rest.api.model.User changePasswordWithKey( String password, String passwordConfirmation,
+    public org.apache.archiva.redback.rest.api.model.User changePasswordWithKey( String password, String passwordConfirmation,
                                                                            String key )
         throws RedbackServiceException
     {
@@ -112,7 +112,7 @@ public class DefaultPasswordService
             user.setEncodedPassword( encodedPassword );
             user = securitySystem.getUserManager().updateUser( user );
 
-            return new org.codehaus.redback.rest.api.model.User( user );
+            return new org.apache.archiva.redback.rest.api.model.User( user );
 
         }
         catch ( KeyManagerException e )
@@ -146,7 +146,7 @@ public class DefaultPasswordService
 
     }
 
-    public org.codehaus.redback.rest.api.model.User changePassword( String userName, String previousPassword,
+    public org.apache.archiva.redback.rest.api.model.User changePassword( String userName, String previousPassword,
                                                                     String password, String passwordConfirmation )
         throws RedbackServiceException
     {
@@ -196,7 +196,7 @@ public class DefaultPasswordService
             u.setPassword( password );
 
             u = securitySystem.getUserManager().updateUser( u );
-            return new org.codehaus.redback.rest.api.model.User( u );
+            return new org.apache.archiva.redback.rest.api.model.User( u );
         }
         catch ( UserNotFoundException e )
         {
index e75cc9d12240045875c9b72d8ccffffcd48d6bcc..1166d8ad66bbe657d671110e738ea85adc412ec3 100644 (file)
@@ -35,13 +35,13 @@ import org.codehaus.plexus.redback.role.model.ModelTemplate;
 import org.apache.archiva.redback.integration.model.AdminEditUserCredentials;
 import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
 import org.apache.archiva.redback.integration.util.RoleSorter;
-import org.codehaus.redback.rest.api.model.Application;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.RoleTemplate;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.model.Application;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.RoleTemplate;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -384,7 +384,7 @@ public class DefaultRoleManagementService
                     try
                     {
                         User user = userManager.findUser( userAssignment.getPrincipal() );
-                        role.getUsers().add( new org.codehaus.redback.rest.api.model.User( user ) );
+                        role.getUsers().add( new org.apache.archiva.redback.rest.api.model.User( user ) );
                     }
                     catch ( UserNotFoundException e )
                     {
@@ -404,7 +404,7 @@ public class DefaultRoleManagementService
                         try
                         {
                             User user = userManager.findUser( userAssignment.getPrincipal() );
-                            role.getParentsRolesUsers().add( new org.codehaus.redback.rest.api.model.User( user ) );
+                            role.getParentsRolesUsers().add( new org.apache.archiva.redback.rest.api.model.User( user ) );
                         }
                         catch ( UserNotFoundException e )
                         {
@@ -414,11 +414,12 @@ public class DefaultRoleManagementService
                 }
             }
 
-            List<org.codehaus.redback.rest.api.model.User> otherUsers =
-                new ArrayList<org.codehaus.redback.rest.api.model.User>();
+            List<org.apache.archiva.redback.rest.api.model.User> otherUsers =
+                new ArrayList<org.apache.archiva.redback.rest.api.model.User>();
             for ( User u : userManager.getUsers() )
             {
-                org.codehaus.redback.rest.api.model.User user = new org.codehaus.redback.rest.api.model.User( u );
+                org.apache.archiva.redback.rest.api.model.User
+                    user = new org.apache.archiva.redback.rest.api.model.User( u );
                 if ( role.getParentsRolesUsers().contains( user ) )
                 {
                     continue;
@@ -460,7 +461,7 @@ public class DefaultRoleManagementService
         throws RedbackServiceException
     {
 
-        for ( org.codehaus.redback.rest.api.model.User user : role.getUsers() )
+        for ( org.apache.archiva.redback.rest.api.model.User user : role.getUsers() )
         {
             String username = user.getUsername();
             if ( !userManager.userExists( username ) )
@@ -494,7 +495,7 @@ public class DefaultRoleManagementService
             }
         }
 
-        for ( org.codehaus.redback.rest.api.model.User user : role.getRemovedUsers() )
+        for ( org.apache.archiva.redback.rest.api.model.User user : role.getRemovedUsers() )
         {
             String username = user.getUsername();
             if ( !userManager.userExists( username ) )
@@ -623,7 +624,7 @@ public class DefaultRoleManagementService
         }
     }
 
-    public Boolean updateUserRoles( org.codehaus.redback.rest.api.model.User user )
+    public Boolean updateUserRoles( org.apache.archiva.redback.rest.api.model.User user )
         throws RedbackServiceException
     {
 
index 84259be0b3250bfcab3dad56d2393d17abdd5126..a772d3f49d0b4fbfe0c497018ebf2a30d2c4b1f5 100644 (file)
@@ -45,14 +45,14 @@ import org.apache.archiva.redback.system.SecuritySystem;
 import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
 import org.apache.archiva.redback.integration.mail.Mailer;
 import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.RegistrationKey;
-import org.codehaus.redback.rest.api.model.Resource;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.RegistrationKey;
+import org.apache.archiva.redback.rest.api.model.Resource;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.UserService;
 import org.codehaus.redback.rest.services.utils.PasswordValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 03e7f7d433dfcc23a50627d84121e3aa31e5f24e..8d8d48ed792f685e48e366f89b3e4d843bdbca79 100644 (file)
@@ -20,8 +20,8 @@ package org.codehaus.redback.rest.services;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
-import org.codehaus.redback.rest.api.services.UtilServices;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.services.UtilServices;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
index 2ed143e5dce83c662804376c61ab2dd933be66ba..af0c8413117f550449c86efff4a859ccb82bc53c 100644 (file)
@@ -20,8 +20,8 @@ package org.codehaus.redback.rest.services.interceptors;
 
 import org.apache.archiva.redback.policy.PasswordRuleViolationException;
 import org.apache.archiva.redback.policy.PasswordRuleViolations;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.RedbackRestError;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.model.RedbackRestError;
 import org.springframework.stereotype.Service;
 
 import javax.ws.rs.core.Response;
index a07d11a1f93975674061d5f898e0763bff49531a..a3e9f0f43305cf2d7696ae722c385fba76ed1cbd 100644 (file)
@@ -18,9 +18,8 @@ package org.codehaus.redback.rest.services.interceptors;
  * under the License.
  */
 
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.model.RedbackRestError;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.RedbackRestError;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
 import org.springframework.stereotype.Service;
 
 import javax.ws.rs.core.Response;
index eec71efdbfae71fb10bd626823d382bbf4c23e3a..47c122a64af1ec3dd8b0e215edf9be79b1e15bc2 100644 (file)
@@ -24,8 +24,8 @@ import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.redback.policy.PasswordEncoder;
 import org.apache.archiva.redback.policy.PasswordRuleViolationException;
 import org.apache.archiva.redback.system.SecuritySystem;
-import org.codehaus.redback.rest.api.model.ErrorMessage;
-import org.codehaus.redback.rest.api.services.RedbackServiceException;
+import org.apache.archiva.redback.rest.api.model.ErrorMessage;
+import org.apache.archiva.redback.rest.api.services.RedbackServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
index ce203475905eadee1ed2401eea878d23b835d3c2..99db57bac0af4e0f407aefeee90373047c0628ef 100644 (file)
@@ -27,10 +27,10 @@ import org.apache.cxf.jaxrs.client.WebClient;
 import org.apache.cxf.transport.servlet.CXFServlet;
 import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
 import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.LoginService;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.LoginService;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.services.UserService;
 import org.eclipse.jetty.server.Connector;
 import org.eclipse.jetty.server.Server;
 import org.eclipse.jetty.server.session.SessionHandler;
index 460b351c90ca5825224e14e061680bd1c722e8bf..78a369a0b945336b23cd6244464f1dfbf2ac81e3 100644 (file)
@@ -23,7 +23,7 @@ import org.apache.archiva.redback.rbac.RBACManager;
 import org.apache.archiva.redback.users.UserManager;
 import org.apache.archiva.redback.configuration.UserConfiguration;
 import org.apache.archiva.redback.role.RoleManager;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.services.UserService;
 
 import javax.inject.Inject;
 import javax.inject.Named;
index 436475743d694794e2d3d4e8452bf0ef5ef07a70..f225b4e3d8408411a684cc612db9ab96b4a1daa0 100644 (file)
@@ -19,8 +19,8 @@ package org.codehaus.redback.rest.services;
  */
 
 import org.apache.archiva.redback.integration.security.role.RedbackRoleConstants;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.UserService;
 import org.junit.Test;
 
 /**
index a7c53db236bbed7c4329684e9676269dcee63437..9cbaac5a719c0cb3f8a20f7706a1e270fd5c2c89 100644 (file)
@@ -20,11 +20,11 @@ package org.codehaus.redback.rest.services;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
-import org.codehaus.redback.rest.api.model.ApplicationRoles;
-import org.codehaus.redback.rest.api.model.Role;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.RoleManagementService;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.ApplicationRoles;
+import org.apache.archiva.redback.rest.api.model.Role;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.RoleManagementService;
+import org.apache.archiva.redback.rest.api.services.UserService;
 import org.junit.Test;
 
 import java.util.Arrays;
index 6d8f8fe19c80fae48066eb2213c63b5373ba54bc..df85d48e44bca18d5e7e3b0975f32416caf0e772 100644 (file)
@@ -23,10 +23,10 @@ import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 import org.apache.cxf.jaxrs.client.ServerWebApplicationException;
 import org.apache.cxf.jaxrs.client.WebClient;
 import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
-import org.codehaus.redback.rest.api.model.Operation;
-import org.codehaus.redback.rest.api.model.Permission;
-import org.codehaus.redback.rest.api.model.User;
-import org.codehaus.redback.rest.api.services.UserService;
+import org.apache.archiva.redback.rest.api.model.Operation;
+import org.apache.archiva.redback.rest.api.model.Permission;
+import org.apache.archiva.redback.rest.api.model.User;
+import org.apache.archiva.redback.rest.api.services.UserService;
 import org.codehaus.redback.rest.services.mock.EmailMessage;
 import org.codehaus.redback.rest.services.mock.ServicesAssert;
 import org.junit.Test;