0
I have my following screen :
The side menu comes from an Api List with user permissions
have my classes:
public class Menu {
public int Id {get;set;}
public string Nome {get;set;}
}
public class Item {
public int Id {get;set;}
public string Nome {get;set;}
public Menu Menu {get;set;}
}
public class Opcao {
public int {get;set;}
public string Nome {get;set;}
public Item Item {get;set;}
}
Where Menu = Register
Item = Client
Option = Include, Edit, Delete, Others...
The side menu listing I got perfectly, just use ng-repeat and ready.
My problem is the Option, how will I play the correct one for that view? to leave enabled / disabled the buttons it has or not permission?
Yes, that’s right, but how do I pass it to the View? because on the menu for example, that’s where it comes the routes......
– Rod
Assuming that you have access to the user (Item) in the construction of the Options (Edit, etc.) and that the Option item is the user you can delete, I would build a function in the type controller isUserPermited(item, option.), returning a boolean if the "session" user is the same as option.item. This way you could check the user in this function, +/- as the example below:
$scope.isUserPermited = function(userOnSession, userPermited) {
 // lógica que compara
};
and its view +/-:<td ng-show="isUserPermited(item, opcao.item)">Editar</td>
– user13947
made sense, I’ll try
– Rod