javajbossjava-ee-6picketlink

Picketlink: finding users with given role


I configured a JPA store and see users and roles getting added correctly to the db when I call the related picketlink (2.7.1) API's

My questions is this: how does one get a list of all users that have a given role?

I tried doing this using the following RelationshipQuery

RelationshipQuery<Grant> rq = relationshipManager.createRelationshipQuery(Grant.class);
rq.setParameter(Grant.ROLE, role);
List<Grant> grants = rq.getResultList()

But the resulting grant list contains a single assignment grant, that refers to the last user in the database that has that role.

I checked the example queries in the documentation and tests but found nothing that does what I want. I know the project is no longer active but am hoping to find a solution to this.


Solution

  • Found out that role data wasn't imported correctly from the old db. Once I fixed that the above code worked as expected.