diff --git a/frontend/projects/shared-meet-components/src/lib/models/context.model.ts b/frontend/projects/shared-meet-components/src/lib/models/context.model.ts index 8e1e15d..c26d84f 100644 --- a/frontend/projects/shared-meet-components/src/lib/models/context.model.ts +++ b/frontend/projects/shared-meet-components/src/lib/models/context.model.ts @@ -1,7 +1,7 @@ import { - GlobalPreferences, OpenViduMeetPermissions, - ParticipantRole + ParticipantRole, + SecurityPreferencesDTO } from 'projects/shared-meet-components/src/public-api'; export interface ContextData { @@ -13,7 +13,7 @@ export interface ContextData { participantPermissions: OpenViduMeetPermissions; mode: ApplicationMode; edition: Edition; - globalPreferences?: GlobalPreferences; + securityPreferences?: SecurityPreferencesDTO; leaveRedirectUrl: string; parentDomain: string; version: string; diff --git a/frontend/projects/shared-meet-components/src/lib/services/context/context.service.ts b/frontend/projects/shared-meet-components/src/lib/services/context/context.service.ts index 89ba664..01f7146 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/context/context.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/context/context.service.ts @@ -25,7 +25,7 @@ export class ContextService { }, mode: ApplicationMode.STANDALONE, edition: Edition.CE, - globalPreferences: undefined, + securityPreferences: undefined, leaveRedirectUrl: '', parentDomain: '', version: '', @@ -167,18 +167,18 @@ export class ContextService { } async canUsersCreateRooms(): Promise { - await this.getGlobalPreferences(); - return this.context.globalPreferences!.securityPreferences.roomCreationPolicy.allowRoomCreation; + await this.getSecurityPreferences(); + return this.context.securityPreferences!.roomCreationPolicy.allowRoomCreation; } async isAuthRequiredToCreateRooms(): Promise { - await this.getGlobalPreferences(); - return this.context.globalPreferences!.securityPreferences.roomCreationPolicy.requireAuthentication; + await this.getSecurityPreferences(); + return this.context.securityPreferences!.roomCreationPolicy.requireAuthentication; } async getAuthModeToEnterRoom(): Promise { - await this.getGlobalPreferences(); - return this.context.globalPreferences!.securityPreferences.authentication.authMode; + await this.getSecurityPreferences(); + return this.context.securityPreferences!.authentication.authMode; } private getValidDecodedToken(token: string) { @@ -204,14 +204,13 @@ export class ContextService { } } - private async getGlobalPreferences() { - if (!this.context.globalPreferences) { + private async getSecurityPreferences() { + if (!this.context.securityPreferences) { try { - // TODO: Retrieve only publicly available global preferences - this.context.globalPreferences = await this.httpService.getGlobalPreferences(); + this.context.securityPreferences = await this.httpService.getSecurityPreferences(); } catch (error) { - this.log.e('Error getting global preferences', error); - throw new Error('Error getting global preferences'); + this.log.e('Error getting security preferences', error); + throw new Error('Error getting security preferences'); } } } diff --git a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts index a9e06bf..8b8d6d6 100644 --- a/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts +++ b/frontend/projects/shared-meet-components/src/lib/services/http/http.service.ts @@ -1,7 +1,14 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { OpenViduMeetRoom, OpenViduMeetRoomOptions } from 'projects/shared-meet-components/src/lib/typings/ce/room'; -import { GlobalPreferences, ParticipantRole, RoomPreferences, TokenOptions, User } from '@lib/typings/ce'; +import { + GlobalPreferences, + ParticipantRole, + RoomPreferences, + SecurityPreferencesDTO, + TokenOptions, + User +} from '@lib/typings/ce'; import { RecordingInfo, Room } from 'openvidu-components-angular'; import { lastValueFrom } from 'rxjs'; @@ -61,12 +68,12 @@ export class HttpService { } /** - * Retrieves the global preferences. + * Retrieves security preferences. * * @returns {Promise} A promise that resolves to the global preferences. */ - getGlobalPreferences(): Promise { - return this.getRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/preferences`); + getSecurityPreferences(): Promise { + return this.getRequest(`${this.API_PATH_PREFIX}/${this.API_V1_VERSION}/preferences/security`); } /**