Class GrouperGoogleProvisioningTargetNativeSync

java.lang.Object
edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeSync
edu.internet2.middleware.grouper.app.google.GrouperGoogleProvisioningTargetNativeSync

public class GrouperGoogleProvisioningTargetNativeSync extends GrouperProvisioningTargetNativeSync
Google-specific GrouperProvisioningTargetNativeSync: builds native target reporting beans for sync-back to the generic grouper_prov_group / grouper_prov_user tables.

Both groups and users are captured from the raw Google JSON (JSON Pointer paths, like SCIM and Adobe), hooked at the API-commands seam (GrouperGoogleApiCommands .retrieveGoogleGroups/retrieveGoogleGroup and retrieveGoogleUsers/ retrieveGoogleUser) where the per-element JSON node is in scope. This avoids losing any Google field that the GrouperGoogleGroup / GrouperGoogleUser typed beans do not model; operators can capture any JSON field via nativeAttributesGroups / nativeAttributesEntities with a name and optional JSON-Pointer path.

Google-specific caveat on group capture: the group JSON node parsed at the commands seam is the Directory API group resource (the groups[] elements of retrieveGoogleGroups, restricted by fields=... to id,email,name, description; or the single retrieveGoogleGroup resource). Google group settings (whoCanAdd, replyTo, messageModerationLevel, ...) and the manager/owner sets arrive from SEPARATE API calls and are NOT present in that node. So the default group capture (name, email) and any operator-configured Directory field (id excluded, description, ...) resolve from the node, but an operator who configures a group settings field in nativeAttributesGroups will not have it captured from this seam (it is not in the JSON here). This matches the Adobe approach of capturing at the per-element raw-JSON parse point.

Group and user OBJECTS capture on the read path (JSON-based, as above). MEMBERSHIPS capture on the WRITE path, like Adobe/SCIM: GrouperGoogleTargetDao.insertMembership / deleteMembership call captureMembershipInsertFromCurrentProvisioner(java.lang.String, java.lang.String) / captureMembershipDeleteFromCurrentProvisioner(java.lang.String, java.lang.String) (-> recordTargetNativeMembershipInsert / recordTargetNativeMembershipDelete) on success, so a membership add/remove lands in the native mirror on the write and converges on the write pass. The read path also still derives memberships group-centrically (the group's member ids, with roles looked up separately) during DAO translation (captureMembershipsForGroup(java.lang.String, java.util.Set<java.lang.String>)) to re-confirm the mirror idempotently. The user password field is never returned by Google on a read, so it never reaches this shadow.

  • Constructor Details

    • GrouperGoogleProvisioningTargetNativeSync

      public GrouperGoogleProvisioningTargetNativeSync()
  • Method Details

    • getDefaultNativeAttributeConfigsEntities

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsEntities()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol sensible-default attribute list for entities (users) when the operator hasn't configured nativeAttributesEntities. Override in protocol subclasses to return a curated list (e.g. SCIM core schema fields). Default is empty — for LDAP this means "no extra capture beyond what the regular target query returned," which is the historical behavior.
      Overrides:
      getDefaultNativeAttributeConfigsEntities in class GrouperProvisioningTargetNativeSync
    • grouperToNativeNameExceptionsEntities

      protected Map<String,String> grouperToNativeNameExceptionsEntities()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol native<->grouper attribute NAME exceptions for entities: grouper attribute name -> native (JSON/bean) field name, EXCEPTIONS ONLY -- anything not listed is identical in both namespaces. This is the single source of truth for name differences and drives both name normalization of the effective capture list AND auto-injection of every renamed attribute, so a cache-reconstructed object has the same attribute shape (and therefore matches/compares the same) as a live read. Default empty (most targets use identical names, e.g. LDAP mail/cn). Override per protocol (e.g. Google's email -> primaryEmail).
      Overrides:
      grouperToNativeNameExceptionsEntities in class GrouperProvisioningTargetNativeSync
      Returns:
      grouper name -> native name, exceptions only
    • getDefaultNativeAttributeConfigsGroups

      protected List<GrouperProvisioningNativeAttributeConfig> getDefaultNativeAttributeConfigsGroups()
      Description copied from class: GrouperProvisioningTargetNativeSync
      Per-protocol sensible-default attribute list for groups. See GrouperProvisioningTargetNativeSync.getDefaultNativeAttributeConfigsEntities().
      Overrides:
      getDefaultNativeAttributeConfigsGroups in class GrouperProvisioningTargetNativeSync
    • buildNativeGroupFromJson

      public GrouperProvisioningTargetNativeGroup buildNativeGroupFromJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build a native group bean from the raw Google Directory group JSON. targetId is read from /id (the same field the old buildNativeGroupFromGoogleGroup took from GrouperGoogleGroup.getId(), which fromJson reads from id); the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsGroups() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • buildNativeUserFromJson

      public GrouperProvisioningTargetNativeUser buildNativeUserFromJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build a native user bean from the raw Google user JSON. targetId is read from /id (the same field the old buildNativeUserFromGoogleUser took from GrouperGoogleUser.getId(), which fromJson reads from id); the attributes map is populated for each entry in GrouperProvisioningTargetNativeSync.effectiveNativeAttributeConfigsEntities() (operator-configured or default) by JSON Pointer. Returns null when the JSON is missing or has no id.
    • captureGroupJson

      public void captureGroupJson(com.fasterxml.jackson.databind.JsonNode groupNode)
      Build + record a Google group from its raw JSON. No-op when sync-back is off or id-less.
    • captureUserJson

      public void captureUserJson(com.fasterxml.jackson.databind.JsonNode userNode)
      Build + record a Google user from its raw JSON. No-op when sync-back is off or id-less.
    • captureMembershipsForGroup

      public void captureMembershipsForGroup(String targetGroupId, Set<String> memberUserIds)
      Translate a set of Google member user-ids for a given target group id into native membership beans and record them. No-op if reporting is off or input is empty. Google membership is group-centric (a group's member ids, with manager/owner roles resolved by separate calls), so -- like Adobe -- it is captured from the translated object during DAO processing rather than from a single per-element JSON node.
    • captureGroupJsonFromCurrentProvisioner

      public static void captureGroupJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode groupNode)
      Capture a Google group (from its raw Directory JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't a Google one. Called from the commands seam (GrouperGoogleApiCommands.retrieveGoogleGroups/ retrieveGoogleGroup) for each group while the JSON node is in scope.
    • captureUserJsonFromCurrentProvisioner

      public static void captureUserJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode userNode)
      Capture a Google user (from its raw JSON) against the current provisioner's sync. No-op if there's no current provisioner or the active provisioner isn't a Google one. Called from the commands seam (GrouperGoogleApiCommands.retrieveGoogleUsers/retrieveGoogleUser).
    • captureMembershipsForGroupFromCurrentProvisioner

      public static void captureMembershipsForGroupFromCurrentProvisioner(String targetGroupId, Set<String> memberUserIds)
      Record (targetGroupId, userId) memberships against the current provisioner's sync.
    • captureMembershipInsertFromCurrentProvisioner

      public static void captureMembershipInsertFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Google membership add (createGoogleMembership) against the current provisioner: record (groupTargetId, userTargetId) in the native membership map so the generic grouper_prov_mship mirror stays current without re-reading the target. No-op out of cycle, for a non-Google provisioner, or when membership sync-back is off (guarded downstream by isLoadMembershipsToGenericGrouperTable()).
    • captureMembershipDeleteFromCurrentProvisioner

      public static void captureMembershipDeleteFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Google membership remove (deleteGoogleMembership) against the current provisioner: drop (groupTargetId, userTargetId) from the native membership map so the end-of-run flush deletes its grouper_prov_mship row. No-op out of cycle, for a non-Google provisioner, or when membership sync-back is off.