Uploaded image for project: 'OpenICF'
  1. OpenICF
  2. OPENICF-1079

Google Apps Connector: Google's APIs require a "familyName" at create time for accounts and generic purpose accounts don’t have family names

    Details

      Description

      We have accounts for users with first and last names like John Doe. Those accounts work great through the connector.

      We also have accounts for generic purposes like help@example.org. Those accounts don’t have family names.

      The Google APIs require a familyName at create time, but they don’t require one at update time. Accounts can be created with a dummy family name and then that family name can be cleared. The following code in the create function does this.

      boolean useFamilyNameDefault = false;

      Attribute familyName = AttributeUtil.find(FAMILY_NAME_ATTR, createAttributes);

      if ((null != familyName) && (isBlank(AttributeUtil.getAsStringValue(familyName))))

      { useFamilyNameDefault = true; familyName = AttributeBuilder.build(FAMILY_NAME_ATTR, "__default_value_replace_me__"); Set<Attribute> modifiableCreateAttributes = new HashSet(createAttributes); removeAttribute(FAMILY_NAME_ATTR, modifiableCreateAttributes); modifiableCreateAttributes.add(familyName); accessor = new AttributesAccessor(modifiableCreateAttributes); }

      Uid uid =

      execute(createUser(configuration.getDirectory().users(), accessor),

      new RequestResultHandler<Directory.Users.Insert, User, Uid>() {

      public Uid handleResult(final Directory.Users.Insert request,

      final User value) {

      logger.ok("New User is created:

      {0}", value.getId());

      return new Uid(value.getId(), value.getEtag());

      }

      });

      if ((null != uid) && useFamilyNameDefault) {

      Set<Attribute> replaceAttributes = new HashSet<Attribute>();

      replaceAttributes.add(AttributeBuilder.build(FAMILY_NAME_ATTR, ""));

      Uid updateUid = update(ObjectClass.ACCOUNT, uid, replaceAttributes, null);

      if (updateUid == null) {

      logger.warn("Unable to overwrite familyName default for user {0}

      ", uid.getUidValue());

      }

      }

      1. Can this support be added to the OpenIDM 7.0 version of the Google connector?

      2. This allows for Generic accounts to be supported more naturally through the Google connector.

      3. The code provided could be used as a starting point for Dev.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                petr.jurica Petr Jurica [X] (Inactive)
                Reporter:
                jeremy.barras Jeremy Barras [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: