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/api/server/helpers/isUserFromParams.ts

14 lines
486 B

import type { IUser } from '@rocket.chat/core-typings';
export function isUserFromParams(
params: { userId?: string; username?: string; user?: string },
loggedInUserId?: string,
loggedInUser?: IUser,
): boolean {
return Boolean(
(!params.userId && !params.username && !params.user) ||
(params.userId && loggedInUserId === params.userId) ||
(params.username && loggedInUser?.username === params.username) ||
(params.user && loggedInUser?.username === params.user),
);
}