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/server/services/authorization/canAccessRoomVoip.ts

18 lines
756 B

import { Rooms } from '@rocket.chat/models';
import type { IAuthorizationVoip, RoomAccessValidator } from '@rocket.chat/core-services';
import { proxifyWithWait } from '@rocket.chat/core-services';
const AuthorizationVoip = proxifyWithWait<IAuthorizationVoip>('authorization-livechat');
export const canAccessRoomVoip: RoomAccessValidator = async (room, user, extraData): Promise<boolean> => {
// room can be sent as `null` but in that case a `rid` is also sent on extraData
// this is the case for file uploads
const voipRoom = room || (extraData?.rid && (await Rooms.findOneById(extraData?.rid)));
if (voipRoom?.t !== 'v') {
return false;
}
// Call back core temporarily
return AuthorizationVoip.canAccessRoom(voipRoom, user, extraData);
};