Class GrouperInterfolioApiCommands
java.lang.Object
edu.internet2.middleware.grouper.app.interfolio.GrouperInterfolioApiCommands
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InterfolioUsercreateUser(String configId, String institutionUserId, String samlId, String userType, String firstName, String lastName, String email) Create a user via the IAM API.static StringresolvePid(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).static List<InterfolioUser>retrieveAllUsersViaCsvReport(String configId) Retrieve the ENTIRE institution roster in one call via the byc csv_report endpoint.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.static voidsubscribeUserToFs(String configId, String pid) Subscribe a user to FS (grant Faculty Search access).static voidsubscribeUserToRpt(String configId, String pid) Subscribe a user to RPT (grant RPT access).static voidunsubscribeUserFromFs(String configId, String pid) Unsubscribe a user from FS (remove Faculty Search access).static voidunsubscribeUserFromRpt(String configId, String pid) Unsubscribe a user from RPT (remove RPT access).static InterfolioUserupdateUser(String configId, String pid, String institutionUserId, String samlId, String userType, String firstName, String lastName, String email) Update a user via the IAM API.
-
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 idinstitutionUserId- UID / PennKeysamlId- pennkey@upenn.eduuserType- typically "internal"firstName- first namelastName- last nameemail- 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 idpid- Interfolio person id of the user to updateinstitutionUserId- UID / PennKey (must be unchanged)samlId- pennkey@upenn.eduuserType- typically "internal"firstName- first namelastName- last nameemail- 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 idsearchTerm- email, UID/PennKey, or name fragment (blank/null for all)limit- page sizepage- 1-based page number- Returns:
- the matching users on that page
-
retrieveAllUsersViaCsvReport
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 withresolvePid(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
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 idinstitutionUserId- the UID / PennKey to look upemail- 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
Subscribe a user to RPT (grant RPT access).- Parameters:
configId- external system config idpid- Interfolio person id
-
subscribeUserToFs
Subscribe a user to FS (grant Faculty Search access).- Parameters:
configId- external system config idpid- Interfolio person id
-
unsubscribeUserFromRpt
Unsubscribe a user from RPT (remove RPT access).- Parameters:
configId- external system config idpid- Interfolio person id
-
unsubscribeUserFromFs
Unsubscribe a user from FS (remove Faculty Search access).- Parameters:
configId- external system config idpid- Interfolio person id
-