1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00
pigallery2/frontend/app/admin/admin.component.ts

37 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-05-04 17:20:21 +02:00
import {Component, OnInit} from "@angular/core";
2016-12-26 23:36:38 +01:00
import {AuthenticationService} from "../model/network/authentication.service";
import {Router} from "@angular/router";
2016-12-27 16:09:47 +01:00
import {UserRoles} from "../../../common/entities/UserDTO";
2017-06-04 15:25:08 +02:00
import {Config} from "../../../common/config/public/Config";
2017-07-09 14:23:50 +02:00
import {NotificationService} from "../model/notification.service";
import {NotificationType} from "../../../common/entities/NotificationDTO";
@Component({
selector: 'admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.css']
})
export class AdminComponent implements OnInit {
userManagementEnable: boolean = false;
2017-07-09 14:23:50 +02:00
NotificationType: any;
constructor(private _authService: AuthenticationService,
private _router: Router,
public notificationService: NotificationService) {
this.userManagementEnable = Config.Client.authenticationRequired;
2017-07-09 14:23:50 +02:00
this.NotificationType = NotificationType;
}
ngOnInit() {
2017-07-08 12:43:42 +02:00
if (!this._authService.isAuthenticated()
|| this._authService.user.value.role < UserRoles.Admin) {
this._router.navigate(['login']);
return;
}
}
}