Hello Experts,
I am trying to do the following on IIQ Rule Beanshell script:
- Get all the assigned roles of the identity.
- From the returned results of assigned roles, check if any of the roles matches “SAP”.
The following is a snippet of the codes:
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import sailpoint.api.ExternalAttributeHandler;
import sailpoint.tools.Util;
import sailpoint.object.Attributes;
import sailpoint.object.Identity;
import sailpoint.tools.GeneralException;
import sailpoint.object.ProvisioningPlan;
import sailpoint.api.Provisioner;
logger.debug("getAssignedRoles: " + identity.getAssignedRoles());
logger.debug("Contain getAssignedRoles: " + identity.getAssignedRoles().contains("SAP"));
The following is a sample of the logger debug output from above codes:
2022-12-28T20:47:02,418 DEBUG QuartzScheduler_Worker-3 mzlogger:166 - getAssignedRoles: [sailpoint.object.Bundle@585debd0[id=0a0000b285051603818505d59e42009b,name=SAP-OM-S50000068]]
2022-12-28T20:47:02,419 DEBUG QuartzScheduler_Worker-3 mzlogger:166 - Contain getAssignedRoles: false
From the logger debug, the contain() results shows “false”, which is not what I’m expecting. It should show “true” because it does contain the value I’m looking for.
From the IIQ javadoc documentation, I noticed that the getAssignedRoles() method is a type of java.util.List.
Does anyone have any idea how can I perform a contain on said method?
Thank you in advanced!
Regards,
Ming Zheng