194. Getting current user role (#29)
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user