Class GrouperInterfolioApiCommands

java.lang.Object
edu.internet2.middleware.grouper.app.interfolio.GrouperInterfolioApiCommands

public class GrouperInterfolioApiCommands extends Object
Interacts with the Interfolio API. Only the operations that work with our credentials are implemented (see InterfolioExternalSystem): IAM API (create / update a user): createUser - POST {iamUrl}/iam/{databaseId}/users updateUser - PUT {iamUrl}/iam/{databaseId}/users/{pid} byc/core API (look up users, grant / remove product access): searchUsers - GET {bycUrl}/byc/core/tenure/{databaseId}/institutions/{databaseId}/users/search subscribeUserToRpt - POST {bycUrl}/byc-tenure/{databaseId}/users/{pid}/subscribe subscribeUserToFs - POST {bycUrl}/byc-search/{databaseId}/users/{pid}/subscribe unsubscribeUserFromRpt - PUT {bycUrl}/byc-tenure/{databaseId}/users/{pid}/unsubscribe unsubscribeUserFromFs - PUT {bycUrl}/byc-search/{databaseId}/users/{pid}/unsubscribe Operations that are not authorized for our credentials (FAR/Faculty180, hard delete, IAM get-by-id) are intentionally not implemented.
  • Constructor Details

    • GrouperInterfolioApiCommands

      public GrouperInterfolioApiCommands()
  • Method Details

    • createUser

      public static InterfolioUser createUser(String configId, String institutionUserId, String samlId, String userType, String firstName, String lastName, String email)
      Create a user via the IAM API.
      Parameters:
      configId - external system config id
      institutionUserId - UID / PennKey
      samlId - pennkey@upenn.edu
      userType - typically "internal"
      firstName - first name
      lastName - last name
      email - email
      Returns:
      the created user (with its assigned pid)
    • updateUser

      public static InterfolioUser updateUser(String configId, String pid, String institutionUserId, String samlId, String userType, String firstName, String lastName, String email)
      Update a user via the IAM API. The IAM PUT is a full replace, so all attributes are sent. Note institution_user_id is immutable - it must equal the user's existing UID.
      Parameters:
      configId - external system config id
      pid - Interfolio person id of the user to update
      institutionUserId - UID / PennKey (must be unchanged)
      samlId - pennkey@upenn.edu
      userType - typically "internal"
      firstName - first name
      lastName - last name
      email - email
      Returns:
      the updated user
    • searchUsers

      public static List<InterfolioUser> searchUsers(String configId, String searchTerm, int limit, int page)
      Look up users by a search term (email, UID, or name) via the byc users/search endpoint. A blank term returns the whole roster (paged).
      Parameters:
      configId - external system config id
      searchTerm - email, UID/PennKey, or name fragment (blank/null for all)
      limit - page size
      page - 1-based page number
      Returns:
      the matching users on that page
    • retrieveAllUsersViaCsvReport

      public static List<InterfolioUser> retrieveAllUsersViaCsvReport(String configId)
      Retrieve the ENTIRE institution roster in one call via the byc csv_report endpoint. Unlike users/search (which omits it), this report includes the UID (institution_user_id / PennKey) - the stable key the provisioner matches on - along with email, name, user_type, and SSO ID (saml_id). It does NOT include the pid, so returned users have a null pid (resolve it lazily with resolvePid(java.lang.String, java.lang.String, java.lang.String) only when a write is needed). Rows without a UID (external/API accounts) are skipped - they are not part of the faculty population. GET {bycUrl}/byc/core/tenure/{databaseId}/users/csv_report
      Parameters:
      configId - external system config id
      Returns:
      all Interfolio users keyed by institution_user_id
    • resolvePid

      public static String resolvePid(String configId, String institutionUserId, String email)
      Resolve the Interfolio pid for a user we need to write to, given the UID (and email to disambiguate). csv_report does not return the pid, so when the provisioner updates or deprovisions an already-existing user we look the pid up via byc users/search on the UID.
      Parameters:
      configId - external system config id
      institutionUserId - the UID / PennKey to look up
      email - the expected email, used to disambiguate when the search returns more than one hit
      Returns:
      the pid, or null if it cannot be resolved unambiguously
    • subscribeUserToRpt

      public static void subscribeUserToRpt(String configId, String pid)
      Subscribe a user to RPT (grant RPT access).
      Parameters:
      configId - external system config id
      pid - Interfolio person id
    • subscribeUserToFs

      public static void subscribeUserToFs(String configId, String pid)
      Subscribe a user to FS (grant Faculty Search access).
      Parameters:
      configId - external system config id
      pid - Interfolio person id
    • unsubscribeUserFromRpt

      public static void unsubscribeUserFromRpt(String configId, String pid)
      Unsubscribe a user from RPT (remove RPT access).
      Parameters:
      configId - external system config id
      pid - Interfolio person id
    • unsubscribeUserFromFs

      public static void unsubscribeUserFromFs(String configId, String pid)
      Unsubscribe a user from FS (remove Faculty Search access).
      Parameters:
      configId - external system config id
      pid - Interfolio person id