diff --git a/apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts b/apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts index d33c08f6e696..dc1a1a6cbc85 100644 --- a/apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts +++ b/apps/meteor/app/livechat/server/roomAccessValidator.internalService.ts @@ -9,7 +9,7 @@ export class AuthorizationLivechat extends ServiceClassInternal implements IAuth protected internal = true; - async canAccessRoom(room: IOmnichannelRoom, user: Pick, extraData?: object): Promise { + async canAccessRoom(room: IOmnichannelRoom, user?: Pick, extraData?: object): Promise { for (const validator of validators) { if (validator(room, user, extraData)) { return true; diff --git a/apps/meteor/server/sdk/types/IAuthorization.ts b/apps/meteor/server/sdk/types/IAuthorization.ts index 1e8e670d54a3..4ea68135c517 100644 --- a/apps/meteor/server/sdk/types/IAuthorization.ts +++ b/apps/meteor/server/sdk/types/IAuthorization.ts @@ -2,7 +2,7 @@ import type { IRoom, IUser } from '@rocket.chat/core-typings'; export type RoomAccessValidator = ( room: Pick, - user: Pick, + user?: Pick, extraData?: Record, ) => Promise; @@ -11,5 +11,5 @@ export interface IAuthorization { hasPermission(userId: string, permissionId: string, scope?: string): Promise; hasAtLeastOnePermission(userId: string, permissions: string[], scope?: string): Promise; canAccessRoom: RoomAccessValidator; - canAccessRoomId(rid: IRoom['_id'], uid: IUser['_id']): Promise; + canAccessRoomId(rid: IRoom['_id'], uid?: IUser['_id']): Promise; } diff --git a/apps/meteor/server/sdk/types/IAuthorizationLivechat.ts b/apps/meteor/server/sdk/types/IAuthorizationLivechat.ts index 0fa37808433e..0fb4ffcca8bd 100644 --- a/apps/meteor/server/sdk/types/IAuthorizationLivechat.ts +++ b/apps/meteor/server/sdk/types/IAuthorizationLivechat.ts @@ -1,5 +1,5 @@ import type { IOmnichannelRoom, IUser } from '@rocket.chat/core-typings'; export interface IAuthorizationLivechat { - canAccessRoom: (room: IOmnichannelRoom, user: Pick, extraData?: Record) => Promise; + canAccessRoom: (room: IOmnichannelRoom, user?: Pick, extraData?: Record) => Promise; } diff --git a/apps/meteor/server/services/authorization/canAccessRoom.ts b/apps/meteor/server/services/authorization/canAccessRoom.ts index 4ff441cf63c8..7552f0eeabe4 100644 --- a/apps/meteor/server/services/authorization/canAccessRoom.ts +++ b/apps/meteor/server/services/authorization/canAccessRoom.ts @@ -7,7 +7,7 @@ import { RoomAccessValidator } from '../../sdk/types/IAuthorization'; import { canAccessRoomLivechat } from './canAccessRoomLivechat'; import { canAccessRoomVoip } from './canAccessRoomVoip'; -async function canAccessPublicRoom(user: Partial): Promise { +async function canAccessPublicRoom(user?: Partial): Promise { if (!user?._id) { // TODO: it was using cached version from /app/settings/server/raw.js const anon = await Settings.getValueById('Accounts_AllowAnonymousRead');