Hello Sailors,
If you would like to prevent user from submitting a Request for any business use cases
- User should not have both approver and requestor Roles
- User should not have more than 1 Role at a time
- User who has account in application already can only request for the additional groups
- Only some department users can request for the Role or Entitlement
- Or any custom condition(s)
It is better to prevent the false request instead of depending on approvals, assuming that approver anyway will reject the request.
We have two types of policy violations
- Preventive: Preventing user from having a specific access through LCM
- Detective: Detecting violations for the access user already have
We will look into Preventive one here, we have couple of OOTB SoD Policy violation concepts.
- Role SoD: You can use it if user should not have more than 1 Role at a time
- Entitlement SoD: You can restrict entitlement requests based on some conditions
But the challenge with these are a lot of combinations you need to configure and not all the requirements can be implemented, that is where Advanced Policy Violation is useful.
As the name indicates, you can use it for complex customizations which are not feasible with OOTB.
You need a Rule for Advanced Policy implementation which is a bit tricky, let us go through the coding.
- Import the libraries, import only you need and do not use *
import sailpoint.object.Identity;
import sailpoint.object.Bundle;
import sailpoint.object.PolicyViolation;
import java.util.List;
- Declare the Policy variables
PolicyViolation violation = null;
boolean vflag = false;
String desc = null;
- You don’t get Plan as input, only identity you get in the Rule. This is optimistic Identity. What is that mean ?
SailPoint considers that the requested access will be approved, so requested access is included in Identity.
We should get Identity from DB which doesn’t have the requested access.
Identity reqIdentity = identity;
Identity dbIdentity = context.getObjectByName(Identity.class, identity.getName());
- Now you have 2 identities, one with requested access and other one without the requested access. If you get access from both identities and compare/subtract then you get the requested access.
List dbIdRoles = dbIdentity.getAssignedRoles();
List reqIdRoles = reqIdentity.getAssignedRoles();
- Optimistic (Requested) Identity will have both existing and requested Roles, so let’s subtract them to get just the requested ones
if(reqIdRoles != null && !reqIdRoles.isEmpty() && dbIdRoles != null && !dbIdRoles.isEmpty()) {
reqIdRoles.removeAll(dbIdRoles);
}
- Add the conditions, if reqIdRoles size is more than 1 then set the violation flag as true and set the violation description which is presented to the requestor.
if (reqIdRoles.size() > 1 ) {
vflag = true;
desc = "You should not have more than 1 Role";
}
- Set the violation object
if (vflag) {
violation = new PolicyViolation();
violation.setActive(true);
violation.setIdentity(identity);
violation.setPolicy(policy);
violation.setConstraint(constraint);
violation.setDescription(desc);
violation.setStatus(sailpoint.object.PolicyViolation.Status.Open);
}
return violation;
Policy gets executed 2 times
- Without considering the requested access, just to check if user is already in violation before placing the current request. If user is already in violation then no need to throw one more
- By considering the requested access
- So, you need write the condition #6 in such a way that violation is true in 2nd execution only. That is why I am subtracting the Roles. In 1st execution Roles list will be empty as both Identities will have same (existing) access.
You can implemented any kind of complex and customized Policy Violations using this feature. You do not need to purchase SAP GRC module, you can implement all of them inside SailPoint itself.
There will be a debate, why should we develop again when we can use already existing one. Well, I agree on that as well, if you are reqdy to pay for that cool, if not then make use of Advanced Policy Violation.
Hope this helps you
Thanks
Krish