/// <summary>
        /// Validates visitor group
        /// </summary>
        /// <param name="currentGroup"></param>
        /// <returns></returns>
        public CriterionValidationResult Validate(VisitorGroup currentGroup)
        {
            if (Type == ClaimTypesSelectionFactory.CustomClaimType)
            {
                if (string.IsNullOrWhiteSpace(CustomType))
                {
                    return(new CriterionValidationResult(false, $"{nameof(CustomType)} must be entered when choosing Custom type option!"));
                }
            }

            return(new CriterionValidationResult(true));
        }
Example #2
0
        /// <summary>
        /// Ensures VisitorGroupContentProviderModels are removed from the datastore, if the underlying VisitorGroup has been removed
        /// </summary>
        internal void RemoveModelsWithUnknownVisitorGroup()
        {
            var groupStore = new VisitorGroupStore();
            IEnumerable <VisitorGroupContentProviderModel> allSavedModels = ContentProviderService.GetAllModels();

            foreach (var contentProviderModel in allSavedModels)
            {
                VisitorGroup group = groupStore.Load(contentProviderModel.VisitorGroupId);
                if (group == null)
                {
                    ContentProviderService.Delete(contentProviderModel.Id.ExternalId);
                }
            }
        }