grouper-users - RE: [grouper-users] RE: Grouper ldap loader
Subject: Grouper Users - Open Discussion List
List archive
- From: Chris Hyzer <>
- To: Rahul Doshi <>, Gagné Sébastien <>, "" <>
- Subject: RE: [grouper-users] RE: Grouper ldap loader
- Date: Mon, 13 Aug 2012 06:18:56 +0000
- Accept-language: en-US
Sent: Monday, July 30, 2012 9:25 AM
To: Gagné Sébastien; Chris Hyzer;
Subject: Re: [grouper-users] RE: Grouper ldap loader
public static String convertDnToSpecificValue(String dn) {
//e.g. ,OU=Groups,DC=dev,DC=umontreal,DC=ca
String adGroupSuffix = GrouperLoaderConfig.getPropertyString("cmu.group.suffix", true);
//not sure why this would happen
if (dn == null) {
return dn;
}
if (dn.toLowerCase().endsWith(adGroupSuffix.toLowerCase())) {
String cn = dn.substring(0, dn.length()-adGroupSuffix.length());
if (StringUtils.countMatches(cn, "=") != 1) {
throw new RuntimeException("Why is there not 1 equals in this CN??? '" + cn + "'");
}
//this should be CN=groupName, convert to groupName
cn = GrouperUtil.prefixOrSuffix(cn, "=", false);
//e.g. umontreal.grouper.ad.group.prefix = umontreal:adgroups:
String grouperGroupPrefix = GrouperLoaderConfig.getPropertyString("cmu.group.prefix", true);
String groupName = grouperGroupPrefix + cn;
Group group = GrouperDAOFactory.getFactory().getGroup().findByName(groupName, false, null) ;
if (group != null) {
return group.getId();
}
else {
group = new GroupSave(GrouperSession.staticGrouperSession()).assignName(groupName).assignCreateParentStemsIfNotExist(true).save();
return group.getId();
}
}
//not a group
return LoaderLdapElUtils.convertDnToSpecificValue(dn);
}
}
Thanks,
Rahul
Date: Monday, July 30, 2012 9:15 AM
To: Chris Hyzer <>, Rahul Doshi <>, "" <>
Subject: RE: [grouper-users] RE: Grouper ldap loader
We had a similar problem (it’s me in the link) : when creating “somestem:admins” it tries to add the group member “someotherstem:admins” but if it doesn’t exist in Grouper it won’t be added because it doesn’t find it. We had to add a “create missing groups” feature to our “translate AD CN in Group’s member to Grouper Group IDs”
You also have to be careful with what you are searching (Ids or Identifiers), because in source g:gsa (group adapter) Group ID are the generated UUIDs (e.g. 30bb5405f55942129948b4ee924331ea) while Group identifier are, I believe, the group name (e.g. somestem:admins)
I haven’t tried the loader ldap with a flat structure, so there might be a problem translating “member=cn=someotherstem:admins, ou=group, dc= example, dc = org” to the proper group id “baseStem:someotherstem:admins”
De :
[]
De la part de Chris Hyzer
Envoyé : 26 juillet 2012 16:23
À : Rahul Doshi;
Objet : [grouper-users] RE: Grouper ldap loader
Actually, is this an LDAP_GROUP_LIST job, and is cn=someotherstem:admins, ou=group, dc= example, dc = org one of the groups that is returns from the ldap filter (as well as a member of a group). If so, then with the link below, you can do what you want to do. If that member which is a group is not managed by the loader, so we can do this with a tweak to grouper or an EL tweak. Let me know
Thanks,
Chris
From: Chris Hyzer
Sent: Thursday, July 26, 2012 4:16 PM
To: 'Rahul Doshi';
Subject: RE: Grouper ldap loader
I hadn’t really considered that case when creating the loader, but I think it can be done fairly easily with some EL and a java class. It is very similar to this email, except that the group will be created perhaps in EL…
https://lists.internet2.edu/sympa/arc/grouper-users/2012-05/msg00026.html
Want me to try to send you an example?
Thanks,
Chris
From:
[]
On Behalf Of Rahul Doshi
Sent: Thursday, July 26, 2012 4:03 PM
To:
Subject: [grouper-users] Grouper ldap loader
Hello,
I am trying to use grouper loader to load all the existing groups from our ldap environment. It seems to load the groups fine except that it is ignoring the nested group membership. For hypothetical group below if I run the loader job, I only see somstem:admins group created in grouper with member xyz. What I would have expected to see is two groups somestem:admins and someotherstem:admins created in grouper and someotherstem:admins also be the member of some stem:admins. Is there something that I am missing in my configuration?
Groupname
cn=somestem:admins, ou=group, dc=example, dc=org
member=uid=xyz, ou=person,dc=example,dc=org
member=cn=someotherstem:admins, ou=group, dc= example, dc = org
Thanks,
Rahul
- [grouper-users] RE: Grouper ldap loader, Chris Hyzer, 08/07/2012
- [grouper-users] Re: Grouper ldap loader, Rahul Doshi, 08/08/2012
- <Possible follow-up(s)>
- RE: [grouper-users] RE: Grouper ldap loader, Chris Hyzer, 08/13/2012
- RE: [grouper-users] RE: Grouper ldap loader, Gagné Sébastien, 08/13/2012
- RE: [grouper-users] RE: Grouper ldap loader, Chris Hyzer, 08/14/2012
- RE: [grouper-users] RE: Grouper ldap loader, Gagné Sébastien, 08/13/2012
Archive powered by MHonArc 2.6.16.
/**
* convert from uid=someapp,ou=people,dc=myschool,dc=edu to someapp and allow groups
* @param dn full dn
* @param allowGroups if groups are allowed
* @param groupSuffix group suffix e.g. ,OU=Groups,DC=dev,DC=umontreal,DC=ca
* @param groupPrefix group prefix e.g. umontreal:adgroups:
* if null then no prefix
* @param createGroupIfNotThere if we should see if group exists and if not, create
* @param idOrIdentifier true for Id (uuid), false for Identifier of group (name)
* @return the subjectId or Identifier
*/
public static String convertDnToSpecificValueOrGroup(String dn, String groupPrefix,
String groupSuffix, boolean createGroupIfNotThere, boolean idOrIdentifier) {
//not sure why this would happen
if (dn == null) {
return dn;
}
boolean isGroup = dn.toLowerCase().endsWith(groupSuffix.toLowerCase());
if (isGroup) {
String cn = dn.substring(0, dn.length() - groupSuffix.length());
if (StringUtils.countMatches(cn, "=") != 1) {
throw new RuntimeException("Why is there not 1 equals in this CN??? '" + cn + "'");
}
//this should be CN=groupName, convert to groupName
cn = GrouperUtil.prefixOrSuffix(cn, "=", false);
String groupName = StringUtils.isBlank(groupPrefix) ? cn : (groupPrefix + cn);
Group group = GrouperDAOFactory.getFactory().getGroup().findByName(groupName,
false, null);
if (createGroupIfNotThere) {
if (group == null) {
group = new GroupSave(GrouperSession.staticGrouperSession())
.assignName(groupName).assignCreateParentStemsIfNotExist(true).save();
}
}
if (group == null) {
LOG.error("Why is group null??? " + groupName);
return null;
}
return idOrIdentifier ? group.getId() : group.getName();
}
//not a group
return LoaderLdapElUtils.convertDnToSpecificValue(dn);
}