Share all details related to your problem, including any error messages you may have received.
I’ve been working on implementing an exclusion rule for targeted certification, aiming to exclude detected roles and non-requestable entitlements. While I’ve successfully excluded roles as expected, I’m facing challenges with accurately excluding non-requestable entitlements. For certain users, the exclusion process works for some non-requestable entitlements but not for others. Could someone please help me identify the issue and provide guidance on resolving it?
for (Certifiable certifiable : items) { // here we iteriating entitlement also
//log.error("entering for loop");
if (certifiable instanceof EntitlementGroup) {
Attributes attributes = certifiable.getAttributes();
log.error("managed attribute EntitlementGroup: "+certifiable.toXml());
log.error("managed attribute attributes: "+attributes);
if (attributes != null)
{
if (attributes.containsKey("memberOf")) {
String entitlementGroupName = attributes.get("memberOf");
Filter myFilter1 = Filter.eq("ManagedAttribute.value", entitlementGroupName);
QueryOptions queryOption = new QueryOptions();
queryOption.addFilter(myFilter1);
Iterator itr = null;
itr = context.search(ManagedAttribute.class, queryOption);
while (itr.hasNext()) {
ManagedAttribute managedAttribute=itr.next();
log.error("Managed Attribute displayName: "+managedAttribute.getDisplayName());
log.error("Managed Attribute is requestable or not: "+managedAttribute.isRequestable());
if (managedAttribute == null || !managedAttribute.isRequestable()) {
log.error("Excluding non-requestable managed attribute: "+managedAttribute.getDisplayName());
itemsToExclude.add(certifiable);
explanation = "Excluding non-requestable managed attribute: ";
}
}
}
}
}
After adding the else condition, I realized that “groups” is also one of the attributes , but memberof entitlement is still not being properly excluded for some users . could you please help me on this
In your code, if there is no ManagedAttribute found, the while loop will not execute (its.hasNext() will return false). Also, if itr.hasNext() returns true, itr.next() will not return null, so you do not need to check managedAttribute == null.