void AssertMultipleFilters(FilterScope filterScope,
                                   Action <IRegistrationBuilder <TFilter1, SimpleActivatorData, SingleRegistrationStyle> > configure1,
                                   Action <IRegistrationBuilder <TFilter2, SimpleActivatorData, SingleRegistrationStyle> > configure2)
        {
            var builder = new ContainerBuilder();

            configure1(builder.Register(c => new TFilter1()));
            configure2(builder.Register(c => new TFilter2()));
            var container = builder.Build();

            SetupMockLifetimeScopeProvider(container);
            var actionDescriptor = new ReflectedActionDescriptor(_baseMethodInfo, _actionName, _controllerDescriptor);
            var provider         = new AutofacFilterProvider();

            var filters = provider.GetFilters(_baseControllerContext, actionDescriptor).ToList();

            Assert.That(filters, Has.Count.EqualTo(2));

            var filter = filters.Single(f => f.Instance is TFilter1);

            Assert.That(filter.Scope, Is.EqualTo(filterScope));
            Assert.That(filter.Order, Is.EqualTo(Filter.DefaultOrder));

            filter = filters.Single(f => f.Instance is TFilter2);
            Assert.That(filter.Scope, Is.EqualTo(filterScope));
            Assert.That(filter.Order, Is.EqualTo(20));
        }
        public OrderedFilterInfo(IFilter instance, FilterScope scope)
        {
            if (instance == null) { throw new ArgumentNullException("instance"); }

            Instance = instance;
            Scope = scope;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="NinjectFilter&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="kernel">The kernel.</param>
 /// <param name="scope">The filter scope.</param>
 /// <param name="order">The filter order.</param>
 /// <param name="filterId">The filter id.</param>
 public NinjectFilter(IKernel kernel, FilterScope scope, int?order, Guid filterId)
 {
     this.kernel   = kernel;
     this.scope    = scope;
     this.order    = order;
     this.filterId = filterId;
 }
        public void GivenInvalidFilterScope_WhenParseType_ExceptionShouldBeThrown()
        {
            const FilterScope filterScope = (FilterScope)2;

            Assert.Throws <ConfigurationErrorException>(() =>
                                                        _typeFilterParser.CreateTypeFilters(filterScope, null, null));
        }
Example #5
0
        public FilterGrouping(IEnumerable <FilterInfo> filters)
        {
            // evaluate the 'filters' enumerable only once since the operation can be quite expensive
            List <FilterInfo> orderedCache = filters.ToList();

            List <FilterInfo> overrides = orderedCache
                                          .Where(f => f.Instance is IOverrideFilter)
                                          .ToList();

            FilterScope actionOverride        = SelectLastOverrideScope <IActionFilter>(overrides);
            FilterScope authorizationOverride = SelectLastOverrideScope <IAuthorizationFilter>(
                overrides
                );
            FilterScope authenticationOverride = SelectLastOverrideScope <IAuthenticationFilter>(
                overrides
                );
            FilterScope exceptionOverride = SelectLastOverrideScope <IExceptionFilter>(overrides);

            _actionFilters        = SelectAvailable <IActionFilter>(orderedCache, actionOverride);
            _authorizationFilters = SelectAvailable <IAuthorizationFilter>(
                orderedCache,
                authorizationOverride
                );
            _authenticationFilters = SelectAvailable <IAuthenticationFilter>(
                orderedCache,
                authenticationOverride
                );
            _exceptionFilters = SelectAvailable <IExceptionFilter>(orderedCache, exceptionOverride);
        }
Example #6
0
 IEnumerable <FilterInfo> GetFilterInfos(
     IEnumerable <IServiceAttribute> allAttributes, FilterScope scope)
 {
     return(_resolver
            .Resolve <IFilter>(allAttributes)
            .Select(f => new FilterInfo(f, scope)));
 }
 IEnumerable<FilterInfo> GetFilterInfos(
     IEnumerable<IFilterServiceAttribute> allAttributes, FilterScope scope)
 {
     return _resolver
         .Resolve<IFilter>(allAttributes)
         .Select(f => new FilterInfo(f, scope));
 }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FilterRegistryItem"/> class.
        /// </summary>
        /// <param name="filters">The filters.</param>
        /// <param name="filterScope"></param>
        protected FilterRegistryItem([NotNull] IEnumerable<Func<IMvcFilter>> filters, FilterScope filterScope)
        {
            Invariant.IsNotNull(filters, "filters");

            this.filters = filters;
            this.filterScope = filterScope;
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FilterRegistryItem"/> class.
        /// </summary>
        /// <param name="filters">The filters.</param>
        /// <param name="filterScope"></param>
        protected FilterRegistryItem(IEnumerable <Func <IMvcFilter> > filters, FilterScope filterScope)
        {
            Invariant.IsNotNull(filters, "filters");

            this.filters     = filters;
            this.filterScope = filterScope;
        }
Example #10
0
            public CustomFilterInfo(IFilter instance, FilterScope scope)
            {
                ExceptionUtils.ThrowIfNull(instance);
                Instance = instance;
                Scope    = scope;
                InstanceBaseAttribute = Instance as IOrderableFilter;

                // See "Filtering in ASP.NET MVC": http://msdn.microsoft.com/en-us/library/gg416513(v=vs.98).aspx

                if (Instance is AuthorizationFilterAttribute)
                {
                    FilterByTypeOrder = 0;
                }
                else if (Instance is ActionFilterAttribute)
                {
                    FilterByTypeOrder = 1;
                }
                else if (Instance is ExceptionFilterAttribute)
                {
                    FilterByTypeOrder = 2;
                }
                else
                {
                    throw new ArgException("Unrecognized filter attribute type: {0}", Instance.GetType().Name);
                }
            }
        private static void ResolveScopedOverrideFilter(
            FilterContext filterContext,
            FilterScope scope,
            AutofacFilterCategory filterCategory,
            ILifetimeScope lifeTimeScope,
            HttpActionDescriptor descriptor)
        {
            var filters = filterContext.LifetimeScope.Resolve <IEnumerable <Meta <IOverrideFilter> > >();

            foreach (var filter in filters)
            {
                var metadata = filter.Metadata.TryGetValue(FilterMetadataKey, out var metadataAsObject)
                    ? metadataAsObject as FilterMetadata
                    : null;

                if (metadata != null)
                {
                    foreach (var filterRegistration in metadata.PredicateSet)
                    {
                        if (FilterMatchesAndNotAlreadyAdded(filterContext, scope, filterCategory, lifeTimeScope, filterRegistration, descriptor))
                        {
                            filterContext.Filters.Add(new FilterInfo(filter.Value, scope));
                            filterContext.AddedFilters[filterCategory].Add(filterRegistration);
                        }
                    }
                }
            }
        }
Example #12
0
 internal WhenDsl(TDsl innerDsl, Type guardConstraintType, FilterScope scope)
 {
     Scope         = scope;
     this.innerDsl = innerDsl;
     guardContraintRegistration = innerDsl.CreateTypeRegistration(guardConstraintType, EmptyActionDescriptor.Instance, EmptyControllerDescriptor.Instance, scope);
     //guardContraintRegistration = CreateTypeRegistration(guardConstraintType, EmptyActionDescriptor.Instance, EmptyControllerDescriptor.Instance);
 }
            public Filter(InterceptorAttribute attribute, FilterScope scope)
            {
                attribute.NotNull("attribute");

                this.Attribute = attribute;
                this.Scope     = scope;
            }
        private static void ResolveScopedFilter <TFilter, TWrapper>(
            FilterContext filterContext,
            FilterScope scope,
            ILifetimeScope lifeTimeScope,
            HttpActionDescriptor descriptor,
            Func <HashSet <FilterMetadata>, TWrapper> wrapperFactory,
            AutofacFilterCategory filterCategory)
            where TFilter : class
            where TWrapper : class, IFilter
        {
            var filters = filterContext.LifetimeScope.Resolve <IEnumerable <Meta <Lazy <TFilter> > > >();

            // We'll store the unique filter registrations here until we create the wrapper.
            HashSet <FilterMetadata> metadataSet = null;

            foreach (var filter in filters)
            {
                var metadata = filter.Metadata.TryGetValue(FilterMetadataKey, out var metadataAsObject)
                    ? metadataAsObject as FilterMetadata
                    : null;

                // Match the filter category (action filter, authentication, the overrides, etc).
                if (metadata != null)
                {
                    // Each individual predicate of the filter 'could' match the action descriptor.
                    // The HashSet makes sure the same filter doesn't go in twice.
                    foreach (var filterRegistration in metadata.PredicateSet)
                    {
                        if (FilterMatches(scope, filterCategory, lifeTimeScope, descriptor, filterRegistration))
                        {
                            if (metadataSet == null)
                            {
                                // Don't define a hash set if something has already been registered (should just be the IOverrideFilters).
                                if (!MatchingFilterAlreadyAdded(filterContext, filterCategory, lifeTimeScope, descriptor, filterRegistration))
                                {
                                    metadataSet = new HashSet <FilterMetadata>
                                    {
                                        metadata,
                                    };

                                    filterContext.AddedFilters[filterCategory].Add(filterRegistration);
                                }
                            }
                            else
                            {
                                metadataSet.Add(metadata);
                            }
                        }
                    }
                }
            }

            if (metadataSet != null)
            {
                // Declare our wrapper (telling it which filters it is responsible for)
                var wrapper = wrapperFactory(metadataSet);
                filterContext.Filters.Add(new FilterInfo(wrapper, scope));
            }
        }
    public static FilterScope <T> AddScope <T>(
        this IFilterVisitorContext <T> context)
    {
        FilterScope <T>?closure = context.CreateScope();

        context.Scopes.Push(closure);
        return(closure);
    }
        private static Filter CreateFilter(FilterAttribute filterAttribute, FilterScope scope)
        {
            if (filterAttribute == null)
            {
                throw new ArgumentNullException(nameof(filterAttribute));
            }

            return(new Filter(filterAttribute, scope, filterAttribute.Order));
        }
Example #17
0
 private static IEnumerable <T> SelectAvailable <T>(List <Filter> filters, FilterScope overrideFiltersBeforeScope)
 {
     // Determine which filters are available for this filter type, given the current overrides in place.
     // A filter should be processed if:
     //  1. It implements the appropriate interface for this filter type.
     //  2. It has not been overridden (its scope is not before the scope of the last override for this type).
     return(filters.Where(f => f.Scope >= overrideFiltersBeforeScope && (f.Instance is T)).Select(
                f => (T)f.Instance));
 }
Example #18
0
 public OrderedFilterInfo(IFilter instance, FilterScope scope)
 {
     if (instance == null)
     {
         throw new ArgumentNullException("instance");
     }
     Instance = instance;
     Scope    = scope;
 }
        public FilterInfo(IFilter instance, FilterScope scope)
        {
            if (instance == null)
            {
                throw Error.ArgumentNull("instance");
            }

            Instance = instance;
            Scope    = scope;
        }
Example #20
0
        public FilterInfo(IFilter instance, FilterScope scope)
        {
            if (instance == null)
            {
                throw Error.ArgumentNull("instance");
            }

            Instance = instance;
            Scope = scope;
        }
Example #21
0
        public IEnumerable <TypeFilter> CreateTypeFilters(
            FilterScope filterScope,
            string typeString,
            string filterString)
        {
            var requiredTypes = ParseType(filterScope, typeString).ToHashSet();
            var typeFilters   = ParseTypeFilter(filterString).ToList();

            ValidateTypeFilters(requiredTypes, typeFilters);

            // Generate base type filters for the types without typeFilters,
            // so dataClient can handle all the cases with a unify interface.
            var filteredTypes = new HashSet <string>();

            foreach (var filter in typeFilters)
            {
                filteredTypes.Add(filter.ResourceType);
            }

            var nonFilterTypes = requiredTypes.Where(x => !filteredTypes.Contains(x)).ToList();

            if (nonFilterTypes.Any())
            {
                switch (filterScope)
                {
                // For system filter scope, generate a typeFilter for each resource type
                case FilterScope.System:
                    typeFilters.AddRange(nonFilterTypes.Select(type => new TypeFilter(type, null)));
                    break;

                // For group filter scope, just generate a typeFilter for all the resource types
                case FilterScope.Group:
                    List <KeyValuePair <string, string> > parameters = null;

                    // if both typeString and filterString aren't specified, the request url is "https://{fhirURL}/Patient/{patientId}/*"
                    // otherwise, the request url is "https://{fhirURL}/Patient/{patientId}/*?_type={nonFilterTypes}"
                    if (!string.IsNullOrWhiteSpace(typeString) || !string.IsNullOrWhiteSpace(filterString))
                    {
                        parameters = new List <KeyValuePair <string, string> > {
                            new (FhirApiConstants.TypeKey, string.Join(',', nonFilterTypes))
                        };
                    }

                    typeFilters.Add(new TypeFilter(FhirConstants.AllResource, parameters));
                    break;

                default:
                    // this case should not happen
                    throw new ConfigurationErrorException($"The filterScope {filterScope} isn't supported now");
                }
            }

            _logger.LogInformation($"Create TypeFilters successfully, there are {typeFilters.Count} TypeFilters created.");
            return(typeFilters);
        }
		protected override Filter CreateFilter(PluginTreeNode node, FilterScope scope)
		{
			var value = node.UnwrapValue(ObtainMode.Auto, null);

			if(value is Filter)
				return (Filter)value;

			var filter = new Filter(value, this.GetFilterScope(scope), null);
			node.Tree.Mount(node, filter);
			return filter;
		}
        public InstanceRegistration(IConstraint constraint, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope scope1)
            : base(actionDescriptor, controllerDescriptor, scope1)
        {
            if (constraint == null)
            {
                throw new ArgumentNullException("constraint", "Constraint instance can not be null.");
            }

            Constraint = constraint;
            ConstraintType = Constraint.GetType();
        }
 private static void ResolveAllScopedFilters(FilterContext filterContext, FilterScope scope, ILifetimeScope lifeTimeScope, HttpActionDescriptor descriptor)
 {
     ResolveScopedFilter <IAutofacContinuationActionFilter, ContinuationActionFilterWrapper>(
         filterContext, scope, lifeTimeScope, descriptor, hs => new ContinuationActionFilterWrapper(hs), AutofacFilterCategory.ActionFilter);
     ResolveScopedFilter <IAutofacAuthenticationFilter, AuthenticationFilterWrapper>(
         filterContext, scope, lifeTimeScope, descriptor, hs => new AuthenticationFilterWrapper(hs), AutofacFilterCategory.AuthenticationFilter);
     ResolveScopedFilter <IAutofacAuthorizationFilter, AuthorizationFilterWrapper>(
         filterContext, scope, lifeTimeScope, descriptor, hs => new AuthorizationFilterWrapper(hs), AutofacFilterCategory.AuthorizationFilter);
     ResolveScopedFilter <IAutofacExceptionFilter, ExceptionFilterWrapper>(
         filterContext, scope, lifeTimeScope, descriptor, hs => new ExceptionFilterWrapper(hs), AutofacFilterCategory.ExceptionFilter);
 }
 private static void ResolveScopedNoopFilterOverrides(
     FilterContext filterContext,
     FilterScope scope,
     ILifetimeScope lifeTimeScope,
     HttpActionDescriptor descriptor)
 {
     ResolveScopedOverrideFilter(filterContext, scope, AutofacFilterCategory.ActionFilterOverride, lifeTimeScope, descriptor);
     ResolveScopedOverrideFilter(filterContext, scope, AutofacFilterCategory.AuthenticationFilterOverride, lifeTimeScope, descriptor);
     ResolveScopedOverrideFilter(filterContext, scope, AutofacFilterCategory.AuthorizationFilterOverride, lifeTimeScope, descriptor);
     ResolveScopedOverrideFilter(filterContext, scope, AutofacFilterCategory.ExceptionFilterOverride, lifeTimeScope, descriptor);
 }
Example #26
0
        public void It_has_a_constructor_that_takes_an_IdmResource_without_Creator()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
            };
            var it = new FilterScope(resource);

            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.IsNull(it.Creator);
        }
 private static bool FilterMatches(
     FilterScope scope,
     AutofacFilterCategory filterCategory,
     ILifetimeScope lifeTimeScope,
     HttpActionDescriptor descriptor,
     FilterPredicateMetadata metadata)
 {
     return(metadata.FilterCategory == filterCategory &&
            metadata.Scope == scope &&
            metadata.Predicate(lifeTimeScope, descriptor));
 }
 private static bool FilterMatchesAndNotAlreadyAdded(
     FilterContext filterContext,
     FilterScope scope,
     AutofacFilterCategory filterCategory,
     ILifetimeScope lifeTimeScope,
     FilterPredicateMetadata metadata,
     HttpActionDescriptor descriptor)
 {
     return(FilterMatches(scope, filterCategory, lifeTimeScope, descriptor, metadata) &&
            !MatchingFilterAlreadyAdded(filterContext, filterCategory, lifeTimeScope, descriptor, metadata));
 }
Example #29
0
    private IEnumerable <FilterInfo> OrderFilters(IEnumerable <IFilter> filters, FilterScope scope)
    {
        // get all filter that dont implement IOrderedFilter and give them order number of 0
        var notOrderableFilter = filters.Where(f => !(f is IOrderedFilter))
                                 .Select(instance => new KeyValuePair <int, FilterInfo>(0, new FilterInfo(instance, scope)));
        // get all filter that implement IOrderFilter and give them order number from the instance
        var orderableFilter = filters.OfType <IOrderedFilter>().OrderBy(filter => filter.Order)
                              .Select(instance => new KeyValuePair <int, FilterInfo>(instance.Order, new FilterInfo(instance, scope)));

        // concat lists => order => return
        return(notOrderableFilter.Concat(orderableFilter).OrderBy(x => x.Key).Select(y => y.Value));
    }
Example #30
0
    protected FilterVisitorContext(
        IFilterInputType initialType,
        FilterScope <T>?filterScope = null)
    {
        if (initialType is null)
        {
            throw new ArgumentNullException(nameof(initialType));
        }

        Types.Push(initialType);
        Scopes = new Stack <FilterScope <T> >();
        Scopes.Push(filterScope ?? CreateScope());
    }
 public FilterInfo(
     FilterScope filterScope,
     string groupId,
     DateTimeOffset since,
     IEnumerable <TypeFilter> typeFilters,
     Dictionary <string, int> processedPatients)
 {
     FilterScope       = filterScope;
     GroupId           = groupId;
     Since             = since;
     TypeFilters       = typeFilters ?? new List <TypeFilter>();
     ProcessedPatients = processedPatients ?? new Dictionary <string, int>();
 }
Example #32
0
		public Filter(object instance, FilterScope scope, int? order)
		{
			Precondition.Require(instance, () => Error.ArgumentNull("instance"));

			if (!order.HasValue)
			{
				IMvcFilter filter = (instance as IMvcFilter);
				order = (filter == null) ? DefaultOrder : filter.Order;
			}

			_instance = instance;
			_order = order.Value;
			_scope = scope;
		}
		private System.Web.Mvc.FilterScope GetFilterScope(FilterScope scope)
		{
			switch(scope)
			{
				case FilterScope.Global:
					return System.Web.Mvc.FilterScope.Global;
				case FilterScope.Controller:
					return System.Web.Mvc.FilterScope.Controller;
				case FilterScope.Action:
					return System.Web.Mvc.FilterScope.Action;
			}

			throw new InvalidOperationException("Invalid value of the filter scope.");
		}
Example #34
0
        public Filter(object instance, FilterScope scope, int?order)
        {
            Precondition.Require(instance, () => Error.ArgumentNull("instance"));

            if (!order.HasValue)
            {
                IMvcFilter filter = (instance as IMvcFilter);
                order = (filter == null) ? DefaultOrder : filter.Order;
            }

            _instance = instance;
            _order    = order.Value;
            _scope    = scope;
        }
Example #35
0
        public void It_has_a_constructor_that_takes_an_IdmResource()
        {
            var resource = new IdmResource
            {
                DisplayName = "My Display Name",
                Creator     = new Person {
                    DisplayName = "Creator Display Name", ObjectID = "Creator ObjectID"
                },
            };
            var it = new FilterScope(resource);

            Assert.AreEqual("FilterScope", it.ObjectType);
            Assert.AreEqual("My Display Name", it.DisplayName);
            Assert.AreEqual("Creator Display Name", it.Creator.DisplayName);
        }
Example #36
0
            // ------------- Ctors -------------
            #region Ctors
            public Rule(
                SqlInt32 ruleId,
                SqlInt32 objectType,
                SqlString scope,
                SqlString matchString
                )
            {
                m_RuleId      = ruleId;
                m_ObjectType  = objectType;
                m_Scope       = scope;
                m_MatchString = matchString;

                m_ObjectTypeEnum = getObjectClass(m_ObjectType.Value);
                m_ScopeEnum      = getScope(m_Scope.Value);
                m_WildMatch      = new Utility.WildMatch(m_MatchString.Value);
            }
Example #37
0
        public Filter(object instance, FilterScope scope, int? order) {
            if (instance == null) {
                throw new ArgumentNullException("instance");
            }

            if (order == null) {
                IMvcFilter mvcFilter = instance as IMvcFilter;
                if (mvcFilter != null) {
                    order = mvcFilter.Order;
                }
            }

            Instance = instance;
            Order = order ?? DefaultOrder;
            Scope = scope;
        }
		private Filter GetFilter(PluginTreeNode node, FilterScope scope)
		{
			return node.UnwrapValue<Filter>(ObtainMode.Auto, null, ctx =>
			{
				var instance = PluginUtility.BuildBuiltin(ctx.Builtin, new string[]{ "order", "action", "method"});

				if(instance == null)
					return;

				ctx.Result = new Filter(instance,
				                 scope,
				                 ctx.Builtin.Properties.GetValue<int>("order", Filter.DefaultOrder));
			});
		}
Example #39
0
 protected TransientRegistration(ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope scope)
 {
     ActionDescriptor = actionDescriptor;
     ControllerDescriptor = controllerDescriptor;
     this.scope = scope;
 }
Example #40
0
 public TransientRegistration(Type type, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope scope)
     : this(actionDescriptor, controllerDescriptor, scope)
 {
     ConstraintType = type;
 }
Example #41
0
        ///-----------------------------------------------------------------------------
        /// <summary>
        /// Removes profanity words in the provided input string.
        /// </summary>
        /// <remarks>
        /// The words to search could be defined in two different places:
        /// 1) In an external file. (NOT IMPLEMENTED)
        /// 2) In System/Site lists.
        /// The name of the System List is "ProfanityFilter". The name of the list in each portal is composed using the following rule:
        /// "ProfanityFilter-" + PortalID.
        /// </remarks>
        /// <param name="inputString">The string to search the words in.</param>
        /// <param name="configType">The type of configuration.</param>
        /// <param name="configSource">The external file to search the words. Ignored when configType is ListController.</param>
        /// <param name="filterScope">When using ListController configType, this parameter indicates which list(s) to use.</param>
        /// <returns>The original text with the profanity words removed.</returns>
        ///-----------------------------------------------------------------------------
        public string Remove(string inputString, ConfigType configType, string configSource, FilterScope filterScope)
        {
            switch (configType)
            {
                case ConfigType.ListController:
                    const RegexOptions options = RegexOptions.IgnoreCase | RegexOptions.Singleline;
                    const string listName = "ProfanityFilter";
            
                    var listController = new ListController();
                
                    PortalSettings settings;

                    IEnumerable<ListEntryInfo> listEntryHostInfos;
                    IEnumerable<ListEntryInfo> listEntryPortalInfos;
            
                    switch (filterScope)
                    {
                        case FilterScope.SystemList:
                            listEntryHostInfos = listController.GetListEntryInfoItems(listName, "", Null.NullInteger);
                            inputString = listEntryHostInfos.Aggregate(inputString, (current, removeItem) => Regex.Replace(current, @"\b" + removeItem.Text + @"\b", string.Empty, options));
                            break;
                        case FilterScope.SystemAndPortalList:
                            settings = PortalController.GetCurrentPortalSettings();
                            listEntryHostInfos = listController.GetListEntryInfoItems(listName, "", Null.NullInteger);
                            listEntryPortalInfos = listController.GetListEntryInfoItems(listName + "-" + settings.PortalId, "", settings.PortalId);
                            inputString = listEntryHostInfos.Aggregate(inputString, (current, removeItem) => Regex.Replace(current, @"\b" + removeItem.Text + @"\b", string.Empty, options));
                            inputString = listEntryPortalInfos.Aggregate(inputString, (current, removeItem) => Regex.Replace(current, @"\b" + removeItem.Text + @"\b", string.Empty, options));
                            break;
                        case FilterScope.PortalList:
                            settings = PortalController.GetCurrentPortalSettings();
                            listEntryPortalInfos = listController.GetListEntryInfoItems(listName + "-" + settings.PortalId, "", settings.PortalId);
                            inputString = listEntryPortalInfos.Aggregate(inputString, (current, removeItem) => Regex.Replace(current, @"\b" + removeItem.Text + @"\b", string.Empty, options));        
                            break;
                    }

                    break;
                case ConfigType.ExternalFile:
                    throw new NotImplementedException();
                default:
                    throw new ArgumentOutOfRangeException("configType");
            }

            return inputString;
        }
 public FilterInstanceInstanceRegistration(IConstraint constraint, object filterInstance, FilterScope filterScope)
     : this(constraint, EmptyActionDescriptor.Instance, EmptyControllerDescriptor.Instance, filterInstance, filterScope)
 {
 }
 public CustomFilterInfo(IFilter instance, FilterScope scope)
 {
     Instance = instance;
     Scope = scope;
     FilterInfo = new FilterInfo(Instance, Scope);
 }
 public InstanceRegistration(IConstraint constraint, FilterScope scope1)
     : this(constraint, EmptyActionDescriptor.Instance, EmptyControllerDescriptor.Instance, scope1)
 {
 }
 public FilterScope GetWithEnumParameter(FilterScope scope)
 {
     return scope;
 }
 public ExceptInstanceRegistration(IConstraint guardConstraint, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope filterScope)
     : base(new NotConstraint(guardConstraint), actionDescriptor, controllerDescriptor, filterScope)
 {
 }
 public FilterInstanceInstanceRegistration(IConstraint constraint, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, object itemInstance, FilterScope filterScope)
     : base(constraint, actionDescriptor, controllerDescriptor, filterScope)
 {
     this.itemInstance = itemInstance;
 }
 public CustomFilterWrapper(object instance, FilterScope scope, int? order
 , Func<ControllerContext, ActionDescriptor, bool> selector)
     : base(instance, scope, order)
 {
     Selector = selector;
 }
Example #49
0
 public FilterModel(Type filterType, FilterScope? filterScope, string message)
 {
     FilterTypeName = filterType.FullName;
     FilterScope = filterScope;
     Message = message;
 }
 public OrderableFilterInfo(IFilter instance, FilterScope scope)
 {
     this.Instance = instance;
     this.Scope = scope;
 }
 static IEnumerable<FilterInfo> GetFilterInfos(
     IEnumerable<IFilter> attributes, FilterScope scope)
 {
     return attributes.Select(i => new FilterInfo(i, scope));
 }
 public ExceptTransientRegistration(Type guardConstraintType, ActionDescriptor actionDescriptor, ControllerDescriptor controllerDescriptor, FilterScope filterScope)
     : base(guardConstraintType, actionDescriptor, controllerDescriptor, filterScope)
 {
 }
Example #53
0
 public FilterModel(Type filterType, FilterScope? filterScope)
 {
     FilterTypeName = filterType.FullName;
     FilterScope = filterScope;
 }
 public FilterAttributeMetadata(IFilterAttribute attribute, FilterScope scope)
 {
     Attribute = attribute; Scope = scope;
 }
Example #55
0
 public OrderedFilterInfo(IFilter instance, FilterScope scope)
 {
     Instance = instance;
     Scope = scope;
 }
 public CustomFilterInfo(IFilter instance, FilterScope scope)
 {
     this.Instance = instance;
     this.Scope = scope;
 }
Example #57
0
 private static Filter CreateFilter(object instance, FilterScope scope)
 {
     return new Filter(instance, scope, null);
 }