remove duplicate code

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1437806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-23 23:51:59 +00:00
parent e8c9121897
commit 0392abb261
1 changed files with 26 additions and 22 deletions

View File

@ -364,16 +364,24 @@ public class LdapRbacManager
{ {
for ( String roleName : roleNames ) for ( String roleName : roleNames )
{ {
Role role = this.rbacImpl.getRole( roleName ); Role role = buildRole( roleName );
role = ( role == null ) ? new RoleImpl( roleName ) : role;
if ( role != null )
{
rolesCache.put( role.getName(), role );
roles.add( role ); roles.add( role );
} }
} }
}
else if ( this.ldapRoleMapper.isUseDefaultRoleName() ) else if ( this.ldapRoleMapper.isUseDefaultRoleName() )
{
Role role = buildRole( group );
roles.add( role );
}
}
return roles;
}
private Role buildRole( String group )
throws RbacManagerException
{ {
Role role = null; Role role = null;
try try
@ -388,13 +396,9 @@ public class LdapRbacManager
if ( role != null ) if ( role != null )
{ {
rolesCache.put( role.getName(), role ); rolesCache.put( role.getName(), role );
roles.add( role );
}
} }
} return role;
return roles;
} }
protected List<String> getRealRoles() protected List<String> getRealRoles()