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 a379a949..5cfc431d 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 @@ -813,4 +813,14 @@ public class DefaultLdapRoleMapper { this.userIdAttribute = userIdAttribute; } + + public boolean isUseDefaultRoleName() + { + return useDefaultRoleName; + } + + public void setUseDefaultRoleName( boolean useDefaultRoleName ) + { + this.useDefaultRoleName = useDefaultRoleName; + } } diff --git a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapper.java b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapper.java index 7111c4b0..40b95377 100644 --- a/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapper.java +++ b/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/role/LdapRoleMapper.java @@ -148,4 +148,6 @@ public interface LdapRoleMapper String getUserIdAttribute(); + boolean isUseDefaultRoleName(); + } diff --git a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java index 462a53d7..868df6cd 100644 --- a/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java +++ b/redback-rbac/redback-rbac-providers/redback-rbac-ldap/src/main/java/org/apache/archiva/redback/rbac/ldap/LdapRbacManager.java @@ -373,6 +373,25 @@ public class LdapRbacManager } } } + else if ( this.ldapRoleMapper.isUseDefaultRoleName() ) + { + Role role = null; + try + { + role = this.rbacImpl.getRole( group ); + } + catch ( RbacObjectNotFoundException e ) + { + // if it's mapped role to a group it doesn't exist in jdo + } + role = ( role == null ) ? new RoleImpl( group ) : role; + if ( role != null ) + { + rolesCache.put( role.getName(), role ); + roles.add( role ); + } + + } } return roles;