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 {AuthenticationService} from "../../service/authentication.service";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {FileUploadStatus} from "../../model/file-upload.status";
|
import {FileUploadStatus} from "../../model/file-upload.status";
|
||||||
|
import {Role} from "../../enum/role.enum";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-user',
|
selector: 'app-user',
|
||||||
@ -278,8 +279,16 @@ export class UserComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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 {
|
export class User {
|
||||||
userId: string;
|
userId: string;
|
||||||
firstName: string;
|
firstName: string;
|
||||||
@ -7,7 +9,7 @@ export class User {
|
|||||||
profileImageUrl: string;
|
profileImageUrl: string;
|
||||||
lastLoginDateDisplay: Date;
|
lastLoginDateDisplay: Date;
|
||||||
joinDate: Date;
|
joinDate: Date;
|
||||||
role: string; //ROLE_USER, ROLE_ADMIN
|
role: Role; //ROLE_USER, ROLE_ADMIN
|
||||||
authorities: string[];
|
authorities: string[];
|
||||||
active: boolean;
|
active: boolean;
|
||||||
notLocked: boolean;
|
notLocked: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user