The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/authorization/server/functions/getUsersInRole.ts

26 lines
846 B

import { Cursor, FindOneOptions, WithoutProjection } from 'mongodb';
import { IRole, IUser } from '../../../../definition/IUser';
import { Roles } from '../../../models/server/raw';
export function getUsersInRole(name: IRole['name'], scope?: string): Promise<Cursor<IUser>>;
export function getUsersInRole(
name: IRole['name'],
scope: string | undefined,
options: WithoutProjection<FindOneOptions<IUser>>,
): Promise<Cursor<IUser>>;
export function getUsersInRole<P = IUser>(
name: IRole['name'],
scope: string | undefined,
options: FindOneOptions<P extends IUser ? IUser : P>,
): Promise<Cursor<P extends IUser ? IUser : P>>;
export function getUsersInRole<P = IUser>(
name: IRole['name'],
scope: string | undefined,
options?: any | undefined,
): Promise<Cursor<IUser | P>> {
return Roles.findUsersInRole(name, scope, options);
}