meteor-roles icon indicating copy to clipboard operation
meteor-roles copied to clipboard

[v2.0] support onlyAssigned option for method getUsersInRole

Open jsamr opened this issue 9 years ago • 3 comments

Use case In my model, 'project.member' is a sub-role of 'project.manager'. If I want a list of all project members that are not managers, AFAIK I cannot yet. Well yes, I can filter the output of getUsersInRole but that's not convenient.

Solution The method getRolesForUser already support this option :

onlyAssigned: return only assigned roles and not automatically inferred (like subroles)

So basically, the idea is to filter users which role param has an assigned:true field, perhaps using Roles._onlyAssignedMatcher method.

jsamr avatar Feb 01 '16 07:02 jsamr

Can you elaborate?

mitar avatar Feb 01 '16 07:02 mitar

I updated the above comment.

jsamr avatar Feb 01 '16 18:02 jsamr

Yes, this sounds reasonable. Pull request welcome.

mitar avatar Apr 04 '16 06:04 mitar