Grouper loader configure via web service
This page shows how to configure a SQL loader job on an existing group by assigning the Grouper loader attributes through the Grouper web service, using the grouperClient assignAttributesWs operation. This is a scripted alternative to configuring the loader in the Grouper UI or with GrouperShell (GSH).
The loader attributes used here (etc:legacy:attribute:legacyGroupType_grouperLoader and the etc:legacy:attribute:legacyAttribute_grouperLoader* values) are auto-created by Grouper and are present in all currently supported releases (confirmed in GrouperCheckConfig), so this approach still works. The example output below was captured on the v2.3.0 demo server, so the web service URL and version strings reflect that release.
Required privileges: the web service user must be able to manage the target group (group ADMIN/UPDATE) and assign the Grouper loader attributes. Those attribute definitions live in the reserved etc:legacy:attribute area, so in practice this is a Grouper administrator. Configuring the database connection named by grouperLoaderDbName (here, grouper) requires that connection to be defined server-side in grouper-loader.properties.
Configure the grouperClient
Point the grouperClient at your web service in grouper.client.properties:
# url of web service, should include everything up to the first resource to access
# e.g. http://groups.school.edu:8090/grouperWs/servicesRest
# e.g. https://groups.school.edu/grouperWs/servicesRest
grouperClient.webService.url = https://grouperdemo.internet2.edu/grouper-ws_v2_3/servicesRest
# kerberos principal used to connect to web service
# e.g. name/server.whatever.upenn.edu
grouperClient.webService.login = test
# password for shared secret authentication to web service
# or you can put a filename with an encrypted password
grouperClient.webService.password = XXXXXXXXXXXLoader attributes to assign
Assigning the loader configuration is a two-part process. First assign the marker attribute to the group; this marks the group as a loader job and returns an attribute-assign id. Then assign each value attribute, using that marker assign id as the owner (--ownerAttributeAssignUuids).
Step | Attribute (under | Assign type | Example value | What it sets |
|---|---|---|---|---|
1 |
|
| (none) | Marks the group as a loader job. The response returns an attribute-assign id used as the owner for steps 2–6. |
2 |
|
|
| Loader job type (a single group loaded from a query). |
3 |
|
|
| Database connection name, defined in |
4 |
|
|
| Quartz cron schedule (here, daily at 07:00). |
5 |
|
|
| SQL returning the member subject ids for the group. |
6 |
|
|
| Schedule type ( |
Assign the attributes via grouperClient
Run the marker assignment first, against the group (here test:testLoaderFromWebService):
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyGroupType_grouperLoader \
--ownerGroupNames=test:testLoaderFromWebServiceThe response includes a WsAttributeAssign with an id (in this run, fca574eb763c412394bbf0916cc98e3f). Use that id as --ownerAttributeAssignUuids for each value attribute:
# loader type
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group_asgn --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyAttribute_grouperLoaderType \
--ownerAttributeAssignUuids=fca574eb763c412394bbf0916cc98e3f \
--attributeAssignValueOperation=assign_value --values0System=SQL_SIMPLE
# database connection name
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group_asgn --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyAttribute_grouperLoaderDbName \
--ownerAttributeAssignUuids=fca574eb763c412394bbf0916cc98e3f \
--attributeAssignValueOperation=assign_value --values0System=grouper
# quartz cron schedule
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group_asgn --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron \
--ownerAttributeAssignUuids=fca574eb763c412394bbf0916cc98e3f \
--attributeAssignValueOperation=assign_value --values0System="0 0 7 * * ?"
# loader query
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group_asgn --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyAttribute_grouperLoaderQuery \
--ownerAttributeAssignUuids=fca574eb763c412394bbf0916cc98e3f \
--attributeAssignValueOperation=assign_value --values0System="SELECT subjectId AS subject_id FROM subject WHERE NAME LIKE 'Steven%'"
# schedule type
java -jar grouperClient.jar --operation=assignAttributesWs \
--attributeAssignType=group_asgn --attributeAssignOperation=assign_attr \
--attributeDefNameNames=etc:legacy:attribute:legacyAttribute_grouperLoaderScheduleType \
--ownerAttributeAssignUuids=fca574eb763c412394bbf0916cc98e3f \
--attributeAssignValueOperation=assign_value --values0System=CRONAdd --debug=true to any command to see the full REST request and response. The marker assignment looks like this:
After all six assignments, the group carries the loader marker plus the five value attributes shown in the table above.