]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1714] using LDAP can be configurable with the ui
authorOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 16:32:46 +0000 (16:32 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 23 Nov 2012 16:32:46 +0000 (16:32 +0000)
add a new  userManager configured by archiva.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1412946 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaRuntimeConfigurationService.java
archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/WEB-INF/applicationContext.xml

index 7faae9e230db905810c0ef80c4dc7cd8d71e0cf7..e8727f87bcc89f4432cf5e71c3c0e778e9fd9168 100644 (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 )
index ea18caee1c10c25444fde2e1498773e511b3a331..4df10a85b4c8c6b6901c0d7286dbfbbe323c0b5f 100755 (executable)
@@ -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" />
 
index 9a123e45eccbca3234e8eb3a260f4cb1448d0d4d..ff6da7f43f73a79400192bb31c08c661ef49cd38 100644 (file)
     </property>
   </bean>
   
-
+  <alias name="userManager#archiva" alias="userManager#configurable"/>
     
     <!-- <component>
       <role>org.apache.archiva.webdav.util.MimeTypes</role>