Added impersonation. More data available via auth service about the user. Added admin auth guard.
This commit is contained in:
15
src/app/shared/auth/auth.user.guard.ts
Normal file
15
src/app/shared/auth/auth.user.guard.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { ApiAuthenticationService } from '../services/api/api-authentication.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AuthUserGuard implements CanActivate {
|
||||
|
||||
constructor(private auth: ApiAuthenticationService, private router: Router) { }
|
||||
|
||||
async canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Promise<boolean> {
|
||||
return this.auth.isAuthenticated();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user