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/apps/meteor/app/authorization/server/functions/hasPermission.ts

15 lines
770 B

import { Authorization } from '@rocket.chat/core-services';
import type { IUser, IPermission, IRoom } from '@rocket.chat/core-typings';
export const hasAllPermissionAsync = async (
userId: IUser['_id'],
permissions: IPermission['_id'][],
scope?: IRoom['_id'],
): Promise<boolean> => Authorization.hasAllPermission(userId, permissions, scope);
export const hasPermissionAsync = async (userId: IUser['_id'], permissionId: IPermission['_id'], scope?: IRoom['_id']): Promise<boolean> =>
Authorization.hasPermission(userId, permissionId, scope);
export const hasAtLeastOnePermissionAsync = async (
userId: IUser['_id'],
permissions: IPermission['_id'][],
scope?: IRoom['_id'],
): Promise<boolean> => Authorization.hasAtLeastOnePermission(userId, permissions, scope);