Meteor-Community-Packages/meteor-roles

[v2.0] support onlyAssigned option for method getUsersInRole

開放

#177 建立於 2016年2月1日

 (3 則留言) (0 個反應) (0 位負責人)JavaScript (161 個分叉)batch import
enhancementgood first issuehelp wanted

倉庫指標

星標
 (919 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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.

貢獻者指南