diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.ts b/apps/server/src/modules/video-conference/service/video-conference.service.ts index 072e2e73b1..68dd4f1a6f 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.ts @@ -20,7 +20,7 @@ import { VideoConferenceOptions } from '../interface'; import { ScopeInfo, VideoConferenceState } from '../uc/dto'; import { VideoConferenceConfig } from '../video-conference-config'; -type ConferenceRessource = Course | Room | TeamEntity | VideoConferenceElement; +type ConferenceResource = Course | Room | TeamEntity | VideoConferenceElement; @Injectable() export class VideoConferenceService { @@ -100,32 +100,29 @@ export class VideoConferenceService { } // should be public to expose ressources to UC for passing it to authrisation and improve performance - private async loadScopeRessources( - scopeId: EntityId, - scope: VideoConferenceScope - ): Promise { - let scopeRessource: ConferenceRessource | null = null; + private async loadScopeResources(scopeId: EntityId, scope: VideoConferenceScope): Promise { + let scopeResource: ConferenceResource | null = null; if (scope === VideoConferenceScope.COURSE) { - scopeRessource = await this.courseService.findById(scopeId); + scopeResource = await this.courseService.findById(scopeId); } else if (scope === VideoConferenceScope.EVENT) { - scopeRessource = await this.teamsRepo.findById(scopeId); + scopeResource = await this.teamsRepo.findById(scopeId); } else if (scope === VideoConferenceScope.ROOM) { - scopeRessource = await this.roomService.getSingleRoom(scopeId); + scopeResource = await this.roomService.getSingleRoom(scopeId); } else if (scope === VideoConferenceScope.VIDEO_CONFERENCE_ELEMENT) { - scopeRessource = await this.boardNodeService.findByClassAndId(VideoConferenceElement, scopeId); + scopeResource = await this.boardNodeService.findByClassAndId(VideoConferenceElement, scopeId); } else { // Need to be solve the null with throw by it self. } - return scopeRessource; + return scopeResource; } private isNullOrUndefined(value: unknown): value is null { return !value; } - private async hasStartMeetingAndCanRead(authorizableUser: User, entity: ConferenceRessource): Promise { + private async hasStartMeetingAndCanRead(authorizableUser: User, entity: ConferenceResource): Promise { if (entity instanceof Room) { const roomMembershipAuthorizable = await this.roomMembershipService.getRoomMembershipAuthorizable(entity.id); const roomMember = roomMembershipAuthorizable.members.find((member) => member.userId === authorizableUser.id); @@ -152,7 +149,7 @@ export class VideoConferenceService { return hasPermission; } - private async hasJoinMeetingAndCanRead(authorizableUser: User, entity: ConferenceRessource): Promise { + private async hasJoinMeetingAndCanRead(authorizableUser: User, entity: ConferenceResource): Promise { if (entity instanceof Room) { const roomMembershipAuthorizable = await this.roomMembershipService.getRoomMembershipAuthorizable(entity.id); const roomMember = roomMembershipAuthorizable.members.find((member) => member.userId === authorizableUser.id); @@ -181,16 +178,16 @@ export class VideoConferenceService { async determineBbbRole(userId: EntityId, scopeId: EntityId, scope: VideoConferenceScope): Promise { // ressource loading need to be move to uc - const [authorizableUser, scopeRessource]: [User, ConferenceRessource | null] = await Promise.all([ + const [authorizableUser, scopeResource]: [User, ConferenceResource | null] = await Promise.all([ this.authorizationService.getUserWithPermissions(userId), - this.loadScopeRessources(scopeId, scope), + this.loadScopeResources(scopeId, scope), ]); - if (!this.isNullOrUndefined(scopeRessource)) { - if (await this.hasStartMeetingAndCanRead(authorizableUser, scopeRessource)) { + if (!this.isNullOrUndefined(scopeResource)) { + if (await this.hasStartMeetingAndCanRead(authorizableUser, scopeResource)) { return BBBRole.MODERATOR; } - if (await this.hasJoinMeetingAndCanRead(authorizableUser, scopeRessource)) { + if (await this.hasJoinMeetingAndCanRead(authorizableUser, scopeResource)) { return BBBRole.VIEWER; } } diff --git a/apps/server/src/modules/video-conference/uc/video-conference-create.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-create.uc.ts index e67412b567..6ff2b00d63 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-create.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-create.uc.ts @@ -40,9 +40,9 @@ export class VideoConferenceCreateUc { private async create(currentUserId: EntityId, scope: ScopeRef, options: VideoConferenceOptions): Promise { /* need to be replace with - const [authorizableUser, scopeRessource]: [User, TeamEntity | Course] = await Promise.all([ + const [authorizableUser, scopeResource]: [User, TeamEntity | Course] = await Promise.all([ this.authorizationService.getUserWithPermissions(userId), - this.videoConferenceService.loadScopeRessources(scopeId, scope), + this.videoConferenceService.loadScopeResources(scopeId, scope), ]); */ const user: UserDO = await this.userService.findById(currentUserId); diff --git a/apps/server/src/modules/video-conference/uc/video-conference-end.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-end.uc.ts index 211ade03e7..063e838293 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-end.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-end.uc.ts @@ -18,9 +18,9 @@ export class VideoConferenceEndUc { async end(currentUserId: EntityId, scope: ScopeRef): Promise> { /* need to be replace with - const [authorizableUser, scopeRessource]: [User, TeamEntity | Course] = await Promise.all([ + const [authorizableUser, scopeResource]: [User, TeamEntity | Course] = await Promise.all([ this.authorizationService.getUserWithPermissions(userId), - this.videoConferenceService.loadScopeRessources(scopeId, scope), + this.videoConferenceService.loadScopeResources(scopeId, scope), ]); */ const user: UserDO = await this.userService.findById(currentUserId); diff --git a/apps/server/src/modules/video-conference/uc/video-conference-info.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-info.uc.ts index a490fa6f83..1aaebb9985 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-info.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-info.uc.ts @@ -19,9 +19,9 @@ export class VideoConferenceInfoUc { async getMeetingInfo(currentUserId: EntityId, scope: ScopeRef): Promise { /* need to be replace with - const [authorizableUser, scopeRessource]: [User, TeamEntity | Course] = await Promise.all([ + const [authorizableUser, scopeResource]: [User, TeamEntity | Course] = await Promise.all([ this.authorizationService.getUserWithPermissions(userId), - this.videoConferenceService.loadScopeRessources(scopeId, scope), + this.videoConferenceService.loadScopeResources(scopeId, scope), ]); */ const user: UserDO = await this.userService.findById(currentUserId);