honor useDefaultRoleName when searching all roles/groups from ldap

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1437805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-23 23:51:43 +00:00
parent 54c5daeba3
commit e8c9121897
3 changed files with 31 additions and 0 deletions

View File

@ -813,4 +813,14 @@ public class DefaultLdapRoleMapper
{
this.userIdAttribute = userIdAttribute;
}
public boolean isUseDefaultRoleName()
{
return useDefaultRoleName;
}
public void setUseDefaultRoleName( boolean useDefaultRoleName )
{
this.useDefaultRoleName = useDefaultRoleName;
}
}

View File

@ -148,4 +148,6 @@ public interface LdapRoleMapper
String getUserIdAttribute();
boolean isUseDefaultRoleName();
}

View File

@ -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;