<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" name="Get-All-Entitlements-Of-User">
<Signature returnType="String">
<Inputs>
<Argument name="log">
<Description>
The log object is associated with the SailPointContext.
</Description>
</Argument>
<Argument name="context">
<Description>
A sailpoint.api.SailPointContext object that can be used to query the database if necessary.
</Description>
</Argument>
<Argument name="link">
<Description>
The Link is being inspected.
</Description>
</Argument>
</Inputs>
<Returns>
<Argument name="daysTillExpiration">
<Description>
The number of days before password expiration. If the number is negative then the password has expired, if the number is positive then a notification should be sent out, otherwise, a null value is returned indicating no notification is necessary.
</Description>
</Argument>
</Returns>
</Signature>
<Source>
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import sailpoint.api.SailPointContext;
import sailpoint.object.Application;
import sailpoint.object.Attributes;
import sailpoint.object.EntitlementGroup;
import sailpoint.object.Identity;
List finalList = new ArrayList();
String userName = "beereddy";
Identity identity = context.getObjectByName(Identity.class, userName);
if(identity != null @and identity.getExceptions() != null){
List entGrps = identity.getExceptions();
if (entGrps != null @and !entGrps.isEmpty()) {
Iterator egItr = entGrps.iterator();
while (egItr.hasNext()) {
EntitlementGroup entEg = (EntitlementGroup) egItr.next();
if (entEg != null) {
if (entEg.getAttributes() != null) {
finalList.add(entEg.getAttributes().getMap().get("memberOf"));
}
}
}
return finalList;
}
}
</Source>
</Rule>
No comments:
Post a Comment