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>()); }
public override void Alter(ActionCall call) { var chain = call.ParentChain(); var alias = call.BuildRouteForPattern(_pattern); chain.AddRouteAlias(alias); }
public IRouteDefinition Build(ActionCall call) { var pattern = call.Method.GetAttribute<UrlPatternAttribute>().Pattern; var route = call.BuildRouteForPattern(pattern); return route; }
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; }
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); }
/// <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); }
public IRouteDefinition Build(ActionCall call) { var pattern = call.Method.GetAttribute <UrlPatternAttribute>().Pattern; return(call.BuildRouteForPattern(pattern)); }
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>()); }