add admin interface, angular migration
This commit is contained in:
@@ -64,6 +64,11 @@
|
||||
<mat-icon>widgets</mat-icon> {{'services' | i18n}}
|
||||
</a>
|
||||
}
|
||||
@if (auth && auth.authenticated && hasAdminRole()) {
|
||||
<a routerLink="/admin" routerLinkActive="active" mat-list-item>
|
||||
<mat-icon>admin_panel_settings</mat-icon> {{'admin.title' | i18n}}
|
||||
</a>
|
||||
}
|
||||
<a routerLink="/tokens" mat-list-item>
|
||||
<mat-icon>card_giftcard</mat-icon> {{'tokens.redeem' | i18n}}
|
||||
</a>
|
||||
|
||||
@@ -158,6 +158,13 @@ export class MainComponent {
|
||||
}
|
||||
}
|
||||
|
||||
hasAdminRole(): boolean {
|
||||
if (this.auth && this.auth.authorities) {
|
||||
return this.auth.authorities.some((auth: any) => auth.authority === 'ROLE_ADMIN');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
openExternal(url, target = '_self') {
|
||||
window.open(url, target);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user