mirror of
https://github.com/meteor/meteor.git
synced 2026-01-10 08:08:24 -05:00
corrected the return type and added an example (#13724)
This commit is contained in:
@@ -1040,7 +1040,7 @@ Object.assign(Roles, {
|
||||
},
|
||||
|
||||
/**
|
||||
* @summary Retrieve all users who are in target role.
|
||||
* @summary Retrieve a cursor of all users who are in the target role.
|
||||
* @memberof Roles
|
||||
* @locus Anywhere
|
||||
* @param {Array|String} roles Name of role or an array of roles.
|
||||
|
||||
@@ -225,23 +225,26 @@ const customRoles = Roles.getAllRoles({
|
||||
Example:
|
||||
|
||||
```js
|
||||
// returns a cursor of all admin users
|
||||
const adminUsersCursor = await Roles.getUsersInRoleAsync("admin");
|
||||
|
||||
// Find all admin users
|
||||
const adminUsers = await Roles.getUsersInRoleAsync("admin");
|
||||
const adminUsers = await (await Roles.getUsersInRoleAsync("admin")).fetchAsync();
|
||||
|
||||
// Find users with specific roles in a scope
|
||||
const scopedUsers = await Roles.getUsersInRoleAsync(
|
||||
const scopedUsers = await (await Roles.getUsersInRoleAsync(
|
||||
["editor", "writer"],
|
||||
"blog"
|
||||
);
|
||||
)).fetchAsync();
|
||||
|
||||
// Find users with custom options
|
||||
const users = await Roles.getUsersInRoleAsync("manager", {
|
||||
const users = await (await Roles.getUsersInRoleAsync("manager", {
|
||||
scope: "department-a",
|
||||
queryOptions: {
|
||||
sort: { createdAt: -1 },
|
||||
limit: 10,
|
||||
},
|
||||
});
|
||||
})).fetchAsync();
|
||||
```
|
||||
|
||||
## Checking Roles
|
||||
|
||||
Reference in New Issue
Block a user