194. Getting current user role (#29)

This commit is contained in:
Art
2021-09-22 20:49:16 +03:00
parent 08e4aad34a
commit f1e6fccf81
2 changed files with 13 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import {CustomHttpResponse} from "../../dto/custom-http-response";
import {AuthenticationService} from "../../service/authentication.service";
import {Router} from "@angular/router";
import {FileUploadStatus} from "../../model/file-upload.status";
import {Role} from "../../enum/role.enum";
@Component({
selector: 'app-user',
@ -278,8 +279,16 @@ export class UserComponent implements OnInit, OnDestroy {
}
break;
default:
this.fileUploadStatus.status='default';
this.fileUploadStatus.status = 'default';
}
}
public get isAdmin(): boolean {
return this.loggedInUser.role === Role.ADMIN || this.loggedInUser.role === Role.SUPER_ADMIN;
}
public get isManager(): boolean {
return this.isAdmin || this.loggedInUser.role === Role.MANAGER;
}
}

View File

@ -1,3 +1,5 @@
import {Role} from "../enum/role.enum";
export class User {
userId: string;
firstName: string;
@ -7,7 +9,7 @@ export class User {
profileImageUrl: string;
lastLoginDateDisplay: Date;
joinDate: Date;
role: string; //ROLE_USER, ROLE_ADMIN
role: Role; //ROLE_USER, ROLE_ADMIN
authorities: string[];
active: boolean;
notLocked: boolean;