Remove viewer role and associated permissions from participant and room services

This commit is contained in:
Carlos Santos 2025-03-11 16:42:13 +01:00
parent 22ae25177d
commit d08ca1fd6b
6 changed files with 2 additions and 47 deletions

View File

@ -45,8 +45,6 @@ export class ParticipantService {
return this.generateModeratorPermissions(roomName);
case ParticipantRole.PUBLISHER:
return this.generatePublisherPermissions(roomName);
case ParticipantRole.VIEWER:
return this.generateViewerPermissions(roomName);
default:
throw new Error(`Role ${role} not supported`);
}
@ -104,30 +102,4 @@ export class ParticipantService {
}
};
}
protected generateViewerPermissions(roomName: string): ParticipantPermissions {
return {
livekit: {
roomJoin: true,
roomList: false,
roomRecord: false,
roomAdmin: false,
room: roomName,
ingressAdmin: false,
canPublish: false,
canSubscribe: true,
canPublishData: false,
canUpdateOwnMetadata: false,
hidden: false,
recorder: false,
agent: false
},
openvidu: {
canPublishScreen: false,
canRecord: false,
canChat: false,
canChangeVirtualBackground: false
}
};
}
}

View File

@ -168,10 +168,6 @@ export class RoomService {
return ParticipantRole.PUBLISHER;
}
if (room.viewerRoomUrl.includes(secret)) {
return ParticipantRole.VIEWER;
}
throw new Error('Invalid secret');
}
@ -228,7 +224,6 @@ export class RoomService {
expirationDate,
moderatorRoomUrl: `${baseUrl}/${roomName}/?secret=${secureUid(10)}`,
publisherRoomUrl: `${baseUrl}/${roomName}?secret=${secureUid(10)}`,
viewerRoomUrl: `${baseUrl}/${roomName}/?secret=${secureUid(10)}`,
preferences
};
return openviduRoom;

View File

@ -69,13 +69,6 @@ export class VideoRoomComponent implements OnInit, OnDestroy {
// TODO: Extract permissions from token and apply them to the component
this.applyParticipantPermissions();
if (this.ctxService.isViewerParticipant()) {
this.featureFlags.videoEnabled = false;
this.featureFlags.audioEnabled = false;
this.featureFlags.showMicrophone = false;
this.featureFlags.showCamera = false;
this.featureFlags.showScreenShare = false;
}
} catch (error: any) {
console.error('Error fetching room preferences', error);
this.serverError = error.error.message || error.message || error.error;

View File

@ -15,7 +15,7 @@ export class ContextService {
roomName: '',
participantName: '',
token: '',
participantRole: ParticipantRole.VIEWER,
participantRole: ParticipantRole.PUBLISHER,
participantPermissions: {
canRecord: false,
canChat: false,
@ -114,10 +114,6 @@ export class ContextService {
return this.context.participantRole === ParticipantRole.MODERATOR;
}
isViewerParticipant(): boolean {
return this.context.participantRole === ParticipantRole.VIEWER;
}
setParticipantName(participantName: string): void {
this.context.participantName = participantName;
}

View File

@ -15,5 +15,5 @@ export interface ParticipantPermissions {
export const enum ParticipantRole {
MODERATOR = 'moderator',
PUBLISHER = 'publisher',
VIEWER = 'viewer',
// VIEWER = 'viewer',
}

View File

@ -19,5 +19,4 @@ export interface OpenViduMeetRoom extends BaseRoomOptions {
creationDate: number;
moderatorRoomUrl: string;
publisherRoomUrl: string;
viewerRoomUrl: string;
}