コード例 #1
0
        private void modifyEditAction(ActionCall action)
        {
            // At least one Crud controller 'ignores' its Edit method
            if (action == null)
            {
                return;
            }

            var chain = action.ParentChain();

            chain.Route = action.BuildRouteForPattern("{0}/{{Id}}".ToFormat(_routeName));

            // If there are no
            if (!action.HasAttribute <AuthorizationAttribute>())
            {
                var permissionName = CrudRules.SecurableNameForViewing(_entityType);
                chain.Authorization.AddRole(permissionName);
            }

            // apply data restrictions
            var policyType = typeof(RestrictedDataAuthorizationPolicy <>).MakeGenericType(_entityType);

            chain.Authorization.AddPolicy(policyType);

            action.AddAfter(Wrapper.For <CrudUrlBehavior>());
        }
コード例 #2
0
        public override void Alter(ActionCall call)
        {
            var chain = call.ParentChain();
            var alias = call.BuildRouteForPattern(_pattern);

            chain.AddRouteAlias(alias);
        }
コード例 #3
0
ファイル: UrlAliasAttribute.cs プロジェクト: mtscout6/fubumvc
        public override void Alter(ActionCall call)
        {
            var chain = call.ParentChain();
            var alias = call.BuildRouteForPattern(_pattern);

            chain.AddRouteAlias(alias);
        }
コード例 #4
0
        public IRouteDefinition Build(ActionCall call)
        {
            var pattern = call.Method.GetAttribute<UrlPatternAttribute>().Pattern;
            var route = call.BuildRouteForPattern(pattern);

            return route;
        }
コード例 #5
0
        public IRouteDefinition Build(ActionCall call)
        {
            var pattern = call.Method.GetAttribute<UrlPatternAttribute>().Pattern;
            var route = call.BuildRouteForPattern(pattern);
            route.Trace("Action '{0}' has the [{1}] defined. Using explicitly defined URL pattern.", call.Method.Name,
                        typeof (UrlPatternAttribute).Name);

            return route;
        }
コード例 #6
0
        public IRouteDefinition Build(ActionCall call)
        {
            var pattern = call.Method.GetAttribute <UrlPatternAttribute>().Pattern;
            var route   = call.BuildRouteForPattern(pattern);

            route.Trace("Action '{0}' has the [{1}] defined. Using explicitly defined URL pattern.", call.Method.Name,
                        typeof(UrlPatternAttribute).Name);

            return(route);
        }
コード例 #7
0
        /// <summary>
        ///   Adds a BehaviorChain for the given url pattern and action type.
        ///   Specify the "arguments" parameters if actionType is an open
        ///   generic type
        /// </summary>
        /// <param name = "urlPattern"></param>
        /// <param name = "actionType"></param>
        /// <param name = "arguments"></param>
        /// <returns></returns>
        public BehaviorChain AddActionFor(string urlPattern, Type actionType, params Type[] arguments)
        {
            if (arguments.Any())
            {
                Type closedType = actionType.MakeGenericType(arguments);
                return(AddActionFor(urlPattern, closedType));
            }

            ActionCall action = ActionCall.For(actionType);
            var        chain  = new BehaviorChain();

            chain.AddToEnd(action);
            chain.Route = action.BuildRouteForPattern(urlPattern);
            AddChain(chain);

            return(chain);
        }
コード例 #8
0
        public IRouteDefinition Build(ActionCall call)
        {
            var pattern = call.Method.GetAttribute <UrlPatternAttribute>().Pattern;

            return(call.BuildRouteForPattern(pattern));
        }
コード例 #9
0
        private void modifyEditAction(ActionCall action)
        {
            // At least one Crud controller 'ignores' its Edit method
            if (action == null) return;

            var chain = action.ParentChain();
            chain.Route = action.BuildRouteForPattern("{0}/{{Id}}".ToFormat(_routeName));

            // If there are no
            if (!action.HasAttribute<AuthorizationAttribute>())
            {
                var permissionName = CrudRules.SecurableNameForViewing(_entityType);
                chain.Authorization.AddRole(permissionName);
            }

            // apply data restrictions
            var policyType = typeof(RestrictedDataAuthorizationPolicy<>).MakeGenericType(_entityType);
            chain.Authorization.AddPolicy(policyType);

            action.AddAfter(Wrapper.For<CrudUrlBehavior>());
        }