Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-826

genericize groups as ldap loader members

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • 2.1.2
    • None
    • grouperLoader
    • 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)

      { 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

      Attachments

        Activity

          People

            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: