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:
parent
e8c9121897
commit
0392abb261
|
@ -364,32 +364,15 @@ public class LdapRbacManager
|
|||
{
|
||||
for ( String roleName : roleNames )
|
||||
{
|
||||
Role role = this.rbacImpl.getRole( roleName );
|
||||
role = ( role == null ) ? new RoleImpl( roleName ) : role;
|
||||
if ( role != null )
|
||||
{
|
||||
rolesCache.put( role.getName(), role );
|
||||
roles.add( role );
|
||||
}
|
||||
Role role = buildRole( roleName );
|
||||
roles.add( role );
|
||||
}
|
||||
}
|
||||
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 );
|
||||
}
|
||||
Role role = buildRole( group );
|
||||
roles.add( role );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -397,6 +380,27 @@ public class LdapRbacManager
|
|||
|
||||
}
|
||||
|
||||
private Role buildRole( String group )
|
||||
throws RbacManagerException
|
||||
{
|
||||
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 );
|
||||
|
||||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
protected List<String> getRealRoles()
|
||||
throws RbacManagerException
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue