[MRM-1714] using LDAP can be configurable with the ui

add a new  userManager configured by archiva.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412946 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-23 16:32:46 +00:00
parent 835f13d0be
commit e6ddd34c22
3 changed files with 21 additions and 3 deletions

View File

@ -21,17 +21,20 @@ package org.apache.archiva.rest.services;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
import org.apache.archiva.redback.users.UserManager;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import javax.inject.Named;
/**
* @author Olivier Lamy
* @since 1.4-M4
*/
@Service ( "archivaRuntimeConfigurationService#rest" )
@Service ("archivaRuntimeConfigurationService#rest")
public class DefaultArchivaRuntimeConfigurationService
extends AbstractRestService
implements ArchivaRuntimeConfigurationService
@ -39,6 +42,10 @@ public class DefaultArchivaRuntimeConfigurationService
@Inject
private ArchivaRuntimeConfigurationAdmin archivaRuntimeConfigurationAdmin;
@Inject
@Named ( value = "userManager#archiva" )
private UserManager userManager;
public ArchivaRuntimeConfiguration getArchivaRuntimeConfigurationAdmin()
throws ArchivaRestServiceException
{
@ -57,7 +64,18 @@ public class DefaultArchivaRuntimeConfigurationService
{
try
{
// has user manager impl changed ?
boolean userManagerChanged = !StringUtils.equals( archivaRuntimeConfiguration.getUserManagerImpl(),
archivaRuntimeConfigurationAdmin.getArchivaRuntimeConfigurationAdmin().getUserManagerImpl() );
archivaRuntimeConfigurationAdmin.updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
if ( userManagerChanged )
{
log.info( "user manager impl changed to {} reload it",
archivaRuntimeConfiguration.getUserManagerImpl() );
userManager.initialize();
}
return Boolean.TRUE;
}
catch ( RepositoryAdminException e )

View File

@ -34,7 +34,7 @@
default-lazy-init="true">
<context:annotation-config/>
<context:component-scan base-package="org.apache.archiva.web.spring, org.apache.archiva.web.startup, org.apache.archiva.web.runtime, org.apache.archiva.web.api"/>
<context:component-scan base-package="org.apache.archiva.web.spring, org.apache.archiva.web.startup, org.apache.archiva.web.runtime, org.apache.archiva.web.api,, org.apache.archiva.web.security"/>
<util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />

View File

@ -136,7 +136,7 @@
</property>
</bean>
<alias name="userManager#archiva" alias="userManager#configurable"/>
<!-- <component>
<role>org.apache.archiva.webdav.util.MimeTypes</role>