Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Stardust/Knowledge Base/API/JavaAPICookbook/CheckingUserSpecificRole
< Stardust | Knowledge Base
Purpose
There are instances where you need to find if a particular user is assigned under a specific role.You don't have to iterate over a list of grants to achieve this.
Solution
QueryService qs = sf.getQueryService(); UserQuery userQuery = new UserQuery(); userQuery.getFilter().add(UserQuery.ACCOUNT.isEqual("Bang")); //User ParticipantInfo pInfo = qs.getParticipant("Administrator"); //Role, This can be model specific userQuery.where(ParticipantAssociationFilter.forParticipant(pInfo)); User retUser = qs.findFirstUser(userQuery); System.out.println("retUser:::::::::" + retUser);