Details
-
Improvement
-
Resolution: Fixed
-
Minor
-
None
-
None
Description
Yes, I ran into same issues but was able to get it to work by following suggestions in the link. Below is the code
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)
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