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:
Olivier Lamy 2013-02-20 22:39:53 +00:00
parent 229a411720
commit cf74f4eee2
1 changed files with 23 additions and 5 deletions

View File

@ -70,6 +70,10 @@ public class DefaultRedbackRuntimeConfigurationService
@Named( value = "userManager#configurable" )
private UserManager userManager;
@Inject
@Named( value = "rbacManager#default" )
private RBACManager rbacManager;
@Inject
private ApplicationContext applicationContext;
@ -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();