When I log in to the app, it sends me a JSON file with my user permissions like this:
{"StatusCode":0,"StatusMessage":"Authenticated Successfully",
"Token":"eyJhbGciOiJIUzI1NiIs",
"StatusDescription":{
"Role":"admin",
"Permissions":["homeboxpackageactivate",
"eventscreate",
"pollinglivememory",
"pollinglivememorygetall",
"usersgetall",
"app_rolescreate",
"app_rolesupdatebyid"
....]}}
Can you suggest how I can find my permissions from this array?
I have created the following canActivate function:
canActivate(component: string): boolean {
return this.permissions && this.permissions.find(x => x.permissin_desc === component) != null;
}
In the HTML code, I use *ngIf like this:
*ngIf="ws.canActivate('usersgetall')"
However, it doesn't show anything because I am not checking inside my Permissions array. Can you please help me with this?