mirror of https://github.com/apache/archiva.git
reload rbac manager if changed
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1448448 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
229a411720
commit
cf74f4eee2
|
@ -58,7 +58,7 @@ import java.util.Properties;
|
|||
* @author Olivier Lamy
|
||||
* @since 1.4-M4
|
||||
*/
|
||||
@Service("redbackRuntimeConfigurationService#rest")
|
||||
@Service( "redbackRuntimeConfigurationService#rest" )
|
||||
public class DefaultRedbackRuntimeConfigurationService
|
||||
extends AbstractRestService
|
||||
implements RedbackRuntimeConfigurationService
|
||||
|
@ -67,18 +67,22 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
private RedbackRuntimeConfigurationAdmin redbackRuntimeConfigurationAdmin;
|
||||
|
||||
@Inject
|
||||
@Named(value = "userManager#configurable")
|
||||
@Named( value = "userManager#configurable" )
|
||||
private UserManager userManager;
|
||||
|
||||
@Inject
|
||||
@Named( value = "rbacManager#default" )
|
||||
private RBACManager rbacManager;
|
||||
|
||||
@Inject
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Inject
|
||||
@Named(value = "ldapConnectionFactory#configurable")
|
||||
@Named( value = "ldapConnectionFactory#configurable" )
|
||||
private LdapConnectionFactory ldapConnectionFactory;
|
||||
|
||||
@Inject
|
||||
@Named(value = "cache#users")
|
||||
@Named( value = "cache#users" )
|
||||
private Cache usersCache;
|
||||
|
||||
@Inject
|
||||
|
@ -111,6 +115,13 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
userManagerChanged || ( redbackRuntimeConfiguration.getUserManagerImpls().toString().hashCode()
|
||||
!= redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getUserManagerImpls().toString().hashCode() );
|
||||
|
||||
boolean rbacManagerChanged = redbackRuntimeConfiguration.getRbacManagerImpls().size()
|
||||
!= redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getRbacManagerImpls().size();
|
||||
|
||||
rbacManagerChanged =
|
||||
rbacManagerChanged || ( redbackRuntimeConfiguration.getRbacManagerImpls().toString().hashCode()
|
||||
!= redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getRbacManagerImpls().toString().hashCode() );
|
||||
|
||||
redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
|
||||
if ( userManagerChanged )
|
||||
|
@ -120,6 +131,13 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
userManager.initialize();
|
||||
}
|
||||
|
||||
if ( rbacManagerChanged )
|
||||
{
|
||||
log.info( "rbac manager changed to {} so reload it",
|
||||
redbackRuntimeConfiguration.getRbacManagerImpls() );
|
||||
rbacManager.initialize();
|
||||
}
|
||||
|
||||
ldapConnectionFactory.initialize();
|
||||
|
||||
Collection<PasswordRule> passwordRules = applicationContext.getBeansOfType( PasswordRule.class ).values();
|
||||
|
@ -233,7 +251,7 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
throws ArchivaRestServiceException
|
||||
{
|
||||
return new RedbackImplementationsInformations( getUserManagerImplementationInformations(),
|
||||
getRbacManagerImplementationInformations() );
|
||||
getRbacManagerImplementationInformations() );
|
||||
}
|
||||
|
||||
public Boolean checkLdapConnection()
|
||||
|
|
Loading…
Reference in New Issue