Meteor-Community-Packages/meteor-roles

[v2.0] support onlyAssigned option for method getUsersInRole

Offen

#177 geöffnet am 01.02.2016

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (161 Forks)batch import
enhancementgood first issuehelp wanted

Repository-Metriken

Stars
 (919 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

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.

Contributor Guide