On my website, I have different pages with different levels of access permissions. Usually, I use something along:
if(!user.IsAdministrator)
return RedirectToAction("AccessDenied", "Security");
But I realized this was tieing me to the security levels that I'd prebuilt; what I in fact want is a fully customizable access scheme.
One solution I thought about was to set some attributes in the actions I wanted to give restricted access, then retrieve where were they placed. I'm somewhat unexperienced with Attributes (custom ones, at least), and although I know how to list all the actions being marked, I'm still struggling to conceive a way to check for the right access permission and denying the access.
Any light on the subject? I'm also interested to know if there are any standard practices for dealing with this issue.