aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core/routing/user-right-guard.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core/routing/user-right-guard.service.ts')
-rw-r--r--client/src/app/core/routing/user-right-guard.service.ts7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/src/app/core/routing/user-right-guard.service.ts b/client/src/app/core/routing/user-right-guard.service.ts
index a2ce772db..c6bd05bb6 100644
--- a/client/src/app/core/routing/user-right-guard.service.ts
+++ b/client/src/app/core/routing/user-right-guard.service.ts
@@ -1,12 +1,13 @@
1import { Injectable } from '@angular/core' 1import { Injectable } from '@angular/core'
2import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, Router, RouterStateSnapshot } from '@angular/router' 2import { ActivatedRouteSnapshot, CanActivate, CanActivateChild, RouterStateSnapshot } from '@angular/router'
3import { AuthService } from '../auth/auth.service' 3import { AuthService } from '../auth/auth.service'
4import { RedirectService } from './redirect.service'
4 5
5@Injectable() 6@Injectable()
6export class UserRightGuard implements CanActivate, CanActivateChild { 7export class UserRightGuard implements CanActivate, CanActivateChild {
7 8
8 constructor ( 9 constructor (
9 private router: Router, 10 private redirectService: RedirectService,
10 private auth: AuthService 11 private auth: AuthService
11 ) {} 12 ) {}
12 13
@@ -18,7 +19,7 @@ export class UserRightGuard implements CanActivate, CanActivateChild {
18 if (user.hasRight(neededUserRight)) return true 19 if (user.hasRight(neededUserRight)) return true
19 } 20 }
20 21
21 this.router.navigate([ '/login' ]) 22 this.redirectService.redirectToLogin()
22 return false 23 return false
23 } 24 }
24 25