Role Assignment Report

Generates a Role Assignment Report (.CSV). This report lists the predefined roles (for example, Service Administrator) and application roles (for example, Approvals Ownership Assigner, Approvals Supervisor, Approvals Administrator, and Approvals Process Designer, which are Planning application roles) assigned to users. This report matches the CSV version of the Role Assignment Report generated from Access Control. Additionally, it can generate reports containing Identity Domain Administrator on the system by specifying the user type. The API writes the report to the filename provided, and the report can then be downloaded using the Download REST API.

This is an asynchronous job and uses the job status URI to determine if the operation is complete.

The presence of status -1 in the response indicates that the generation of Role Assignment Report is in progress. Use the job status URI to determine whether the generation of Role Assignment Report is complete. Any non-zero status except -1 indicates failure of generating Role Assignment Report.

This API is version v1.

Required Roles

Service Administrator or Access Control Manager

Table 12-76 User Assignment Report

Task Request REST Resource
Role Assignment Report POST

/interop/rest/security/{api_version}/roleassignmentreport/

Role Assignment Report Status GET

/interop/rest/security/{api_version}/jobs/{jobId}

REST Resource

POST /interop/rest/security/{api_version}/roleassignmentreport

Note:

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.

Request

Supported Media Types: application/x-www-form-urlencoded

The following table summarizes the request parameters.

Table 12-77 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
filename File name for the file where the report is to be populated, such as roleAssignmentReport.csv Form Yes None
usertype User type for which to generate the report. This paramenter is optional. If provided values can be either ServiceUsers or IDAdmins. Form No ServiceUsers

Response

Supported Media Types: application/json

Table 12-78 Parameters

Parameters Description
details In case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Can be self and/or Job Status. If set to Job Status, you can use the href to get the status of the import operation
data Parameters as key value pairs passed in the request

Examples of Response Body

The following show examples of the response body in JSON format.

Response 1: Example when job is in progress:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": "<filename>"
                "usertype": "<USER_TYPE>"
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobId>",
            "rel": "Job Status"
        }
    ],
    "status": -1,
    "details": null,
    "items": null
}

Response 2: Example when job completes with errors:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": "<filename>"
                "usertype": "<USER_TYPE>"
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/{api_version}/roleassignmentreport",
            "rel": "self"
        }
    ],
    "status": 1,
    "details": "EPMCSS-20665: Failed to generate Role Assignment Report. Invalid or insufficient parameters are specified. Provide all required parameters for the REST API. ",
    "items": null
}

Response 3: Example when job completes without errors:

{
    "links": [
        {
            "data": null,
            "action": "GET",
            "href": " https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobID>",
            "rel": "self"
        }
    ],
    "status": 0,
    "details": null,
    "items": null
}

Example 12-34 Java Sample Code

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Java

public void generateRoleAssignmentReport(String filename, String userType) {
		try {
			String url = this.serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport";
			Map<String, String> reqHeaders = new HashMap<String, String>();
			reqHeaders.put("Authorization", "Basic " + DatatypeConverter
					.printBase64Binary((this.userName + ":" + this.password).getBytes(Charset.defaultCharset())));

			Map<String, String> reqParams = new HashMap<String, String>();
			reqParams.put("filename", filename);
                    reqParams.put("usertype", userType);
		
			Map<String, String> restResult = CSSRESTHelper.callRestApi(new HashMap(), url, reqHeaders, reqParams,
					"POST");
			String jobStatus = CSSRESTHelper.getCSSRESTJobCompletionStatus(restResult, reqHeaders);
			System.out.println(jobStatus);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

Example 12-35 Shell Script Sample code

Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)

Common Functions: See CSS Common Helper Functions for cURL

funcGenerateRoleAssignmentReport() {
        url="$SERVER_URL/interop/rest/security/$API_VERSION/roleassignmentreport"
        params="filename=$1&usertype=$2"
        header="Content-Type: application/x-www-form-urlencoded;charset=UTF-8"
        cssRESTAPI="generateRoleAssignmentReport"
        statusMessage=$(funcCSSRESTHelper "POST" "$url" "$header" "$USERNAME" "$PASSWORD" "$params" "$cssRESTAPI")
        echo $statusMessage
}	

Example 12-36 Groovy Sample Code

Common Functions: See CSS Common Helper Functions for Groovy

def generateRoleAssignmentReport(filename, userType) {

	String scenario = "Generating Role assignment report in " + filename + " with usertype as " + userType;
	String params = "jobtype=GENERATE_ROLE_ASSIGNMENT_REPORT&filename="+ filename "&usertype=" + userType;
	def url = null;
	def response = null;
	try {
		url = new URL(serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport");
	} catch (MalformedURLException e) {
		println "Please enter a valid URL"
		System.exit(0);
	}
	response = executeRequest(url, "POST", params, "application/x-www-form-urlencoded");
	if (response != null) {
		getJobStatus(getUrlFromResponse(scenario, response, "Job Status"), "GET");
	}
}