public static bool HasPermission(this ControllerBase controller, string permission)
 {
     bool bFound = false;
     try
     {
         //Check if the requesting user has the specified application permission...
         bFound = new RBAC(controller.ControllerContext.HttpContext.User.Identity.GetUserId<int>()).HasPermission(permission);
     }
     catch { }
     return bFound;
 }
 public static bool HasRole(this ControllerBase controller, string role)
 {
     bool bFound = false;
     try
     {
         //Check if the requesting user has the specified role...
         bFound = new RBAC(controller.ControllerContext.HttpContext.User.Identity.GetUserId<int>()).HasRole(role);
     }
     catch { }
     return bFound;
 }
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                RBAC requestingUser = new RBAC(filterContext.RequestContext
                                                       .HttpContext.User.Identity.GetUserId<int>());

                if (!requestingUser.HasPermission(AccessAction))
                {
                    filterContext.Result = new HttpStatusCodeResult(403);
                }
            }
        }