--- /dev/null
+package org.apache.archiva.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.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M4
+ */
+@XmlRootElement( name = "redbackImplementationInformations" )
+public class RedbackImplementationInformations
+{
+ private List<UserManagerImplementationInformation> userManagerImplementationInformations;
+
+ private List<RBACManagerImplementationInformation> rbacManagerImplementationInformations;
+
+ public RedbackImplementationInformations()
+ {
+ // no op
+ }
+
+ public RedbackImplementationInformations(
+ List<UserManagerImplementationInformation> userManagerImplementationInformations,
+ List<RBACManagerImplementationInformation> rbacManagerImplementationInformations )
+ {
+ this.userManagerImplementationInformations = userManagerImplementationInformations;
+ this.rbacManagerImplementationInformations = rbacManagerImplementationInformations;
+ }
+
+ public List<UserManagerImplementationInformation> getUserManagerImplementationInformations()
+ {
+ return userManagerImplementationInformations;
+ }
+
+ public void setUserManagerImplementationInformations(
+ List<UserManagerImplementationInformation> userManagerImplementationInformations )
+ {
+ this.userManagerImplementationInformations = userManagerImplementationInformations;
+ }
+
+ public List<RBACManagerImplementationInformation> getRbacManagerImplementationInformations()
+ {
+ return rbacManagerImplementationInformations;
+ }
+
+ public void setRbacManagerImplementationInformations(
+ List<RBACManagerImplementationInformation> rbacManagerImplementationInformations )
+ {
+ this.rbacManagerImplementationInformations = rbacManagerImplementationInformations;
+ }
+}
import org.apache.archiva.admin.model.beans.LdapConfiguration;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
+import org.apache.archiva.rest.api.model.RedbackImplementationInformations;
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
import org.apache.archiva.security.common.ArchivaRoleConstants;
throws ArchivaRestServiceException;
+ @Path("redbackImplementationInformations")
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
+ RedbackImplementationInformations getRedbackImplementationInformations()
+ throws ArchivaRestServiceException;
+
@Path( "checkLdapConnection" )
@GET
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
Boolean checkLdapConnection()
throws ArchivaRestServiceException;
- @Path( "checkLdapConnection" )
+ @Path("checkLdapConnection")
@POST
- @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @Consumes( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
- @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
+ @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
Boolean checkLdapConnection( LdapConfiguration ldapConfiguration )
throws ArchivaRestServiceException;
}
import org.apache.archiva.redback.rbac.RBACManager;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
+import org.apache.archiva.rest.api.model.RedbackImplementationInformations;
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RedbackRuntimeConfigurationService;
return informations;
}
+ public RedbackImplementationInformations getRedbackImplementationInformations()
+ throws ArchivaRestServiceException
+ {
+ return new RedbackImplementationInformations( getUserManagerImplementationInformations(),
+ getRbacManagerImplementationInformations() );
+ }
+
public Boolean checkLdapConnection()
throws ArchivaRestServiceException
{
var mainContent = $("#main-content");
mainContent.html(mediumSpinnerImg());
- $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/userManagerImplementationInformations", {
+ $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackImplementationInformations", {
type: "GET",
dataType: 'json',
success: function(data) {
- var userManagerImplementationInformations=mapManagerImplementationInformations(data);
- $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackRuntimeConfiguration", {
- type: "GET",
- dataType: 'json',
- success: function(data) {
- var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
- var redbackRuntimeConfigurationViewModel =
- new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
-
- var groups=[];
- var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.usedUserManagerImpls)>0
- ||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls)>0;
- $.log("useLdap:"+useLdap);
- if(useLdap){
- // load ldap roles
- $.ajax("restServices/redbackServices/ldapGroupMappingService/ldapGroups", {
- type: "GET",
- dataType: 'json',
- success: function(data){
- groups = mapStringList(data);
- $.log("groups number:"+groups.length);
- redbackRuntimeConfiguration.ldapGroups=ko.observableArray(groups);
- }
- } )
- .always(
- function() {
- $.log("complete");
-
- // load ldap group mappings if any
- $.ajax("restServices/redbackServices/ldapGroupMappingService", {
- type: "GET",
- dataType: 'json',
- success: function(data) {
- var groupMappings=mapLdapGroupMappings(data,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping);
-
- $.ajax("restServices/redbackServices/roleManagementService/allRoles", {
- type: "GET",
- dataType: 'json',
- success: function(data) {
- displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,data,groupMappings,groups);
- }
- });
- }
- });
- }
- );
- } else {
- displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,null,null);
+ var userManagerImplementationInformations=data?mapManagerImplementationInformations(data.userManagerImplementationInformations):[];
+ $.ajax("restServices/archivaServices/redbackRuntimeConfigurationService/redbackRuntimeConfiguration", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
+ var redbackRuntimeConfigurationViewModel =
+ new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
+
+ var groups=[];
+ var useLdap = $.inArray("ldap",redbackRuntimeConfiguration.usedUserManagerImpls)>0
+ ||$.inArray("ldap",redbackRuntimeConfiguration.rbacManagerImpls)>0;
+ $.log("useLdap:"+useLdap);
+ if(useLdap){
+ // load ldap roles
+ $.ajax("restServices/redbackServices/ldapGroupMappingService/ldapGroups", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data){
+ groups = mapStringList(data);
+ $.log("groups number:"+groups.length);
+ redbackRuntimeConfiguration.ldapGroups=ko.observableArray(groups);
+ }
+ } )
+ .always(
+ function() {
+ $.log("complete");
+
+ // load ldap group mappings if any
+ $.ajax("restServices/redbackServices/ldapGroupMappingService", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ var groupMappings=mapLdapGroupMappings(data,redbackRuntimeConfigurationViewModel.modifyLdapGroupMapping);
+
+ $.ajax("restServices/redbackServices/roleManagementService/allRoles", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,data,groupMappings,groups);
+ }
+ });
+ }
+ });
+ }
+ );
+ } else {
+ displayRuntimeConfigurationScreen(redbackRuntimeConfigurationViewModel,null,null);
+ }
}
- }
- });
+ });
}
});