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' - role: 'moderator'
permissions: permissions:
livekit: livekit:
roomCreate: true
roomJoin: true roomJoin: true
roomList: true
roomRecord: true
roomAdmin: true
room: 'room-123' room: 'room-123'
ingressAdmin: true
canPublish: true canPublish: true
canSubscribe: true canSubscribe: true
canPublishData: true canPublishData: true
canUpdateOwnMetadata: true canUpdateOwnMetadata: true
hidden: false
recorder: false
agent: false
openvidu: openvidu:
canPublishScreen: true
canRecord: true canRecord: true
canChat: true canChat: true
canChangeVirtualBackground: true canChangeVirtualBackground: true
- role: 'publisher' - role: 'publisher'
permissions: permissions:
livekit: livekit:
roomCreate: false
roomJoin: true roomJoin: true
roomList: true
roomRecord: false
roomAdmin: false
room: 'room-123' room: 'room-123'
ingressAdmin: false
canPublish: true canPublish: true
canSubscribe: true canSubscribe: true
canPublishData: true canPublishData: true
canUpdateOwnMetadata: true canUpdateOwnMetadata: true
hidden: false
recorder: false
agent: false
openvidu: openvidu:
canPublishScreen: true
canRecord: false canRecord: false
canChat: true canChat: true
canChangeVirtualBackground: true canChangeVirtualBackground: true

View File

@ -15,41 +15,16 @@ properties:
livekit: livekit:
type: object type: object
properties: properties:
roomCreate:
type: boolean
description: >
Indicates whether the participant can create a room.
example: true
roomJoin: roomJoin:
type: boolean type: boolean
description: > description: >
Indicates whether the participant can join a room. Indicates whether the participant can join a room.
example: true 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: room:
type: string type: string
description: > description: >
The ID of the room associated with the participant. The ID of the room associated with the participant.
example: roomId example: roomId
ingressAdmin:
type: boolean
description: >
Indicates whether the participant can manage ingress settings.
example: true
canPublish: canPublish:
type: boolean type: boolean
description: > description: >
@ -70,29 +45,9 @@ properties:
description: > description: >
Indicates whether the participant can update their own metadata. Indicates whether the participant can update their own metadata.
example: true 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: openvidu:
type: object type: object
properties: properties:
canPublishScreen:
type: boolean
description: >
Indicates whether the participant can publish screen sharing in the room.
example: true
canRecord: canRecord:
type: boolean type: boolean
description: > description: >

View File

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

View File

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