Closed Alex-Mason-1982 closed 4 years ago
I have to admit, I've been really bad in keeping the documentation updated ...
This shows that the function getUsersInRole()
accepts two parameters:
{Array|String} roles
Name of role or an array of roles. If array, users returned will have at least one of the roles specified but need not have all roles.{Object|String} [options]
Options:
scope
: name of the scope to restrict roles to; user's global roles will also be checked anyScope
: if set, role can be in any scope (scope
option is ignored) queryOptions
: options which are passed directly through to Meteor.users.find(query, options)
I guess what you want is getUsersInRole(['admin'], { anyScope: true })
or am I mistaken?
Excellent. that is exactly what i was looking for. thank you for your reply.
is there a way to fetch roles across scopes? I've been looking for a while now and cant seem to find the option. I was hoping to be able fetch everyone in a particular role no matter the scope (for things like staff lists).
eg. you have 2 users user1: [{role: 'admin', scope: 'scope1'}] user2: [{role: 'admin', scope: 'scope2'}]
as far as i can tell getUsersInRole(['admin']) will return [] getUsersInRole(['admin'], 'scope1') will return [user1] getUsersInRole(['admin'], 'scope2') will return [user2]
is there an option that will do the following? getUsersInRole(['admin'], SOME_OPTION_HERE) that will return [user1, user2]