using System;
using System.Web.Mvc;
using DataClasses;

namespace WebApplication
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
    public class RoleAuthorizeAttribute : AuthorizeAttribute
    {
        public RoleEnum Role { get; set; }

        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (Role != 0)
                Roles = Role.ToString();

            base.OnAuthorization(filterContext);
        }
    }
}