implements those methods with ldap call
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1436466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aa0cbd265e
commit
bdb8a22269
|
@ -982,22 +982,46 @@ public class LdapRbacManager
|
|||
closeContext( context );
|
||||
closeLdapConnection( ldapConnection );
|
||||
}
|
||||
|
||||
//this.rbacImpl.saveUserAssignment( userAssignment );
|
||||
|
||||
//return userAssignment;
|
||||
}
|
||||
|
||||
public boolean userAssignmentExists( String principal )
|
||||
{
|
||||
// TODO here
|
||||
return this.rbacImpl.userAssignmentExists( principal );
|
||||
LdapConnection ldapConnection = null;
|
||||
DirContext context = null;
|
||||
try
|
||||
{
|
||||
ldapConnection = ldapConnectionFactory.getConnection();
|
||||
context = ldapConnection.getDirContext();
|
||||
List<String> roles = ldapRoleMapper.getRoles( principal, context );
|
||||
if ( roles == null || roles.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch ( LdapException e )
|
||||
{
|
||||
log.warn( "fail to call userAssignmentExists: {}", e.getMessage() );
|
||||
}
|
||||
catch ( MappingException e )
|
||||
{
|
||||
log.warn( "fail to call userAssignmentExists: {}", e.getMessage() );
|
||||
}
|
||||
finally
|
||||
{
|
||||
closeContext( context );
|
||||
closeLdapConnection( ldapConnection );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean userAssignmentExists( UserAssignment assignment )
|
||||
{
|
||||
// TODO here
|
||||
return this.rbacImpl.userAssignmentExists( assignment );
|
||||
if ( assignment == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return this.userAssignmentExists( assignment.getPrincipal() );
|
||||
}
|
||||
|
||||
public RBACManager getRbacImpl()
|
||||
|
|
Loading…
Reference in New Issue