Skip to content

Commit

Permalink
Merge pull request #1 from hzwzw/Issue-#33
Browse files Browse the repository at this point in the history
  • Loading branch information
hzwzw authored Aug 8, 2018
2 parents 5a19043 + 74fbbb1 commit 6eb659f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grouping.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Partitioner.directOperation = (func) ->
Partitioner._directOps.withValue(true, func);

# This can be replaced - currently not documented
Partitioner._isAdmin = (userId) -> Meteor.users.findOne(userId).admin is true
Partitioner._isAdmin = (userId) -> Meteor.users.findOne(userId, {fields: groupId: 1, admin: 1}).admin is true

getPartitionedIndex = (index) ->
defaultIndex = { _groupId : 1 }
Expand Down Expand Up @@ -112,7 +112,7 @@ userFindHook = (userId, selector, options) ->
return true if (!userId and !groupId)

unless groupId
user = Meteor.users.findOne(userId)
user = Meteor.users.findOne(userId, {fields: groupId: 1, admin: 1})
groupId = Grouping.findOne(userId)?.groupId
# If user is admin and not in a group, proceed as normal (select all users)
return true if user.admin and !groupId
Expand Down

0 comments on commit 6eb659f

Please sign in to comment.