Anyway to update the Menu list to cater different User role?
mygetright-ricky opened this issue · comments
mygetright-ricky commented
Anyway to change the menu list for different User role? Example user role A access will get 5 menu item, while for user role B will get 7 menu item.
Sebastián Ferreras commented
As you can see in this comment, one way to achieve that would be to create a method where you initialize all the options of the side menu using a parameter to decide which options should be shown based on the user's role:
private initializeOptions(userRole: UserRole): Array<MenuOptionModel> {
let options: Array<MenuOptionModel> = [];
// Add the options based on the rol of the user
// ...
return options;
}
And then you can use that method in the app.component.ts
file to show the right options in the side menu:
// ...
this.options = this.initializeOptions(UserRole.Admin);
// ...