Disable a User

If a user has left your organization or is no longer required to be on the list of active users, you may disable that user. In this use case, you will learn how to identify and disable a specific user. Use the user name to get the unique user ID and then use that ID to disable the user.

  1. Use cURL and eq filter parameter with the username field to search for the specific user. In this example, queried user name is CUST_CONTRACT_MGR_OPERATIONS.
    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"
          ],
          "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
        }
      ]
    }
    The user ID returned by the query is 5A25572D96277A00C0547E3A715EF682.
  2. Submit a PATCH request for the user ID 5A25572D96277A00C0547E3A715EF682 that you got from the response to change the user's active status from true to false, and disable that user.
    curl -i -u "<username>:<password>"  -H "Content-Type: application/json"  -X PATCH  
    -d {
    "schemas":[
          "urn:scim:schemas:core:2.0:User"
         ],
         "active":false
    }
    https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Users/5A25572D96277A00C0547E3A715EF682
    
The user CUST_CONTRACT_MGR_OPERATIONS is disabled and doesn't appear in the list of active users.