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 );
|
closeContext( context );
|
||||||
closeLdapConnection( ldapConnection );
|
closeLdapConnection( ldapConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.rbacImpl.saveUserAssignment( userAssignment );
|
|
||||||
|
|
||||||
//return userAssignment;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean userAssignmentExists( String principal )
|
public boolean userAssignmentExists( String principal )
|
||||||
{
|
{
|
||||||
// TODO here
|
LdapConnection ldapConnection = null;
|
||||||
return this.rbacImpl.userAssignmentExists( principal );
|
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 )
|
public boolean userAssignmentExists( UserAssignment assignment )
|
||||||
{
|
{
|
||||||
// TODO here
|
if ( assignment == null )
|
||||||
return this.rbacImpl.userAssignmentExists( assignment );
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.userAssignmentExists( assignment.getPrincipal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public RBACManager getRbacImpl()
|
public RBACManager getRbacImpl()
|
||||||
|
|
Loading…
Reference in New Issue