backend: streamline moderator and publisher permissions by removing unused properties. Update tests and openapi docs

This commit is contained in:
juancarmore 2025-07-10 00:31:42 +02:00
parent 0fdb4c7d18
commit 39f41560de
4 changed files with 6 additions and 104 deletions

View File

@ -9,44 +9,26 @@ content:
- role: 'moderator'
permissions:
livekit:
roomCreate: true
roomJoin: true
roomList: true
roomRecord: true
roomAdmin: true
room: 'room-123'
ingressAdmin: true
canPublish: true
canSubscribe: true
canPublishData: true
canUpdateOwnMetadata: true
hidden: false
recorder: false
agent: false
openvidu:
canPublishScreen: true
canRecord: true
canChat: true
canChangeVirtualBackground: true
- role: 'publisher'
permissions:
livekit:
roomCreate: false
roomJoin: true
roomList: true
roomRecord: false
roomAdmin: false
room: 'room-123'
ingressAdmin: false
canPublish: true
canSubscribe: true
canPublishData: true
canUpdateOwnMetadata: true
hidden: false
recorder: false
agent: false
openvidu:
canPublishScreen: true
canRecord: false
canChat: true
canChangeVirtualBackground: true

View File

@ -15,41 +15,16 @@ properties:
livekit:
type: object
properties:
roomCreate:
type: boolean
description: >
Indicates whether the participant can create a room.
example: true
roomJoin:
type: boolean
description: >
Indicates whether the participant can join a room.
example: true
roomList:
type: boolean
description: >
Indicates whether the participant can list available rooms.
example: true
roomRecord:
type: boolean
description: >
Indicates whether the participant can record a room.
example: true
roomAdmin:
type: boolean
description: >
Indicates whether the participant has administrative privileges in the room.
example: true
room:
type: string
description: >
The ID of the room associated with the participant.
example: roomId
ingressAdmin:
type: boolean
description: >
Indicates whether the participant can manage ingress settings.
example: true
canPublish:
type: boolean
description: >
@ -70,29 +45,9 @@ properties:
description: >
Indicates whether the participant can update their own metadata.
example: true
hidden:
type: boolean
description: >
Indicates whether the participant is hidden in the room.
example: false
recorder:
type: boolean
description: >
Indicates whether the participant is a recorder in the room.
example: false
agent:
type: boolean
description: >
Indicates whether the participant is an agent in the room.
example: false
openvidu:
type: object
properties:
canPublishScreen:
type: boolean
description: >
Indicates whether the participant can publish screen sharing in the room.
example: true
canRecord:
type: boolean
description: >

View File

@ -79,23 +79,14 @@ export class ParticipantService {
protected generateModeratorPermissions(roomId: string): ParticipantPermissions {
return {
livekit: {
roomCreate: true,
roomJoin: true,
roomList: true,
roomRecord: true,
roomAdmin: true,
room: roomId,
ingressAdmin: true,
canPublish: true,
canSubscribe: true,
canPublishData: true,
canUpdateOwnMetadata: true,
hidden: false,
recorder: false,
agent: false
canUpdateOwnMetadata: true
},
openvidu: {
canPublishScreen: true,
canRecord: true,
canChat: true,
canChangeVirtualBackground: true
@ -106,23 +97,14 @@ export class ParticipantService {
protected generatePublisherPermissions(roomId: string): ParticipantPermissions {
return {
livekit: {
roomCreate: false,
roomJoin: true,
roomList: true,
roomRecord: false,
roomAdmin: false,
room: roomId,
ingressAdmin: false,
canPublish: true,
canSubscribe: true,
canPublishData: true,
canUpdateOwnMetadata: true,
hidden: false,
recorder: false,
agent: false
canUpdateOwnMetadata: true
},
openvidu: {
canPublishScreen: true,
canRecord: false,
canChat: true,
canChangeVirtualBackground: true

View File

@ -6,6 +6,7 @@ import {
MeetRecordingStatus,
MeetRoom,
MeetRoomPreferences,
ParticipantPermissions,
ParticipantRole
} from '../../src/typings/ce';
@ -477,28 +478,19 @@ export const expectValidRoomRoleAndPermissionsResponse = (
});
};
const getPermissions = (roomId: string, role: ParticipantRole) => {
const getPermissions = (roomId: string, role: ParticipantRole): ParticipantPermissions => {
switch (role) {
case ParticipantRole.MODERATOR:
return {
livekit: {
roomCreate: true,
roomJoin: true,
roomList: true,
roomRecord: true,
roomAdmin: true,
room: roomId,
ingressAdmin: true,
canPublish: true,
canSubscribe: true,
canPublishData: true,
canUpdateOwnMetadata: true,
hidden: false,
recorder: false,
agent: false
canUpdateOwnMetadata: true
},
openvidu: {
canPublishScreen: true,
canRecord: true,
canChat: true,
canChangeVirtualBackground: true
@ -507,23 +499,14 @@ const getPermissions = (roomId: string, role: ParticipantRole) => {
case ParticipantRole.PUBLISHER:
return {
livekit: {
roomCreate: false,
roomJoin: true,
roomList: true,
roomRecord: false,
roomAdmin: false,
room: roomId,
ingressAdmin: false,
canPublish: true,
canSubscribe: true,
canPublishData: true,
canUpdateOwnMetadata: true,
hidden: false,
recorder: false,
agent: false
canUpdateOwnMetadata: true
},
openvidu: {
canPublishScreen: true,
canRecord: false,
canChat: true,
canChangeVirtualBackground: true