From 540488a65ab5a805be663d0be2d96865a8e8938a Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 18 Sep 2014 11:45:11 +0200 Subject: Support hierarchical roles. Fixes #199 --- src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/c2kernel/lookup') diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java index 96ab609..0d3cbd4 100644 --- a/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPLookup.java @@ -432,7 +432,7 @@ public class LDAPLookup implements LookupManager{ } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","cristalrole")) { //cristalrole - thisPath = new RolePath(LDAPDN.explodeDN(dn,true)[0], + thisPath = new RolePath(getPathComponents(dn.substring(0, dn.lastIndexOf(mDomainTypeRoot))), LDAPLookupUtils.getFirstAttributeValue(entry, "jobList").equals("TRUE")); } else if (LDAPLookupUtils.existsAttributeValue(entry,"objectclass","aliasObject") || @@ -496,7 +496,6 @@ public class LDAPLookup implements LookupManager{ @Override public Iterator getChildren(Path path) { - if (path instanceof RolePath) return ((RolePath)path).getChildren(); String filter = "objectclass=*"; LDAPSearchConstraints searchCons = new LDAPSearchConstraints(); searchCons.setBatchSize(10); @@ -561,16 +560,14 @@ public class LDAPLookup implements LookupManager{ } - //NOTE: A role must have at LEAST 1 userDN, cannot be empty... //Creates a cristalRole //CristalRole is-a specialized CristalContext which contains multi-valued uniqueMember attribute pointing to cristalagents @Override - public RolePath createRole(String roleName, boolean jobList) + public RolePath createRole(RolePath rolePath) throws ObjectAlreadyExistsException, ObjectCannotBeUpdated { // create the role - RolePath rolePath = new RolePath(roleName, jobList); String roleDN = getFullDN(rolePath); LDAPEntry roleNode; try -- cgit v1.2.3