title: How to modify Authorize attribute to allow a group of User Roles in MVC 3
body: <p>In my MVC3 wep app, I have extended the Authorize attribute like below</p>
  
  <pre><code>public class MyAuthorizeAttribute : AuthorizeAttribute
  {
      protected override bool AuthorizeCore(HttpContextBase httpContext)
      {
          if (Authenticate.IsAuthenticated() &amp;&amp; httpContext.User.Identity.IsAuthenticated)
          {
              var authCookie = httpContext.Request.Cookies[FormsAuthentication.FormsCookieName];
              if (authCookie != null)
              {
                  var ticket = FormsAuthentication.Decrypt(authCookie.Value);
                  var roles = ticket.UserData.Split('|');
                  var identity = new GenericIdentity(ticket.Name);
                  httpContext.User = new GenericPrincipal(identity, roles);
              }
          }
          return base.AuthorizeCore(httpContext);
      }
  
      public override void OnAuthorization(AuthorizationContext filterContext)
      {
  
          if (!Authenticate.IsAuthenticated())
              HandleUnauthorizedRequest(filterContext);
  
  
          base.OnAuthorization(filterContext);
  
      }
  </code></pre>
  
  <p>In my Actions, I use it like</p>
  
  <pre><code>    [MyAuthorize(Roles = "Member,Inspector,SalesRep,Admin,SuperAdmin")]
      public ActionResult OrderUpload()
  </code></pre>
  
  <p>Now, I have to specify each user role in every action.  What I would like to do is
  specify something like below</p>
  
  <pre><code>    [MyAuthorize(Roles = "Member")]
      public ActionResult OrderUpload()
  </code></pre>
  
  <p>and this should allow any User Role that are equal or above "Member".  So a "SalesRep" should be allowed, where as "Visitor", who is below the "Member" should not be allowed.</p>
  
  <p>All User Roles are enum with increasing numbers</p>
  
  <pre><code>public enum UserAccountType
  {
      Visitor = 5,
      Member = 10,
      Inspector = 15,
      SalesRep = 20,
      Admin = 25,
      SuperAdmin = 30
  }
  </code></pre>
  
  <p>How do I modify MyAuthorizeAttribute to make this work?</p>
  
  <p>Thanks</p>