Class GrouperBoxProvisioningTargetNativeSync

java.lang.Object
edu.internet2.middleware.grouper.app.provisioning.GrouperProvisioningTargetNativeSync
edu.internet2.middleware.grouper.app.boxProvisioner.GrouperBoxProvisioningTargetNativeSync

public class GrouperBoxProvisioningTargetNativeSync extends GrouperProvisioningTargetNativeSync
Box-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 Box JSON (JSON Pointer paths, like SCIM and Adobe), hooked at the API-commands seam (GrouperBoxApiCommands read methods such as retrieveBoxGroups / retrieveBoxGroup / retrieveBoxUsers / retrieveBoxUser) where the per-element JSON node is in scope. This avoids losing any Box field that the GrouperBoxGroup / GrouperBoxUser typed beans do not model; operators can capture any JSON field via nativeAttributesGroups / nativeAttributesEntities with a name and optional JSON-Pointer path.

The default keys are chosen so each default's captured value matches what the OLD typed-bean getter returned. For Box every default's bean property name happens to equal its raw Box JSON field name (e.g. group name/group_type/provenance; user login/role/status/type), so the defaults need no explicit path remapping (the JSON path defaults to "/" + name). The target ids come from /id for both groups and users -- the same JSON field the old typed-bean build methods read via GrouperBoxGroup.getId() / GrouperBoxUser.getId().

Memberships are captured on BOTH the read path and the write path. On read they are derived from the Box memberships read during DAO translation (captureMemberships(java.lang.String, java.lang.Iterable<java.lang.String>)) -- Box's membership model is group-centric (the /groups/:id/memberships read yields the member user ids for a group), and the DAO records the (targetGroupId, targetUserId) pairs in the same loop where they are already known. On write, GrouperBoxTargetDao.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 is recorded into the native mirror on the write pass. Only the group/user object capture moved to JSON.

  • Constructor Details

    • GrouperBoxProvisioningTargetNativeSync

      public GrouperBoxProvisioningTargetNativeSync()
  • 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
    • 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 Box group JSON. targetId is read from /id (the same field the old typed-bean build read via getId()); 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 Box user JSON. targetId is read from /id (the same field the old typed-bean build read via getId()); 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 Box 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 Box user from its raw JSON. No-op when sync-back is off or id-less.
    • captureMemberships

      public void captureMemberships(String targetGroupId, Iterable<String> targetUserIds)
      Record the (targetGroupId, targetUserId) pairs as native membership beans. No-op if input is empty.
    • captureGroupJsonFromCurrentProvisioner

      public static void captureGroupJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode groupNode)
      Capture a Box group (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 Box one. Called from the commands seam (GrouperBoxApiCommands read methods) for every group parsed from a read.
    • captureUserJsonFromCurrentProvisioner

      public static void captureUserJsonFromCurrentProvisioner(com.fasterxml.jackson.databind.JsonNode userNode)
      Capture a Box 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 Box one. Called from the commands seam (GrouperBoxApiCommands read methods) for every user parsed from a read.
    • captureMembershipsFromCurrentProvisioner

      public static void captureMembershipsFromCurrentProvisioner(String targetGroupId, Iterable<String> targetUserIds)
      Record the (targetGroupId, targetUserId) pairs as native membership beans on the current provisioner's sync. Box memberships are group-centric and derived during DAO translation, so unlike groups/users (captured at the commands JSON seam) this stays a typed-bean call site.
    • captureMembershipInsertFromCurrentProvisioner

      public static void captureMembershipInsertFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Box membership add (createBoxMembership) against the current provisioner: record (groupTargetId, userTargetId) in the native membership map so the generic grouper_prov_mship sync-back mirror stays current on capture-on-write. No-op out of cycle, for a non-Box provisioner, or when membership sync-back is off (guarded downstream by recordTargetNativeMembershipInsert -> isLoadMembershipsToGenericGrouperTable()).
    • captureMembershipDeleteFromCurrentProvisioner

      public static void captureMembershipDeleteFromCurrentProvisioner(String groupTargetId, String userTargetId)
      Write-track a successful Box membership remove (deleteBoxMembership) 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-Box provisioner, or when membership sync-back is off (guarded downstream by recordTargetNativeMembershipDelete -> isLoadMembershipsToGenericGrouperTable()).