frontend: Add room creator guard to manage room creation access
This commit is contained in:
parent
355b31b25a
commit
ecf70639f7
@ -4,3 +4,4 @@ export * from './validate-room-access.guard';
|
|||||||
export * from './application-mode.guard';
|
export * from './application-mode.guard';
|
||||||
export * from './participant-name.guard';
|
export * from './participant-name.guard';
|
||||||
export * from './replace-moderator-secret.guard';
|
export * from './replace-moderator-secret.guard';
|
||||||
|
export * from './room-creator.guard';
|
||||||
|
|||||||
@ -0,0 +1,19 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { ActivatedRouteSnapshot, CanActivateFn, Router, RouterStateSnapshot } from '@angular/router';
|
||||||
|
import { ContextService } from 'shared-meet-components';
|
||||||
|
|
||||||
|
export const checkRoomCreatorEnabledGuard: CanActivateFn = async (
|
||||||
|
_route: ActivatedRouteSnapshot,
|
||||||
|
_state: RouterStateSnapshot
|
||||||
|
) => {
|
||||||
|
const contextService = inject(ContextService);
|
||||||
|
const router = inject(Router);
|
||||||
|
|
||||||
|
const isRoomCreatorEnabled = await contextService.canUsersCreateRooms();
|
||||||
|
if (!isRoomCreatorEnabled) {
|
||||||
|
router.navigate(['room-creator-disabled']);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user