views:

31

answers:

1

In a standard, generated list view, how can I hide certain ActionLinks based on the roles the logged in user belongs to?

A: 

My friend wrote up this blog post about supporting multiple roles in security checks without "magic strings". (He discusses action links at the end.) I also have a comment there. I recommend putting the logic to determine permissions into your view model so that you don't clutter your view with permission checks.

Ryan
Thanks for the link, but for now I've just used a magic string as input to an extension method I wrote called 'RoleFilteredActionLink', that returns null if the user is not authorized or calls the normal ActionLink if he is.
ProfK