Share all details about your problem, including any error messages you may have received.
I have written a main method to fetch the identities associated with a role. The input is giving the role name, what i have observed is if i am passing role of type Business i am getting the list of identities who are having the given role. But if i am passing any permitted IT role i am not to fetch the identities.
Here is my logic below:
* private static List<Identity> fetchAllIdentityBasedOnRole(Bundle bundle) throws GeneralException, SQLException { String roleType = bundle.getType(); System.out.println("Role Name: " + bundle.getName()); System.out.println("Role Type: " + roleType); QueryOptions queryOptions = new QueryOptions(); queryOptions.addFilter(Filter.containsAll("assignedRoles", Util.asList(bundle))); Iterator<Identity> search = context.search(Identity.class, queryOptions); List<Identity> identities = new ArrayList<>(); while (search.hasNext()) { Identity identity = search.next(); identities.add(identity); } return identities; }*
I have seen that in Sailpoint UI the permitted roles are present in the “Detected Role Summary” for an Identity.
Can you let me know how can i fetch the Identities associated with a role which is a permitted IT role
In your code, you have added the filter on assignedRoles. If you are using OOTB Role Access Request flow or RBAC, then only Business Roles will be coming as Assigned roles.
To get the IT Roles, use detectedRoles in place of assignedRoles.
Error while testing: could not resolve property: detectedRoles of: sailpoint.object.Identity sailpoint.tools.GeneralException: could not resolve property: detectedRoles of: sailpoint.object.Identity
@msingh900 I will not have the Identity as input for my code, my input will be Role name so i need to fetch all the identities that are having this role. I have seen in my sailPoint UI that the business role are present in the Assigned role summary tab and the permitted roles of a business role which are basically of type IT are present in the Detected Role summary tab for an Identity in the Identity warehouse.
I want a logic based on the role name wanted to fetch all the Identities associated with it.
SELECT spt_identity.name, spt_bundle.name
from spt_identity, spt_bundle, spt_identity_bundles
where spt_identity.id = spt_identity_bundles.identity_id
and spt_bundle.id = spt_identity_bundles.bundle
AND spt_bundle.name = "<Your Role Name>"
group by spt_identity.name;
SELECT spt_identity.name, spt_bundle.name
from spt_identity, spt_bundle, spt_identity_bundles
where spt_identity.id = spt_identity_bundles.identity_id
and spt_bundle.id = spt_identity_bundles.bundle
AND spt_bundle.name = "<Your Role Name>"
group by spt_identity.name;
Execute the above query. Write a java method that executes query and get you the results.
For the above query it has given me only one record on passing a Business role.
But when i used the below query
select id.name AS identity_name, id.display_name, id.email, id.assigned_role_summary from spt_identity id where id.assigned_role_summary LIKE ‘%<your role name">%’;
then it gave me total 5 records as compared both queries with Sailpoint UI what i have observed is your query is fetching the role present in Detected Role Summary tab, but the query i used is fetching from the Assigned Role Summary tab from sailPoint UI.
I don’t want to use a DB query. Later this logic i will be considering this as a Task.
Hello @msingh900 I tried this logic but i am able to get the detectedRoles but here it is fetching all the Identities which i feel is not that sufficient enough. So I have used a logic where i have used “bundles.name” like the one @Chathurya has shared. But anyways Thanks for the support. It helped me a lot.