Child pages
  • Assign Attributes
Skip to end of metadata
Go to start of metadata

Grouper Web Services

Description

Assign or remove attributes and values of attribute assignments.  These attributes can be on groups, stems, members, memberships (immediate or any), attribute definitions, or on assignments of attributes (one level deep).

You can lookup attributes by attribute definition name, or attribute definition id

All assignments will be filtered for security based on the logged in or acted as user (security rules are on attribute framework wiki)

The returned data will include the attribute assignments, value(s) on those assignments, and a normalized list of references (owner objects e.g. group/stem/etc, attribute definitions, attribute names, etc), if things changed or were already assigned, etc

You can assign attributes to multiple owners, definitions, actions, etc

attributeAssignType is a required field, must be: group, member, stem, any_mem, imm_mem, attr_def, group_asgn, mem_asgn, stem_asgn, any_mem_asgn, imm_mem_asgn, attr_def_asgn

attributeAssignOperation is required and is the operation to perform for attribute on owners, from enum AttributeAssignOperation: assign_attr, add_attr, remove_attr, replace_attrs.  In this case, assigning an attribute will not assign if already there.  add_attr will add this assignment even if it is already there (attribute definition must allow multi assignments)

attributeAssignValueOperation is required if passing values to assign.  It is the operation to perform for attribute value on attribute assignments: assign_value, add_value, remove_value, replace_values.  Like the attribute assign operation, assign_value will assign if not there, or ignore if already there.  add_value will add even if assigned.  And replace_values will remove orphans not in the assign list.

Features

  • Can pass owners, actions, values, etc.  If multiples are passed, then each attribute def name will be assigned for each action on each owner.
  • Lookup owner or other objects by object lookup (by id, name, etc)
  • Returns group / subject information, can be detailed or not
  • Can actAs another user

Assign attributes lite service

  • Accepts one group, or one subject, or stem, one attribute definition name, one action to assign, one value (optional)
  • Documentation: SOAP (click on assignAttributesLite), REST (click on assignAttributesLite)
  • For REST, the request can put data in query string (in URL or request body)
  • REST request (colon is escaped to %3A):
    • PUT /grouper-ws/servicesRest/v1_6_000/assignAttributes
    • Note: if passing data in request body e.g. actAs, use a POST
  • (see documentation above for details): Request object, response object
  • Response codes
  • Samples (all files with "Lite" in them, click on "download" to see file)
  • Samples with value assignment

Assign attributes service

  • Accepts multiple groups or subjects or memberhipIds (or combination) etc, attribute definitions, actions, etc to assign
  • Documentation: SOAP (click on assignAttributes), REST (click on assignAttributes)
  • REST request (colon is escaped to %3A):
    • POST /grouper-ws/servicesRest/v1_6_000/assignAttributes
  • (see documentation above for details): Request object, response object
  • Response codes overall
  • Returns an overall status
  • Samples (all files without "Lite" in them, click on "download" to see files)
  • Samples with value assignment

Assign value example

If this is an assignment on an assignment, you first need to query to get the attribute assign id where the value is


[mchyzer@flash pennGroupsClient-2.3.0]$ java -jar grouperClient.jar --operation=getAttributeAssignmentsWs --attributeAssignType=group --includeAssignmentsOnAssignments=true --ownerGroupNames=a:b:c:groupName --debug=true

POST /grouperWs/servicesRest/v2_3_000/attributeAssignments HTTP/1.1
Connection: close
Authorization: Basic xxxxxxxxxxxxxxxx
User-Agent: Jakarta Commons-HttpClient/3.1
Host: grouperws.apps.upenn.edu:-1
Content-Length: 321
Content-Type: text/xml; charset=UTF-8

<WsRestGetAttributeAssignmentsRequest>
  <attributeAssignType>group</attributeAssignType>
  <wsOwnerGroupLookups>
    <WsGroupLookup>
      <groupName>a:b:c:groupName</groupName>
    </WsGroupLookup>
  </wsOwnerGroupLookups>
  <includeAssignmentsOnAssignments>T</includeAssignmentsOnAssignments>
</WsRestGetAttributeAssignmentsRequest>

################ RESPONSE START (indented) ###############

HTTP/1.1 200 OK
Date: Mon, 23 Apr 2018 12:43:25 GMT
Set-Cookie: JSESSIONID=xxxxxxxxxxxx; Path=/grouperWs
X-Grouper-resultCode: SUCCESS
X-Grouper-success: T
X-Grouper-resultCode2: NONE
Content-Type: text/xml;charset=UTF-8
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Set-Cookie: BIGipServerPFA-grouperws_pool=3810792620.20480.0000; expires=Mon, 23-Apr-2018 18:43:26 GMT; path=/; Httponly; Secure

<WsGetAttributeAssignmentsResults>
    <WsAttributeDefName>
      <idIndex>12892</idIndex>
      <extension>legacyAttribute_grouperLoaderQuartzCron</extension>
      <displayExtension>legacyAttribute_grouperLoaderQuartzCron</displayExtension>
      <displayName>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</displayName>
      <name>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</name>
      <uuid>ff79e20c06314ee380bb492def9de796</uuid>
      <attributeDefId>ef7039cf58b34783b6b012cc4799073e</attributeDefId>
      <attributeDefName>etc:legacy:attribute:legacyAttributeDef_grouperLoader</attributeDefName>
    </WsAttributeDefName>
    <WsAttributeAssign>
      <disallowed>F</disallowed>
      <attributeAssignActionType>immediate</attributeAssignActionType>
      <attributeAssignDelegatable>FALSE</attributeAssignDelegatable>
      <attributeAssignActionId>d459f64e432e4820a4b79de775fd0ab1</attributeAssignActionId>
      <attributeAssignActionName>assign</attributeAssignActionName>
      <attributeAssignType>group_asgn</attributeAssignType>
      <attributeDefNameId>ff79e20c06314ee380bb492def9de796</attributeDefNameId>
      <attributeDefNameName>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</attributeDefNameName>
      <attributeDefId>ef7039cf58b34783b6b012cc4799073e</attributeDefId>
      <attributeDefName>etc:legacy:attribute:legacyAttributeDef_grouperLoader</attributeDefName>
      <wsAttributeAssignValues>
        <WsAttributeAssignValue>
          <id>285dd3e3e3bf4f78955a67395de7e8df</id>
          <valueSystem>0 15 7 * * ?</valueSystem>
        </WsAttributeAssignValue>
      </wsAttributeAssignValues>
      <createdOn>2016/07/09 23:06:37.253</createdOn>
      <enabled>T</enabled>
      <id>781992a9dc0e4b58a0202e9b24e94f87</id>
      <lastUpdated>2016/07/09 23:06:37.253</lastUpdated>
      <ownerAttributeAssignId>ddf1e57538af4b3aaf4b0673b5803511</ownerAttributeAssignId>
    </WsAttributeAssign>
  </wsAttributeAssigns>
  <resultMetadata>
    <resultCode>SUCCESS</resultCode>
    <resultMessage>, Found 11 results.  </resultMessage>
    <success>T</success>
  </resultMetadata>
  <responseMetadata>
    <resultWarnings></resultWarnings>
    <millis>590</millis>
    <serverVersion>2.3.0</serverVersion>
  </responseMetadata>
  <wsGroups>
    <WsGroup>
      <extension>groupName</extension>
      <typeOfGroup>group</typeOfGroup>
      <displayExtension>groupName</displayExtension>
      <displayName>a:b:c:groupName</displayName>
      <name> a:b:c:groupName </name>
      <uuid>d836336699e24404a442a1cfb2027a6c</uuid>
      <idIndex>194760</idIndex>
    </WsGroup>
  </wsGroups>
  <wsStems/>
  <wsMemberships/>
  <wsSubjects/>
</WsGetAttributeAssignmentsResults>


####################################################
Then assign the value:


[mchyzer@flash pennGroupsClient-2.3.0]$ java -jar grouperClient.jar --operation=assignAttributesWs --attributeAssignOperation=assign_attr --attributeAssignType=group_asgn --ownerAttributeAssignUuids=ddf1e57538af4b3aaf4b0673b5803511 --attributeDefNameNames=penn:etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron --attributeAssignValueOperation=replace_values --values0System="0 16 7 * * ?" --debug=true

################ REQUEST START (indented) ###############

POST /grouperWs/servicesRest/v2_3_000/attributeAssignments HTTP/1.1
Connection: close
Authorization: Basic xxxxxxxxxxxxxxxx
User-Agent: Jakarta Commons-HttpClient/3.1
Host: grouperws.apps.upenn.edu:-1
Content-Length: 707
Content-Type: text/xml; charset=UTF-8

<WsRestAssignAttributesRequest>
  <attributeAssignOperation>assign_attr</attributeAssignOperation>
  <attributeAssignValueOperation>replace_values</attributeAssignValueOperation>
  <wsOwnerAttributeAssignLookups>
    <WsAttributeAssignLookup>
      <uuid>ddf1e57538af4b3aaf4b0673b5803511</uuid>
    </WsAttributeAssignLookup>
  </wsOwnerAttributeAssignLookups>
  <values>
    <WsAttributeAssignValue>
      <valueSystem>0 16 7 * * ?</valueSystem>
    </WsAttributeAssignValue>
  </values>
  <attributeAssignType>group_asgn</attributeAssignType>
  <wsAttributeDefNameLookups>
    <WsAttributeDefNameLookup>
      <name>penn:etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</name>
    </WsAttributeDefNameLookup>
  </wsAttributeDefNameLookups>
</WsRestAssignAttributesRequest>

################ REQUEST END ###############

################ RESPONSE START (indented) ###############

HTTP/1.1 200 OK
Date: Mon, 23 Apr 2018 13:09:14 GMT
Set-Cookie: JSESSIONID=xxxxxxxxxxxx; Path=/grouperWs
X-Grouper-resultCode: SUCCESS
X-Grouper-success: T
X-Grouper-resultCode2: NONE
Content-Type: text/xml;charset=UTF-8
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Set-Cookie: BIGipServerPFA-grouperws_pool=3861124268.20480.0000; expires=Mon, 23-Apr-2018 19:09:15 GMT; path=/; Httponly; Secure

<WsAssignAttributesResults>
  <wsAttributeDefs>
    <WsAttributeDef>
      <idIndex>10046</idIndex>
      <extension>legacyAttributeDef_grouperLoader</extension>
      <name>etc:legacy:attribute:legacyAttributeDef_grouperLoader</name>
      <uuid>ef7039cf58b34783b6b012cc4799073e</uuid>
      <attributeDefType>attr</attributeDefType>
      <multiAssignable>F</multiAssignable>
      <multiValued>F</multiValued>
      <valueType>string</valueType>
      <assignToAttributeDef>F</assignToAttributeDef>
      <assignToAttributeDefAssignment>F</assignToAttributeDefAssignment>
      <assignToEffectiveMembership>F</assignToEffectiveMembership>
      <assignToEffectiveMembershipAssignment>F</assignToEffectiveMembershipAssignment>
      <assignToGroup>F</assignToGroup>
      <assignToGroupAssignment>F</assignToGroupAssignment>
      <assignToImmediateMembership>F</assignToImmediateMembership>
      <assignToImmediateMembershipAssignment>F</assignToImmediateMembershipAssignment>
      <assignToMember>F</assignToMember>
      <assignToMemberAssignment>F</assignToMemberAssignment>
      <assignToStem>F</assignToStem>
      <assignToStemAssignment>F</assignToStemAssignment>
    </WsAttributeDef>
  </wsAttributeDefs>
  <wsAttributeDefNames>
    <WsAttributeDefName>
      <idIndex>12892</idIndex>
      <extension>legacyAttribute_grouperLoaderQuartzCron</extension>
      <displayExtension>legacyAttribute_grouperLoaderQuartzCron</displayExtension>
      <displayName>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</displayName>
      <name>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</name>
      <uuid>ff79e20c06314ee380bb492def9de796</uuid>
      <attributeDefId>ef7039cf58b34783b6b012cc4799073e</attributeDefId>
      <attributeDefName>etc:legacy:attribute:legacyAttributeDef_grouperLoader</attributeDefName>
    </WsAttributeDefName>
  </wsAttributeDefNames>
  <wsAttributeAssignResults>
    <WsAssignAttributeResult>
      <wsAttributeAssignValueResults>
        <WsAttributeAssignValueResult>
          <changed>T</changed>
          <deleted>T</deleted>
          <wsAttributeAssignValue>
            <id>285dd3e3e3bf4f78955a67395de7e8df</id>
            <valueSystem>0 15 7 * * ?</valueSystem>
          </wsAttributeAssignValue>
        </WsAttributeAssignValueResult>
        <WsAttributeAssignValueResult>
          <changed>T</changed>
          <deleted>F</deleted>
          <wsAttributeAssignValue>
            <id>4b6c8b5df143448994ceaf6aed68856c</id>
            <valueSystem>0 16 7 * * ?</valueSystem>
          </wsAttributeAssignValue>
        </WsAttributeAssignValueResult>
      </wsAttributeAssignValueResults>
      <wsAttributeAssigns>
        <WsAttributeAssign>
          <disallowed>F</disallowed>
          <attributeAssignActionType>immediate</attributeAssignActionType>
          <attributeAssignDelegatable>FALSE</attributeAssignDelegatable>
          <attributeAssignActionId>d459f64e432e4820a4b79de775fd0ab1</attributeAssignActionId>
          <attributeAssignActionName>assign</attributeAssignActionName>
          <attributeAssignType>group_asgn</attributeAssignType>
          <attributeDefNameId>ff79e20c06314ee380bb492def9de796</attributeDefNameId>
          <attributeDefNameName>etc:legacy:attribute:legacyAttribute_grouperLoaderQuartzCron</attributeDefNameName>
          <attributeDefId>ef7039cf58b34783b6b012cc4799073e</attributeDefId>
          <attributeDefName>etc:legacy:attribute:legacyAttributeDef_grouperLoader</attributeDefName>
          <wsAttributeAssignValues>
            <WsAttributeAssignValue>
              <id>4b6c8b5df143448994ceaf6aed68856c</id>
              <valueSystem>0 16 7 * * ?</valueSystem>
            </WsAttributeAssignValue>
          </wsAttributeAssignValues>
          <createdOn>2016/07/09 23:06:37.253</createdOn>
          <enabled>T</enabled>
          <id>781992a9dc0e4b58a0202e9b24e94f87</id>
          <lastUpdated>2016/07/09 23:06:37.253</lastUpdated>
          <ownerAttributeAssignId>ddf1e57538af4b3aaf4b0673b5803511</ownerAttributeAssignId>
        </WsAttributeAssign>
      </wsAttributeAssigns>
      <changed>F</changed>
      <valuesChanged>T</valuesChanged>
      <deleted>F</deleted>
    </WsAssignAttributeResult>
  </wsAttributeAssignResults>
  <resultMetadata>
    <resultCode>SUCCESS</resultCode>
    <resultMessage>, Found 1 results.  </resultMessage>
    <success>T</success>
  </resultMetadata>
  <responseMetadata>
    <resultWarnings></resultWarnings>
    <millis>1216</millis>
    <serverVersion>2.3.0</serverVersion>
  </responseMetadata>
  <wsGroups/>
  <wsStems/>
  <wsMemberships/>
  <wsSubjects/>
</WsAssignAttributesResults>


  • No labels