Hi
Is there a way to find what all entitlements exists in bundle using queryOptions and filter
I am trying Filter.like(“profiles.profile.constraints”, “abc”);
But its not working
Need to find a way to filter the role with an entitlement
Thanks
Hi
Is there a way to find what all entitlements exists in bundle using queryOptions and filter
I am trying Filter.like(“profiles.profile.constraints”, “abc”);
But its not working
Need to find a way to filter the role with an entitlement
Thanks
Are you looking to query all roles(bundles) which include a particular entitlement in entitlement profile? The following sample code does that. It returns both IT role and Business role( that has the IT role included as required roles).
String entilementVal = "CN=Employees,OU=Groups,OU=Demo,DC=TEST,DC=XYZ,DC=COM";
List roles = new ArrayList();
QueryOptions qo = new QueryOptions();
Filter profileValueFilter = Filter.ignoreCase(Filter.like("value", entilementVal));
Filter subqueryFilter = Filter.subquery("id", BundleProfileRelation.class, "bundleId", profileValueFilter);
qo.add(subqueryFilter);
Iterator roleItr = context.search(Bundle.class,qo,"name");
while(roleItr.hasNext()){
roles.add(roleItr.next()[0]);
}
return roles;
@maniG if you need all entitlement from bundle then you can make method like below
public List getgroupsfromRole(SailpointContext ctx, List roles) {
List groups = new ArrayList();
for(String role : roles) {
Bundle roleObj = ctx.getObjectByName(Bundle.class, role);
roleObj.load();
List reqRoles = roleObj.getRequirements();
for (Bundle itR : reqRoles){
List p = itR.getProfiles();
for(Profile pr : p) {
List listF = pr.getConstraints();
int size = listF.size();
for(int i = 0; i < size; i++) {
if(listF.get(i) isntanceof LeafFilter) {
LeafFilter filter = (LeafFilter) listF.get(i);
Object value = filter.getValue();
if(value instanceof ArrayList) {
ArrayList listEnt = new ArrayList();
listEnt = (ArrayList) value;
groups.addAll(listEnt);
}
}
}
}
}
}
return groups;
}
Syntax might you need to fix. but logic should be around that.
Some threads that will help
Thank you @SanjeevIAM
Thank you @pravin_ranjan
@SanjeevIAM, Is there a way to add the application also in the same filter in addition to the entitlement ?
try to make a combined subquery filter. should be like
Filter combinedSubqueryFilter = Filter.and(profileValueFilter, sourceAppFilter);
Filter subqueryFilter = Filter.subquery("id", BundleProfileRelation.class, "bundleId", combinedSubqueryFilter);
How to add filter for application here
I tried Filter sourceAppFilter = Filter.like(“application.name”, applicationName);
But its not working
your query should be like
Filter sourceAppFilter = Filter.eq("sourceApplication.name", "APPNAME");
Filter sourceAppSubquery = Filter.subquery("id", BundleProfileRelation.class, "bundleId", sourceAppFilter);
better you can make a query in Advance analytics and search for role with 2 options.
that will give you exact query. you have to readjust it.
Yes you should be able to use this
String entilementVal = "CN=Employees,OU=Groups,OU=Demo,DC=TEST,DC=XYZ,DC=COM";
List roles = new ArrayList();
QueryOptions qo = new QueryOptions();
Filter sourceNameFilter = Filter.eq("sourceApplication.name", "Active Directory");
Filter profileValueFilter = Filter.ignoreCase(Filter.like("value", entilementVal));
Filter filter = Filter.and(sourceNameFilter,profileValueFilter);
Filter subqueryFilter = Filter.subquery("id", BundleProfileRelation.class, "bundleId", filter);
qo.add(subqueryFilter);
Iterator roleItr = context.search(Bundle.class,qo,"name");
while(roleItr.hasNext()){
roles.add(roleItr.next()[0]);
}
return roles;
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.