frontend: Update participant role retrieval to use room role and permissions endpoint
This commit is contained in:
parent
743d3d514d
commit
5570b30686
@ -53,7 +53,7 @@ export const checkParticipantRoleAndAuthGuard: CanActivateFn = async (
|
|||||||
const sessionStorageService = inject(SessionStorageService);
|
const sessionStorageService = inject(SessionStorageService);
|
||||||
const httpService = inject(HttpService);
|
const httpService = inject(HttpService);
|
||||||
|
|
||||||
// Get participant role by room secret
|
// Get the role that the participant will have in the room based on the room ID and secret
|
||||||
let participantRole: ParticipantRole;
|
let participantRole: ParticipantRole;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -61,7 +61,8 @@ export const checkParticipantRoleAndAuthGuard: CanActivateFn = async (
|
|||||||
const secret = contextService.getSecret();
|
const secret = contextService.getSecret();
|
||||||
const storageSecret = sessionStorageService.getModeratorSecret(roomId);
|
const storageSecret = sessionStorageService.getModeratorSecret(roomId);
|
||||||
|
|
||||||
participantRole = await httpService.getParticipantRole(roomId, storageSecret || secret);
|
const roomRoleAndPermissions = await httpService.getRoomRoleAndPermissions(roomId, storageSecret || secret);
|
||||||
|
participantRole = roomRoleAndPermissions.role;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error getting participant role:', error);
|
console.error('Error getting participant role:', error);
|
||||||
return router.createUrlTree(['unauthorized'], { queryParams: { reason: 'unauthorized-participant' } });
|
return router.createUrlTree(['unauthorized'], { queryParams: { reason: 'unauthorized-participant' } });
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MeetRoom, MeetRoomOptions } from 'projects/shared-meet-components/src/lib/typings/ce/room';
|
|
||||||
import {
|
import {
|
||||||
GlobalPreferences,
|
MeetRoom,
|
||||||
ParticipantRole,
|
MeetRoomOptions,
|
||||||
|
MeetRoomRoleAndPermissions,
|
||||||
MeetRoomPreferences,
|
MeetRoomPreferences,
|
||||||
SecurityPreferencesDTO,
|
SecurityPreferencesDTO,
|
||||||
TokenOptions,
|
TokenOptions,
|
||||||
@ -16,7 +16,6 @@ import { lastValueFrom } from 'rxjs';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class HttpService {
|
export class HttpService {
|
||||||
// private baseHref: string;
|
|
||||||
protected API_PATH_PREFIX = 'meet/api';
|
protected API_PATH_PREFIX = 'meet/api';
|
||||||
protected INTERNAL_API_PATH_PREFIX = 'meet/internal-api';
|
protected INTERNAL_API_PATH_PREFIX = 'meet/internal-api';
|
||||||
protected API_V1_VERSION = 'v1';
|
protected API_V1_VERSION = 'v1';
|
||||||
@ -44,9 +43,9 @@ export class HttpService {
|
|||||||
return this.getRequest(path);
|
return this.getRequest(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
getParticipantRole(roomId: string, secret: string): Promise<ParticipantRole> {
|
getRoomRoleAndPermissions(roomId: string, secret: string): Promise<MeetRoomRoleAndPermissions> {
|
||||||
return this.getRequest(
|
return this.getRequest(
|
||||||
`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/rooms/${roomId}/participant-role?secret=${secret}`
|
`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/rooms/${roomId}/roles/${secret}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +123,9 @@ export class HttpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopRecording(recordingId: string): Promise<RecordingInfo> {
|
stopRecording(recordingId: string): Promise<RecordingInfo> {
|
||||||
return this.postRequest(`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/recordings/${recordingId}/stop`);
|
return this.postRequest(
|
||||||
|
`${this.INTERNAL_API_PATH_PREFIX}/${this.API_V1_VERSION}/recordings/${recordingId}/stop`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRecording(recordingId: string): Promise<RecordingInfo> {
|
deleteRecording(recordingId: string): Promise<RecordingInfo> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user