ASP.NET MVC3 Role and Permission Management -> With Runtime Permission Assignment
问题 ASP.NET MVC allows users the ability to assign permissions to functionality (i.e. Actions) at Design Time like so. [Authorize(Roles = "Administrator,ContentEditor")] public ActionResult Foo() { return View(); } To actually check the permission, one might use the following statement in a (Razor) view: @if (User.IsInRole("ContentEditor")) { <div>This will be visible only to users in the ContentEditor role.</div> } The problem with this approach is that all permissions must be set up and