public static void RegisterGlobalFilters(GlobalFilterCollection filters,
                                                 FluentFilterCollection fluentFilters)
        {
            filters.Add(new HandleErrorAttribute());

            fluentFilters.Add <AuthorizeAttribute>(c =>
            {
                c.Require(new ControllerFilterCriteria("Account")).And(
                    new AreaFilterCriteria("LogOn")).And(
                    new AreaFilterCriteria("Register"));
                c.Exclude(new ControllerFilterCriteria("Account")).And(
                    new AreaFilterCriteria("LogOn")).And(
                    new AreaFilterCriteria("Register"));
            });
        }
Example #2
0
        public static void RegisterGlobalFilters(GlobalFilterCollection globalfilters, FluentFilterCollection fluentFilters)
        {
            globalfilters.Add(new HandleErrorAttribute(), 1);
            //globalfilters.Add(new CompressFilter(), 2);
            //fluentFilters.Add<SecurityAttribute>(x => x.Exclude(new ControllerFilterCriteria("Security")), 4);
            fluentFilters.Add <CultureAttribute>(x => x.Exclude(new AreaFilterCriteria("SysAdmin")), 5);
            fluentFilters.Add <UsernameFilterAttribute>();
            fluentFilters.Add <DropdownFilterAttribute>();
            //fluentFilters.Add<UserRoleFilterAttribute>(x=>x.Exclude(new AreaFilterCriteria("SysAdmin")));

            //fluentFilters.Add<AdminRolePermissionFilterAttribute>(x =>
            //{
            //    x.Require(new AreaFilterCriteria("SysAdmin"));
            //    x.Exclude(new ControllerFilterCriteria("AdminAccount")).And(new ActionFilterCriteria("LogOn")).Or(new ActionFilterCriteria("LogOff"));
            //});
        }