6
I’ll try to be clear.
In most examples of ASP.NET MVC authentication and access authorization, I see that authorization control is usually done on Controller
, with the decoration of the class itself inherited from Controller
, or even by decoration of Actions
with the attribute Authorize
.
With this in place, all the items contained within my view
attached to this so-called Action
, will be on the same level of authorization.
The question is: Has some elegant way of making that a component of mine view
change rule according to the Role
user’s?
Simple example: A button appears only for users of type Administrator, something very specific.
I thought of something like, passing the user access level on a viewbag
and make a condition to display or not the said example button with the Razor
, I don’t know if this solution would be the most appropriate. Is there any more elegant way?
It has how to do with Claims?
– Raphael
@Raphael Yes: http://answall.com/questions/86128/inser-additionals-do-banco-nas-claims-do-usu%C3%A1rio-qual-o-melhor-momento/136814#136814
– Leonel Sanches da Silva