]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-guard.service.ts
bump version to 15.2.4-pve1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / services / auth-guard.service.ts
1 import { Injectable } from '@angular/core';
2 import { CanActivate, CanActivateChild, Router } from '@angular/router';
3
4 import { AuthStorageService } from './auth-storage.service';
5
6 @Injectable({
7 providedIn: 'root'
8 })
9 export class AuthGuardService implements CanActivate, CanActivateChild {
10 constructor(private router: Router, private authStorageService: AuthStorageService) {}
11
12 canActivate() {
13 if (this.authStorageService.isLoggedIn()) {
14 return true;
15 }
16 this.router.navigate(['/login']);
17 return false;
18 }
19
20 canActivateChild(): boolean {
21 return this.canActivate();
22 }
23 }