Add Users to a User Category

This use case describes how to assign users to a user category. You can assign a user to only one category. When a user is created, if no category is specified, the user is automatically assigned to the DEFAULT category. Later, you can reassign the user to another category. But at any given point in time, a user can belong to only one category. For each category, you can configure user group-level settings such as notifications, or password expiration warnings. If a user is created without assigning a user category, then the value DEFAULT is automatically assigned.

Before you begin, you must know the category name. To get the category name, go to Security Console, and on the User Categories page, identify the category name from the list. For instructions, see Managing Implementation Users in the Securing ERP guide.

In this example, let's assume that you have identified the category REST_SCIM_02 to which you're going to add the user. Then, search for the user and get the unique identifier of the user.

  1. Use cURL and eq filter parameter with the username field to query the users. In this example, the queried user name is CUST_CONTRACT_MGR_OPERATIONS and the user ID returned by the query is 5A25572D96277A00C0547E3A715EF682.
    curl -i -u "<username>:<password>" -X GET https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Users?filter=username eq "CUST_CONTRACT_MGR_OPERATIONS"

    Sample Response Payload

    {
      "itemsPerPage": 1,
      "startIndex": 1,
      "Resources": [
        {
          "id": "5A25572D96277A00C0547E3A715EF682",
          "meta": {
            "created": "2009-05-25 00:00:00.000",
            "lastModified": "2015-12-14 10:15:48.291",
            "location": "https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Users/5A25572D96277A00C0547E3A715EF682"
          },
          "schemas": [
            "urn:scim:schemas:core:2.0:User",
            "urn:scim:schemas:extension:fa:2.0:faUser"
        ],
          "userName": "CUST_CONTRACT_MGR_OPERATIONS",
          "name": {
            "familyName": "Black",
            "givenName": "Sophie"
          },
          "displayName": "Sophie Black",
          "emails": [
            {
              "value": "CUST_CONTRACT_MGR_OPERATIONS@dummy.oracle.com",
              "type": "W",
              "primary": true
            }
          ],
          "roles": [
            {
              "id": "4EB6B72643872425B6BE573B531ABC6B",
              "value": "OKC_CUSTOMER_CONTRACT_MANAGER_VISION_OPERATIONS_DATA",
              "displayName": "Customer Contract Manager - Vision Operations",
              "description": "Customer Contract Manager for Vision Operations"
            },
            {
              "id": "40C4AE052EC2582286A6A0FB1514656C",
              "value": "ORA_PER_EMPLOYEE_ABSTRACT",
              "displayName": "Employee",
              "description": "Identifies the person as an employee."
            },
            {
              "id": "05E9F3576995F83E74EB3818FDCA8639",
              "value": "ORA_PER_LINE_MANAGER_ABSTRACT",
              "displayName": "Line Manager",
              "description": "Identifies the person as a line manager."
            }
          ],
          "active": true
        }
      ]
    }
  2. Submit a PATCH operation on the User resource to update the user category for the queried user. In this example, update the 5A25572D96277A00C0547E3A715EF682 user id to be assigned to the REST_SCIM_02 category.
    curl -i -u "<username>:<password>" -X PATCH https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Users/5A25572D96277A00C0547E3A715EF682

    Sample Request Payload

    {
     "schemas": [
            "urn:scim:schemas:core:2.0:User",
            "urn:scim:schemas:extension:fa:2.0:faUser"
        ],
        "urn:scim:schemas:extension:fa:2.0:faUser": {
            "userCategory": "REST_SCIM_02"
        }
    }

    Sample Response Payload

    {
        "id": "5A25572D96277A00C0547E3A715EF682",
        "meta": {
            "created": "2017-12-12 08:12:58.000",
            "lastModified": "2017-12-12 08:14:26.016",
            "location": "https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Users/5A25572D96277A00C0547E3A715EF682"
        },
        "schemas": [
            "urn:scim:schemas:core:2.0:User",
            "urn:scim:schemas:extension:fa:2.0:faUser"
        ],
        "userName": "CUST_CONTRACT_MGR_OPERATIONS",
          "name": {
            "familyName": "Black",
            "givenName": "Sophie"
          },
          "displayName": "Sophie Black",
          "emails": [
            {
              "value": "CUST_CONTRACT_MGR_OPERATIONS@dummy.oracle.com",
              "type": "W",
              "primary": true
            }
          ],
        "urn:scim:schemas:extension:fa:2.0:faUser": {
            "userCategory": "REST_SCIM_02"
        },
        "active": true
    }

    The user is added to the specific user category.

If you have to add multiple users to different user categories, you can do that using a bulk operation. In this example, a bulk operation is used to create two users and add them to two different user categories (REST_SCIM_01and REST_SCIM_02).

Sample Request Payload

{
   "Operations":[
      {
         "method":"POST",
         "path":"/Users",
         "bulkId":"scim_Bulk_{{$randomInt}}_01",
         "data":{
            "schemas":[
               "urn:scim:schemas:core:2.0:User"
            ],
            "name":{
               "familyName":"Sun",
               "givenName":"GN_Bulk_User_{{$randomInt}}_01"
            },
            "displayName":"DN_Bulk_User_{{$randomInt}}_01",
            "emails":[
               {
                  "value":"xx.yy@oracle.com",
                  "primary":true,
                  "type":"W"
               }
            ],
            "userName":"UN_Bulk_User_{{$randomInt}}_01",
            "password":"<password>",
            "urn:scim:schemas:extension:fa:2.0:faUser":{
               "userCategory":"REST_SCIM_01"
            }
         }
      },
      {
         "method":"POST",
         "path":"/Users",
         "bulkId":"scim_Bulk_{{$randomInt}}_02",
         "data":{
            "schemas":[
               "urn:scim:schemas:core:2.0:User"
            ],
            "name":{
               "familyName":"Sun",
               "givenName":"GN_Bulk_User_{{$randomInt}}_02"
            },
            "displayName":"DN_Bulk_User_{{$randomInt}}_02",
            "emails":[
               {
                  "value":"aa.bb@oracle.com",
                  "primary":true,
                  "type":"W"
               }
            ],
            "userName":"UN_Bulk_User_{{$randomInt}}_02",
            "password":"<password>",
            "urn:scim:schemas:extension:fa:2.0:faUser":{
               "userCategory":"REST_SCIM_02"
            }
         }
      }
   ]
}