The identity.getAssignedRoles() method is returning null in a Policy Violation rule under Advanced Policy.
Below is the piece of code.
import sailpoint.object.Identity;
import sailpoint.object.Bundle;
import sailpoint.object.PolicyViolation;
import java.util.List;
log.error(“Inside Violation”);
PolicyViolation violation = null;
boolean vflag = false;
String desc = null;
Identity reqIdentity = identity;
log.error(“Requested ID:”+reqIdentity.toXml());
Identity dbIdentity = context.getObjectByName(Identity.class, identity.getName());
log.error(“Existing ID:”+dbIdentity.toXml());
List dbIdRoles = dbIdentity.getAssignedRoles();
log.error(“Existing Roles:”+dbIdRoles);
List reqIdRoles = reqIdentity.getAssignedRoles();
log.error(“Requested Roles:”+reqIdRoles);
if((reqIdRoles != null && !reqIdRoles.isEmpty()) && (dbIdRoles != null && !dbIdRoles.isEmpty())) {
reqIdRoles.removeAll(dbIdRoles);
log.error(“Final Requested Roles:”+reqIdRoles);
}
log.error(“Requested Roles Size:”+reqIdRoles.size());
if (reqIdRoles.size() > 20 ) {
vflag = true;
desc = “You should not request for more that 20 request Items at a Time”;
}
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;
Is there a way to get it? Please advise
Note : This is to limit each Identity Request in SailPoint to carry no more than 20 request items.