I have a view to display a list of items. The user can edit, delete, or create new elements, but according to their authority, they may or may not be allowed to perform some of these actions.
I have a requirement to display only those actions that the current user can perform, but I do not want to clutter up views with if-else authorization
Let be a very general requirement, I cannot find a real satisfactory way to make it.
My best approach so far is to overload the extension method Html.ActionLink, which requires permission to query, but there will be more complex scenarios like hiding whole html blocks or switching the text box for label + hidden.
Is there a better way to do this?
source
share