Added impersonation. More data available via auth service about the user. Added admin auth guard.
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
<nav>
|
||||
<impersonation />
|
||||
<ul>
|
||||
<li>
|
||||
<a
|
||||
routerLink="/login"
|
||||
routerLinkActive="active"
|
||||
*ngIf="!twitch_logged_in">
|
||||
*ngIf="!isLoggedIn()">
|
||||
Login
|
||||
</a>
|
||||
</li>
|
||||
@ -12,7 +13,7 @@
|
||||
<a
|
||||
routerLink="/tts-login"
|
||||
routerLinkActive="active"
|
||||
*ngIf="twitch_logged_in && !tts_logged_in">
|
||||
*ngIf="isLoggedIn() && !isTTSLoggedIn()">
|
||||
TTS Login
|
||||
</a>
|
||||
</li>
|
||||
@ -20,7 +21,7 @@
|
||||
<a
|
||||
routerLink="/policies"
|
||||
routerLinkActive="active"
|
||||
*ngIf="twitch_logged_in && tts_logged_in">
|
||||
*ngIf="isLoggedIn() && isTTSLoggedIn()">
|
||||
Policies
|
||||
</a>
|
||||
</li>
|
||||
|
@ -3,22 +3,28 @@ import { RouterModule } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { HermesClientService } from '../hermes-client.service';
|
||||
import { ApiAuthenticationService } from '../shared/services/api/api-authentication.service';
|
||||
import { ImpersonationComponent } from '../impersonation/impersonation.component';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
|
||||
@Component({
|
||||
selector: 'navigation',
|
||||
standalone: true,
|
||||
imports: [CommonModule, RouterModule],
|
||||
imports: [CommonModule, RouterModule, ImpersonationComponent, MatCardModule],
|
||||
templateUrl: './navigation.component.html',
|
||||
styleUrl: './navigation.component.scss'
|
||||
})
|
||||
export class NavigationComponent {
|
||||
constructor(private auth: ApiAuthenticationService, private hermes: HermesClientService) { }
|
||||
|
||||
get twitch_logged_in() {
|
||||
isLoggedIn() {
|
||||
return this.auth.isAuthenticated();
|
||||
}
|
||||
|
||||
get tts_logged_in() {
|
||||
isAdmin() {
|
||||
return this.isLoggedIn() && this.auth.isAdmin()
|
||||
}
|
||||
|
||||
isTTSLoggedIn() {
|
||||
return this.hermes?.logged_in ?? false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user