fix dynamic usage of rbac manager impl

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1434422 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-16 21:48:35 +00:00
parent 4784a08976
commit 6c05482be3
2 changed files with 12 additions and 24 deletions

View File

@ -42,7 +42,7 @@ public class RedbackRuntimeConfiguration
/** /**
* Field rbacManagerImpls. * Field rbacManagerImpls.
*/ */
private java.util.List<String> rbacManagerImpls; private java.util.List<String> rbacManagerImpls = new ArrayList<String>();
private LdapConfiguration ldapConfiguration; private LdapConfiguration ldapConfiguration;

View File

@ -49,7 +49,7 @@ import java.util.Set;
* @author Olivier Lamy * @author Olivier Lamy
* @since 1.4-M4 * @since 1.4-M4
*/ */
@Service("userConfiguration#archiva") @Service( "userConfiguration#archiva" )
public class DefaultRedbackRuntimeConfigurationAdmin public class DefaultRedbackRuntimeConfigurationAdmin
implements RedbackRuntimeConfigurationAdmin, UserConfiguration implements RedbackRuntimeConfigurationAdmin, UserConfiguration
{ {
@ -60,11 +60,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
private ArchivaConfiguration archivaConfiguration; private ArchivaConfiguration archivaConfiguration;
@Inject @Inject
@Named(value = "userConfiguration#redback") @Named( value = "userConfiguration#redback" )
UserConfiguration userConfiguration; UserConfiguration userConfiguration;
@Inject @Inject
@Named(value = "cache#users") @Named( value = "cache#users" )
private Cache usersCache; private Cache usersCache;
@PostConstruct @PostConstruct
@ -77,12 +77,12 @@ public class DefaultRedbackRuntimeConfigurationAdmin
// migrate or not data from redback // migrate or not data from redback
if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() ) if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
{ {
// not migrated so build a new fresh one
redbackRuntimeConfiguration = new RedbackRuntimeConfiguration();
// so migrate if available // so migrate if available
String userManagerImpl = String userManagerImpl =
userConfiguration.getConcatenatedList( UserConfigurationKeys.USER_MANAGER_IMPL, "jdo" ); userConfiguration.getConcatenatedList( UserConfigurationKeys.USER_MANAGER_IMPL, "jdo" );
if ( StringUtils.isNotEmpty( userManagerImpl ) ) if ( StringUtils.isNotEmpty( userManagerImpl ) )
{
if ( StringUtils.contains( userManagerImpl, ',' ) )
{ {
String[] impls = StringUtils.split( userManagerImpl, ',' ); String[] impls = StringUtils.split( userManagerImpl, ',' );
for ( String impl : impls ) for ( String impl : impls )
@ -90,18 +90,11 @@ public class DefaultRedbackRuntimeConfigurationAdmin
redbackRuntimeConfiguration.getUserManagerImpls().add( impl ); redbackRuntimeConfiguration.getUserManagerImpls().add( impl );
} }
} }
else
{
redbackRuntimeConfiguration.getUserManagerImpls().add( userManagerImpl );
}
}
String rbacManagerImpls = String rbacManagerImpls =
userConfiguration.getConcatenatedList( UserConfigurationKeys.RBAC_MANAGER_IMPL, "cached" ); userConfiguration.getConcatenatedList( UserConfigurationKeys.RBAC_MANAGER_IMPL, "cached" );
if ( StringUtils.isNotEmpty( rbacManagerImpls ) ) if ( StringUtils.isNotEmpty( rbacManagerImpls ) )
{
if ( StringUtils.contains( rbacManagerImpls, ',' ) )
{ {
String[] impls = StringUtils.split( rbacManagerImpls, ',' ); String[] impls = StringUtils.split( rbacManagerImpls, ',' );
for ( String impl : impls ) for ( String impl : impls )
@ -109,11 +102,6 @@ public class DefaultRedbackRuntimeConfigurationAdmin
redbackRuntimeConfiguration.getRbacManagerImpls().add( impl ); redbackRuntimeConfiguration.getRbacManagerImpls().add( impl );
} }
} }
else
{
redbackRuntimeConfiguration.getRbacManagerImpls().add( userManagerImpl );
}
}
// now ldap // now ldap