We have a use case where the when all the entitlements are removed from a user, the account needs to be deleted at the target application. There is an API available with operation = DELETE which works perfect when used under “Delete Account” operation.
However, we need to call the same API from “Remove Entitlement” operation when all current entitlements are marked to be removed.
What have you tried?
If list of entitlements being removed match the list of current list of entitlements, then update using the below line
`requestEndPoint.setOperationType("DELETE");`
What errors did you face (share screenshots)?
No effect. DELETE API was not called
Share the details of your efforts (code / search query, workflow json etc.)?
if (roleIds.isEmpty()) requestEndPoint.setOperationType("DELETE");
else updateRolesOfUser(nativeId, roleIds);
Good question! I can see what you’re trying to achieve.
Perhaps requestEndPoint.setOperationType(“DELETE”) won’t change the HTTP operation. From the java doc it seems setOperationType method sets the logical operation type but curious how it can take effect in the connector. Would you mind logging the operation and sharing: -
// Log the initial operation type
log.info("Initial operation type: " + requestEndPoint.getOperationType()); log.info("HTTP method type: " + requestEndPoint.getHttpMethodType());
if (roleIds.isEmpty()) {
// Define URL, header and allowed statuses separately if need be.
Map header = requestEndPoint.getHeader();
List allowedStatuses = new ArrayList();
allowedStatuses.add( "2**" );
String baseUrl = application.getAttributeValue("genericWebServiceBaseUrl")
String url = baseUrl + "/api/Users" + nativeId
String response = restClient.executeDelete(url, header, allowedStatuses);
}
You could let the remove entitlement operation complete and perform this logic in a WebServicesAfterOperation rule as well. You might still need to return a dummy account, preferably disabled as the actual operation would have been modfiy in the provisioningPlan.