Beanshell script to display all the entitlements assigned to an identity:
import java.util.List;
import java.util.Iterator;
import sailpoint.object.*;
Identity user = context.getObjectByName(Identity.class,"Richard.Jackson");
System.out.println("Identity Name =" + user.getName());
// Get the list of entitlements
List<EntitlementGroup> entitlementGroup = user.getExceptions();
if (entitlementGroup != null) {
System.out.println("Entitlements assigned: ");
for(EntitlementGroup entGrp : entitlementGroup){
List<String> entitlements = entGrp.getAttributes().getMap().get("groupmbr");
for (String ent: entitlements){
System.out.println(ent);
}
}
}
Execute the rule and check the results:
Comment below if you find this post helpful.
No comments:
Post a Comment