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/tokenpass/server/roomAccessValidator.interna...

21 lines
771 B

import { ServiceClassInternal } from '../../../server/sdk/types/ServiceClass';
import { validators } from './roomAccessValidator.compatibility';
import { IAuthorizationTokenpass } from '../../../server/sdk/types/IAuthorizationTokenpass';
import { IRoom } from '../../../definition/IRoom';
import { IUser } from '../../../definition/IUser';
export class AuthorizationTokenpass extends ServiceClassInternal implements IAuthorizationTokenpass {
protected name = 'authorization-tokenpass';
protected internal = true;
async canAccessRoom(room: Pick<IRoom, '_id' | 't' | 'teamId' | 'prid' | 'tokenpass'>, user: Pick<IUser, '_id'>): Promise<boolean> {
for (const validator of validators) {
if (validator(room, user)) {
return true;
}
}
return false;
}
}