diff --git a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java index a21f093a..e426859a 100644 --- a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java +++ b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/DefaultLdapRoleMapper.java @@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.inject.Inject; import javax.inject.Named; +import javax.naming.NameAlreadyBoundException; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; @@ -482,6 +483,11 @@ public class DefaultLdapRoleMapper throws MappingException { + if ( hasRole( context, roleName ) ) + { + return true; + } + String groupName = findGroupName( roleName ); if ( groupName == null ) @@ -527,6 +533,11 @@ public class DefaultLdapRoleMapper return true; } + catch ( NameAlreadyBoundException e ) + { + log.info( "skip group '{}' creation as already exists", groupName ); + return true; + } catch ( LdapException e ) { throw new MappingException( e.getMessage(), e );