All pages
Powered by GitBook
1 of 1

Loading...

Import selected roles

In this example, you can learn how to add specific roles and their privileges to the target Tuum environment.

If a role code already exists in the target environment, the import process replaces its current privileges with the imported ones.

Use case

Use case data
API parameters with values

The role codes we're importing roles and privileges for are: ACCOUNTANT and TEST_LT.

In this example, the role ACCOUNTANT already existed in the target environment, but role TEST_LT is a new role.

The system will import only roles and associated privileges with a valid validity range.

Sample API call

To import specific roles and associated privileges to the target environment, make the following API call.

Ensure the target environment for the import is different from the export environment.

Sample request

Below is an example request body of the API call for import roles.

{
  "rolesWithPrivileges": [
            {
                "roleCode": "ACCOUNTANT",
                "privilegeNames": [
                    "ADD_PERSON",
                    "APPROVE_APPLICATIONS",
                    "DISBURSE_LOAN",
                    "EDIT_CONTRACT",
                    "EDIT_LOAN_PRODUCTS",
                    "EDIT_PERSON",
                    "MANAGE_USERS",
                    "SEARCH_CONTRACT_DOCUMENTS",
                    "VIEW_GL_JOURNAL",
                    "VIEW_LOAN_CONTRACT",
                    "VIEW_LOAN_PRODUCTS",
                    "VIEW_PERSON",
                    "VIEW_EXTERNAL_CONTRACTS",
                    "VIEW_PERSON_GROUP_TYPE",
                ],
                "valid": true
            },
            {
                "roleCode": "TEST_LT",
                "privilegeNames": [
                    "MANAGE_USERS",
                    "READ_RESTRICTED_DATA",
                    "Test_LT",
                    "VIEW_FOUREYE_REVIEW_RULE",
                    "VIEW_REVIEW_APPROVALS_CONFIGURATION",
                    "VIEW_PERSON",
                    "VIEW_EXTERNAL_CONTRACTS",
                    "VIEW_PERSON_GROUP_TYPE",
                ],
                "valid": true
            }
        ]
}
curl --location --request PATCH 'https://target-environemnt.tuumaplatform.com/api/v1/roles/privileges/import' \
--header 'Accept-Language: en-GB' \
--header 'x-auth-token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiTGF1cmEgVGVlbcOkZ2kiLCJlbXBsb3llZUlkIjoiSUQtMTM0OCIsInRlbmFudENvZGUiOiJNQiIsImV4cGlyeURUaW1lIjoiMjAyNS0wMy0yMFQxMzoxODowMCIsImV4cCI6MTc0MjQ3NjY4MCwicm9sZXMiOlsiQURNSU4iXX0.FsBEnzSkQdNXqBcl3C2BuPs1OsyYyIBT-efAXyr8sqk' \
--header 'Content-Type: application/json' \
--data '{
        "rolesWithPrivileges": [
            {
                "roleCode": "ACCOUNTANT",
                "privilegeNames": [
                    "ADD_PERSON",
                    "APPROVE_APPLICATIONS",
                    "DISBURSE_LOAN",
                    "EDIT_CONTRACT",
                    "EDIT_LOAN_PRODUCTS",
                    "EDIT_PERSON",
                    "MANAGE_USERS",
                    "SEARCH_CONTRACT_DOCUMENTS",
                    "VIEW_GL_JOURNAL",
                    "VIEW_LOAN_CONTRACT",
                    "VIEW_LOAN_PRODUCTS",
                    "VIEW_PERSON",
                    "VIEW_PERSON_ADDITIONAL_CONTACT",
                    "VIEW_PERSON_GROUP_TYPE"
                ],
                "valid": true
            },
            {
                "roleCode": "TEST_LT",
                "privilegeNames": [
                    "MANAGE_USERS",
                    "READ_RESTRICTED_DATA",
                    "VIEW_EXTERNAL_CONTRACTS",
                    "VIEW_FOUREYE_REVIEW_RULE",
                    "VIEW_PERSON",
                    "VIEW_PERSON_GROUP_TYPE",
                    "VIEW_REVIEW_APPROVALS_CONFIGURATION"
                ],
                "valid": true
            }
        ]
}
'

Sample response

Below you find an example response body to the API call above.

Response
{
    "errors": null,
    "validationErrors": null,
    "data": null
}

Result

The selected valid roles ACCOUNTANT and TEST_LT with related privileges have been imported.

We will import specific roles and associated privileges using the data retrieved in the previous .

The roles and privileges combination was obtained from the endpoint.

https://auth-api.target-environment.tuumplatform.com/api/v1/roles/privileges/import

Learn more about the in the Tuum developer portal.

rolesWithPrivileges": [
            {
                "roleCode": "ACCOUNTANT",
                "privilegeNames": [
                    "ADD_PERSON",
                    "APPROVE_APPLICATIONS",
                    "DISBURSE_LOAN",
                    "EDIT_CONTRACT",
                    "EDIT_LOAN_PRODUCTS",
                    "EDIT_PERSON",
                    "MANAGE_USERS",
                    "SEARCH_CONTRACT_DOCUMENTS",
                    "VIEW_GL_JOURNAL",
                    "VIEW_LOAN_CONTRACT",
                    "VIEW_LOAN_PRODUCTS",
                    "VIEW_PERSON",
                    "VIEW_PERSON_ADDITIONAL_CONTACT",
                    "VIEW_PERSON_GROUP_TYPE"
                ],
                "valid": true
            },
            {
                "roleCode": "TEST_LT",
                "privilegeNames": [
                    "MANAGE_USERS",
                    "READ_RESTRICTED_DATA",
                    "VIEW_EXTERNAL_CONTRACTS",
                    "VIEW_FOUREYE_REVIEW_RULE",
                    "VIEW_PERSON",
                    "VIEW_PERSON_GROUP_TYPE",
                    "VIEW_REVIEW_APPROVALS_CONFIGURATION"
                ],
                "valid": true
            }
export selected roles example
endpoint
Export selected roles