예제 #1
0
 public DataTypeController(
     PropertyEditorCollection propertyEditors,
     IDataTypeService dataTypeService,
     IOptionsSnapshot <ContentSettings> contentSettings,
     IUmbracoMapper umbracoMapper,
     PropertyEditorCollection propertyEditorCollection,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     ILocalizedTextService localizedTextService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IConfigurationEditorJsonSerializer serializer)
     : this(
         propertyEditors,
         dataTypeService,
         contentSettings,
         umbracoMapper,
         propertyEditorCollection,
         contentTypeService,
         mediaTypeService,
         memberTypeService,
         localizedTextService,
         backOfficeSecurityAccessor,
         serializer,
         StaticServiceProvider.Instance.GetRequiredService <IDataTypeUsageService>())
 {
 }
    // gets the tag configuration for a property
    // from the datatype configuration, and the editor tag configuration attribute
    public static TagConfiguration?GetTagConfiguration(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService)
    {
        if (property == null)
        {
            throw new ArgumentNullException(nameof(property));
        }

        IDataEditor?editor = propertyEditors[property.PropertyType?.PropertyEditorAlias];
        TagsPropertyEditorAttribute?tagAttribute = editor?.GetTagAttribute();

        if (tagAttribute == null)
        {
            return(null);
        }

        var configurationObject = property.PropertyType is null
            ? null
            : dataTypeService.GetDataType(property.PropertyType.DataTypeId)?.Configuration;
        TagConfiguration?configuration = ConfigurationEditor.ConfigurationAs <TagConfiguration>(configurationObject);

        if (configuration?.Delimiter == default && configuration?.Delimiter is not null)
        {
            configuration.Delimiter = tagAttribute.Delimiter;
        }

        return(configuration);
    }
예제 #3
0
 public ContentPropertyBasicMapper(IDataTypeService dataTypeService, IEntityService entityService, ILogger logger, PropertyEditorCollection propertyEditors)
 {
     _logger          = logger;
     _propertyEditors = propertyEditors;
     DataTypeService  = dataTypeService;
     _entityService   = entityService;
 }
 public PropertyTypeGroupMapper(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IShortStringHelper shortStringHelper, ILogger <PropertyTypeGroupMapper <TPropertyType> > logger)
 {
     _propertyEditors   = propertyEditors;
     _dataTypeService   = dataTypeService;
     _shortStringHelper = shortStringHelper;
     _logger            = logger;
 }
예제 #5
0
 public MediaRepository(
     IScopeAccessor scopeAccessor,
     AppCaches cache,
     ILogger <MediaRepository> logger,
     ILoggerFactory loggerFactory,
     IMediaTypeRepository mediaTypeRepository,
     ITagRepository tagRepository,
     ILanguageRepository languageRepository,
     IRelationRepository relationRepository,
     IRelationTypeRepository relationTypeRepository,
     PropertyEditorCollection propertyEditorCollection,
     MediaUrlGeneratorCollection mediaUrlGenerators,
     DataValueReferenceFactoryCollection dataValueReferenceFactories,
     IDataTypeService dataTypeService,
     IJsonSerializer serializer,
     IEventAggregator eventAggregator)
     : base(scopeAccessor, cache, logger, languageRepository, relationRepository, relationTypeRepository, propertyEditorCollection, dataValueReferenceFactories, dataTypeService, eventAggregator)
 {
     _cache = cache;
     _mediaTypeRepository       = mediaTypeRepository ?? throw new ArgumentNullException(nameof(mediaTypeRepository));
     _tagRepository             = tagRepository ?? throw new ArgumentNullException(nameof(tagRepository));
     _mediaUrlGenerators        = mediaUrlGenerators;
     _serializer                = serializer;
     _mediaByGuidReadRepository = new MediaByGuidReadRepository(this, scopeAccessor, cache, loggerFactory.CreateLogger <MediaByGuidReadRepository>());
 }
        private void MockObjects(out PropertyValidationService validationService, out IDataType dt)
        {
            var textService = new Mock <ILocalizedTextService>();

            textService.Setup(x => x.Localize(It.IsAny <string>(), It.IsAny <string>(), Thread.CurrentThread.CurrentCulture, null)).Returns("Localized text");

            var       dataTypeService = new Mock <IDataTypeService>();
            IDataType dataType        = Mock.Of <IDataType>(
                x => x.Configuration == (object)string.Empty && // irrelevant but needs a value
                x.DatabaseType == ValueStorageType.Nvarchar &&
                x.EditorAlias == Constants.PropertyEditors.Aliases.TextBox);

            dataTypeService.Setup(x => x.GetDataType(It.IsAny <int>())).Returns(() => dataType);
            dt = dataType;

            // new data editor that returns a TextOnlyValueEditor which will do the validation for the properties
            IDataEditor dataEditor = Mock.Of <IDataEditor>(
                x => x.Type == EditorType.PropertyValue &&
                x.Alias == Constants.PropertyEditors.Aliases.TextBox);

            Mock.Get(dataEditor).Setup(x => x.GetValueEditor(It.IsAny <object>()))
            .Returns(new CustomTextOnlyValueEditor(new DataEditorAttribute(Constants.PropertyEditors.Aliases.TextBox, "Test Textbox", "textbox"), textService.Object, Mock.Of <IShortStringHelper>(), new JsonNetSerializer(), Mock.Of <IIOHelper>()));

            var propEditors = new PropertyEditorCollection(new DataEditorCollection(() => new[] { dataEditor }));

            validationService = new PropertyValidationService(propEditors, dataTypeService.Object, Mock.Of <ILocalizedTextService>(), new ValueEditorCache());
        }
 public DocumentBlueprintRepository(
     IScopeAccessor scopeAccessor,
     AppCaches appCaches,
     ILogger <DocumentBlueprintRepository> logger,
     ILoggerFactory loggerFactory,
     IContentTypeRepository contentTypeRepository,
     ITemplateRepository templateRepository,
     ITagRepository tagRepository,
     ILanguageRepository languageRepository,
     IRelationRepository relationRepository,
     IRelationTypeRepository relationTypeRepository,
     PropertyEditorCollection propertyEditorCollection,
     IDataTypeService dataTypeService,
     DataValueReferenceFactoryCollection dataValueReferenceFactories,
     IJsonSerializer serializer,
     IEventAggregator eventAggregator)
     : base(
         scopeAccessor,
         appCaches,
         logger,
         loggerFactory,
         contentTypeRepository,
         templateRepository,
         tagRepository,
         languageRepository,
         relationRepository,
         relationTypeRepository,
         propertyEditorCollection,
         dataValueReferenceFactories,
         dataTypeService,
         serializer,
         eventAggregator)
 {
 }
예제 #8
0
        public async Task PostSave_Validate_Properties_Exist()
        {
            ApiController Factory(HttpRequestMessage message, UmbracoHelper helper)
            {
                var contentServiceMock = Mock.Get(Current.Services.ContentService);

                contentServiceMock.Setup(x => x.GetById(123)).Returns(() => GetMockedContent());

                var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>()));
                var usersController          = new ContentController(propertyEditorCollection);

                return(usersController);
            }

            var json = JsonConvert.DeserializeObject <JObject>(PublishJsonInvariant);
            //add a non-existent property to a variant being saved
            var variantProps = (JArray)json["variants"].ElementAt(0)["properties"];

            variantProps.Add(JObject.FromObject(new
            {
                id    = 2,
                alias = "doesntExist",
                value = "hello"
            }));

            var runner   = new TestRunner(Factory);
            var response = await runner.Execute("Content", "PostSave", HttpMethod.Post,
                                                content : GetMultiPartRequestContent(JsonConvert.SerializeObject(json)),
                                                mediaTypeHeader : new MediaTypeWithQualityHeaderValue("multipart/form-data"),
                                                assertOkResponse : false);

            Assert.AreEqual(HttpStatusCode.NotFound, response.Item1.StatusCode);
        }
예제 #9
0
        public async Task PostSave_Simple_Invariant()
        {
            var content = GetMockedContent();

            ApiController Factory(HttpRequestMessage message, UmbracoHelper helper)
            {
                var contentServiceMock = Mock.Get(Current.Services.ContentService);

                contentServiceMock.Setup(x => x.GetById(123)).Returns(() => content);
                contentServiceMock.Setup(x => x.Save(It.IsAny <IContent>(), It.IsAny <int>(), It.IsAny <bool>()))
                .Returns(new OperationResult(OperationResultType.Success, new Core.Events.EventMessages()));     //success

                var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>()));
                var usersController          = new ContentController(propertyEditorCollection);

                return(usersController);
            }

            var runner   = new TestRunner(Factory);
            var response = await runner.Execute("Content", "PostSave", HttpMethod.Post,
                                                content : GetMultiPartRequestContent(PublishJsonInvariant),
                                                mediaTypeHeader : new MediaTypeWithQualityHeaderValue("multipart/form-data"),
                                                assertOkResponse : false);

            Assert.AreEqual(HttpStatusCode.OK, response.Item1.StatusCode);
            var display = JsonConvert.DeserializeObject <ContentItemDisplay>(response.Item2);

            Assert.AreEqual(1, display.Variants.Count());
            Assert.AreEqual(content.PropertyGroups.Count(), display.Variants.ElementAt(0).Tabs.Count());
            Assert.AreEqual(content.PropertyTypes.Count(), display.Variants.ElementAt(0).Tabs.ElementAt(0).Properties.Count());
        }
예제 #10
0
        public async Task PostSave_Validate_Existing_Content()
        {
            ApiController Factory(HttpRequestMessage message, UmbracoHelper helper)
            {
                var contentServiceMock = Mock.Get(Current.Services.ContentService);

                contentServiceMock.Setup(x => x.GetById(123)).Returns(() => null); //do not find it

                var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>()));
                var usersController          = new ContentController(propertyEditorCollection);

                return(usersController);
            }

            var runner   = new TestRunner(Factory);
            var response = await runner.Execute("Content", "PostSave", HttpMethod.Post,
                                                content : GetMultiPartRequestContent(PublishJsonInvariant),
                                                mediaTypeHeader : new MediaTypeWithQualityHeaderValue("multipart/form-data"),
                                                assertOkResponse : false);

            Assert.AreEqual(HttpStatusCode.NotFound, response.Item1.StatusCode);
            Assert.AreEqual(")]}',\n{\"Message\":\"content was not found\"}", response.Item1.Content.ReadAsStringAsync().Result);

            //var obj = JsonConvert.DeserializeObject<PagedResult<UserDisplay>>(response.Item2);
            //Assert.AreEqual(0, obj.TotalItems);
        }
예제 #11
0
        public async Task PostSave_Validate_At_Least_One_Variant_Flagged_For_Saving()
        {
            ApiController Factory(HttpRequestMessage message, UmbracoHelper helper)
            {
                var contentServiceMock = Mock.Get(Current.Services.ContentService);

                contentServiceMock.Setup(x => x.GetById(123)).Returns(() => GetMockedContent());

                var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>()));
                var usersController          = new ContentController(propertyEditorCollection);

                return(usersController);
            }

            var json = JsonConvert.DeserializeObject <JObject>(PublishJsonInvariant);

            //remove all save flaggs
            ((JArray)json["variants"])[0]["save"] = false;

            var runner   = new TestRunner(Factory);
            var response = await runner.Execute("Content", "PostSave", HttpMethod.Post,
                                                content : GetMultiPartRequestContent(JsonConvert.SerializeObject(json)),
                                                mediaTypeHeader : new MediaTypeWithQualityHeaderValue("multipart/form-data"),
                                                assertOkResponse : false);

            Assert.AreEqual(HttpStatusCode.NotFound, response.Item1.StatusCode);
            Assert.AreEqual(")]}',\n{\"Message\":\"No variants flagged for saving\"}", response.Item1.Content.ReadAsStringAsync().Result);
        }
예제 #12
0
        public async Task PostSave_Validate_At_Least_One_Variant_Flagged_For_Saving()
        {
            ApiController CtrlFactory(HttpRequestMessage message, IUmbracoContextAccessor umbracoContextAccessor, UmbracoHelper helper)
            {
                var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(Enumerable.Empty <DataEditor>()));
                var controller = new ContentController(
                    propertyEditorCollection,
                    Factory.GetInstance <IGlobalSettings>(),
                    umbracoContextAccessor,
                    Factory.GetInstance <ISqlContext>(),
                    Factory.GetInstance <ServiceContext>(),
                    Factory.GetInstance <AppCaches>(),
                    Factory.GetInstance <IProfilingLogger>(),
                    Factory.GetInstance <IRuntimeState>(),
                    helper);

                return(controller);
            }

            var json = JsonConvert.DeserializeObject <JObject>(PublishJsonInvariant);

            //remove all save flaggs
            ((JArray)json["variants"])[0]["save"] = false;

            var runner   = new TestRunner(CtrlFactory);
            var response = await runner.Execute("Content", "PostSave", HttpMethod.Post,
                                                content : GetMultiPartRequestContent(JsonConvert.SerializeObject(json)),
                                                mediaTypeHeader : new MediaTypeWithQualityHeaderValue("multipart/form-data"),
                                                assertOkResponse : false);

            Assert.AreEqual(HttpStatusCode.NotFound, response.Item1.StatusCode);
            Assert.AreEqual(")]}',\n{\"Message\":\"No variants flagged for saving\"}", response.Item1.Content.ReadAsStringAsync().Result);
        }
 public ContentPropertyMapDefinition(
     ICultureDictionary cultureDictionary,
     IDataTypeService dataTypeService,
     IEntityService entityService,
     ILocalizedTextService textService,
     ILoggerFactory loggerFactory,
     PropertyEditorCollection propertyEditors)
 {
     _contentPropertyBasicConverter = new ContentPropertyBasicMapper <ContentPropertyBasic>(
         dataTypeService,
         entityService,
         loggerFactory.CreateLogger <ContentPropertyBasicMapper <ContentPropertyBasic> >(),
         propertyEditors);
     _contentPropertyDtoConverter = new ContentPropertyDtoMapper(
         dataTypeService,
         entityService,
         loggerFactory.CreateLogger <ContentPropertyDtoMapper>(),
         propertyEditors);
     _contentPropertyDisplayMapper = new ContentPropertyDisplayMapper(
         cultureDictionary,
         dataTypeService,
         entityService,
         textService,
         loggerFactory.CreateLogger <ContentPropertyDisplayMapper>(),
         propertyEditors);
 }
 public CreateVendrCheckoutDataTypesTask(IDataTypeService dataTypeService, PropertyEditorCollection propertyEditors,
                                         IConfigurationEditorJsonSerializer configurationEditorJsonSerializer)
 {
     _dataTypeService = dataTypeService;
     _propertyEditors = propertyEditors;
     _configurationEditorJsonSerializer = configurationEditorJsonSerializer;
 }
        public static IMappingExpression <TSource, TDestination> MapBaseContentTypeEntityToDisplay <TSource, TDestination, TPropertyTypeDisplay>(
            this IMappingExpression <TSource, TDestination> mapping, PropertyEditorCollection propertyEditors,
            IDataTypeService dataTypeService, IContentTypeService contentTypeService, ILogger logger)
            where TSource : IContentTypeComposition
            where TDestination : ContentTypeCompositionDisplay <TPropertyTypeDisplay>
            where TPropertyTypeDisplay : PropertyTypeDisplay, new()
        {
            var contentTypeUdiResolver     = new ContentTypeUdiResolver();
            var lockedCompositionsResolver = new LockedCompositionsResolver(contentTypeService);
            var propertyTypeGroupResolver  = new PropertyTypeGroupResolver <TPropertyTypeDisplay>(propertyEditors, dataTypeService, logger);

            return(mapping
                   .ForMember(dest => dest.Udi, opt => opt.MapFrom(src => contentTypeUdiResolver.Resolve(src)))
                   .ForMember(dest => dest.Notifications, opt => opt.Ignore())
                   .ForMember(dest => dest.Blueprints, opt => opt.Ignore())
                   .ForMember(dest => dest.Errors, opt => opt.Ignore())
                   .ForMember(dest => dest.AllowAsRoot, opt => opt.MapFrom(src => src.AllowedAsRoot))
                   .ForMember(dest => dest.ListViewEditorName, opt => opt.Ignore())
                   //Ignore because this is not actually used for content types
                   .ForMember(dest => dest.Trashed, opt => opt.Ignore())

                   .ForMember(dest => dest.AllowedContentTypes, opt => opt.MapFrom(src => src.AllowedContentTypes.Select(x => x.Id.Value)))
                   .ForMember(dest => dest.CompositeContentTypes, opt => opt.MapFrom(src => src.ContentTypeComposition))
                   .ForMember(dest => dest.LockedCompositeContentTypes, opt => opt.MapFrom(src => lockedCompositionsResolver.Resolve(src)))
                   .ForMember(dest => dest.Groups, opt => opt.MapFrom(src => propertyTypeGroupResolver.Resolve(src)))
                   .ForMember(dest => dest.AdditionalData, opt => opt.Ignore()));
        }
예제 #16
0
        // gets the tag configuration for a property
        // from the datatype configuration, and the editor tag configuration attribute
        public static TagConfiguration GetTagConfiguration(this IProperty property, PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            var editor       = propertyEditors[property.PropertyType.PropertyEditorAlias];
            var tagAttribute = editor.GetTagAttribute();

            if (tagAttribute == null)
            {
                return(null);
            }

            var configurationObject = dataTypeService.GetDataType(property.PropertyType.DataTypeId).Configuration;
            var configuration       = ConfigurationEditor.ConfigurationAs <TagConfiguration>(configurationObject);

            if (configuration.Delimiter == default)
            {
                configuration.Delimiter = tagAttribute.Delimiter;
            }

            return(configuration);
        }
예제 #17
0
    private MemberRepository CreateRepository(IScopeProvider provider)
    {
        var accessor = (IScopeAccessor)provider;
        var tagRepo  = GetRequiredService <ITagRepository>();
        var relationTypeRepository = GetRequiredService <IRelationTypeRepository>();
        var relationRepository     = GetRequiredService <IRelationRepository>();
        var propertyEditors        =
            new PropertyEditorCollection(new DataEditorCollection(() => Enumerable.Empty <IDataEditor>()));
        var dataValueReferences =
            new DataValueReferenceFactoryCollection(() => Enumerable.Empty <IDataValueReferenceFactory>());

        return(new MemberRepository(
                   accessor,
                   AppCaches.Disabled,
                   LoggerFactory.CreateLogger <MemberRepository>(),
                   MemberTypeRepository,
                   MemberGroupRepository,
                   tagRepo,
                   Mock.Of <ILanguageRepository>(),
                   relationRepository,
                   relationTypeRepository,
                   PasswordHasher,
                   propertyEditors,
                   dataValueReferences,
                   DataTypeService,
                   JsonSerializer,
                   Mock.Of <IEventAggregator>(),
                   Options.Create(new MemberPasswordConfigurationSettings())));
    }
 public DataTypeValidateFilter(IDataTypeService dataTypeService, PropertyEditorCollection propertyEditorCollection, IUmbracoMapper umbracoMapper)
 {
     _dataTypeService          = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService));
     _propertyEditorCollection = propertyEditorCollection ??
                                 throw new ArgumentNullException(nameof(propertyEditorCollection));
     _umbracoMapper = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
 }
예제 #19
0
        private static MediaVersionDto BuildMediaVersionDto(PropertyEditorCollection propertyEditors, IMedia entity, ContentDto contentDto)
        {
            // try to get a path from the string being stored for media
            // TODO: only considering umbracoFile

            string path = null;

            if (entity.Properties.TryGetValue(Constants.Conventions.Media.File, out var property) &&
                propertyEditors.TryGet(property.PropertyType.PropertyEditorAlias, out var editor) &&
                editor is IDataEditorWithMediaPath dataEditor)
            {
                var value = property.GetValue();
                path = dataEditor.GetMediaPath(value);
            }

            var dto = new MediaVersionDto
            {
                Id   = entity.VersionId,
                Path = path,

                ContentVersionDto = BuildContentVersionDto(entity, contentDto)
            };

            return(dto);
        }
예제 #20
0
 public DataTypeMigration(IMigrationContext context, PreValueMigratorCollection preValueMigrators, PropertyEditorCollection propertyEditors, ILogger logger)
     : base(context)
 {
     _preValueMigrators = preValueMigrators;
     _propertyEditors   = propertyEditors;
     _logger            = logger;
 }
예제 #21
0
 public CustomContentValueSetBuilder(PropertyEditorCollection propertyEditors,
                                     UrlSegmentProviderCollection urlSegmentProviders,
                                     IUserService userService,
                                     bool publishedValuesOnly)
     : this(propertyEditors, urlSegmentProviders, userService, Current.ScopeProvider, publishedValuesOnly)
 {
 }
예제 #22
0
        public static ContentIndexPopulator GetContentIndexRebuilder(PropertyEditorCollection propertyEditors, IContentService contentService, ISqlContext sqlContext, bool publishedValuesOnly)
        {
            var contentValueSetBuilder = GetContentValueSetBuilder(propertyEditors, publishedValuesOnly);
            var contentIndexDataSource = new ContentIndexPopulator(true, null, contentService, sqlContext, contentValueSetBuilder);

            return(contentIndexDataSource);
        }
        //private readonly MembershipProvider membershipProvider;
        public ExtendedMemberController(PropertyEditorCollection propertyEditors, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor,
                                        ISqlContext sqlContext, ServiceContext services,
                                        AppCaches appCaches, IProfilingLogger logger, Umbraco.Core.IRuntimeState runtimeState,
                                        UmbracoHelper umbracoHelper, IMemberExtendedService memberExtendedService) :
            base(propertyEditors, globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
#endif
        {
            this.propertyEditors       = propertyEditors;
            this.memberExtendedService = memberExtendedService;
#if NET5_0_OR_GREATER
            this.dataTypeService            = dataTypeService;
            this.memberTypeService          = memberTypeService;
            this.memberGroupService         = memberGroupService;
            this.memberManager              = memberManager;
            this.umbracoMapper              = umbracoMapper;
            this.backOfficeSecurityAccessor = backOfficeSecurityAccessor;
            settings = new Settings(configuration);
#else
            dataTypeService    = services.DataTypeService;
            memberTypeService  = services.MemberTypeService;
            memberGroupService = services.MemberGroupService;
            //membershipProvider = MembershipProviderExtensions.GetMembersMembershipProvider();
            settings = new Settings();
#endif
        }
예제 #24
0
        public static MediaIndexPopulator GetMediaIndexRebuilder(PropertyEditorCollection propertyEditors, IMediaService mediaService)
        {
            var mediaValueSetBuilder = new MediaValueSetBuilder(propertyEditors, new UrlSegmentProviderCollection(new[] { new DefaultUrlSegmentProvider() }), GetMockUserService(), GetMockLogger());
            var mediaIndexDataSource = new MediaIndexPopulator(null, mediaService, mediaValueSetBuilder);

            return(mediaIndexDataSource);
        }
예제 #25
0
 public DataTypeMapDefinition(PropertyEditorCollection propertyEditors, ILogger <DataTypeMapDefinition> logger, IOptions <ContentSettings> contentSettings, IConfigurationEditorJsonSerializer serializer)
 {
     _propertyEditors = propertyEditors;
     _logger          = logger;
     _contentSettings = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
     _serializer      = serializer;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MemberController"/> class.
 /// </summary>
 /// <param name="cultureDictionary">The culture dictionary</param>
 /// <param name="loggerFactory">The logger factory</param>
 /// <param name="shortStringHelper">The string helper</param>
 /// <param name="eventMessages">The event messages factory</param>
 /// <param name="localizedTextService">The entry point for localizing key services</param>
 /// <param name="propertyEditors">The property editors</param>
 /// <param name="umbracoMapper">The mapper</param>
 /// <param name="memberService">The member service</param>
 /// <param name="memberTypeService">The member type service</param>
 /// <param name="memberManager">The member manager</param>
 /// <param name="dataTypeService">The data-type service</param>
 /// <param name="backOfficeSecurityAccessor">The back office security accessor</param>
 /// <param name="jsonSerializer">The JSON serializer</param>
 /// <param name="passwordChanger">The password changer</param>
 public MemberController(
     ICultureDictionary cultureDictionary,
     ILoggerFactory loggerFactory,
     IShortStringHelper shortStringHelper,
     IEventMessagesFactory eventMessages,
     ILocalizedTextService localizedTextService,
     PropertyEditorCollection propertyEditors,
     IUmbracoMapper umbracoMapper,
     IMemberService memberService,
     IMemberTypeService memberTypeService,
     IMemberManager memberManager,
     IDataTypeService dataTypeService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IJsonSerializer jsonSerializer,
     IPasswordChanger <MemberIdentityUser> passwordChanger,
     ICoreScopeProvider scopeProvider)
     : base(cultureDictionary, loggerFactory, shortStringHelper, eventMessages, localizedTextService, jsonSerializer)
 {
     _propertyEditors            = propertyEditors;
     _umbracoMapper              = umbracoMapper;
     _memberService              = memberService;
     _memberTypeService          = memberTypeService;
     _memberManager              = memberManager;
     _dataTypeService            = dataTypeService;
     _localizedTextService       = localizedTextService;
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor;
     _jsonSerializer             = jsonSerializer;
     _shortStringHelper          = shortStringHelper;
     _passwordChanger            = passwordChanger;
     _scopeProvider              = scopeProvider;
 }
예제 #27
0
 public DataTypeController(
     PropertyEditorCollection propertyEditors,
     IDataTypeService dataTypeService,
     IOptionsSnapshot <ContentSettings> contentSettings,
     IUmbracoMapper umbracoMapper,
     PropertyEditorCollection propertyEditorCollection,
     IContentTypeService contentTypeService,
     IMediaTypeService mediaTypeService,
     IMemberTypeService memberTypeService,
     ILocalizedTextService localizedTextService,
     IBackOfficeSecurityAccessor backOfficeSecurityAccessor,
     IConfigurationEditorJsonSerializer serializer)
 {
     _propertyEditors            = propertyEditors ?? throw new ArgumentNullException(nameof(propertyEditors));
     _dataTypeService            = dataTypeService ?? throw new ArgumentNullException(nameof(dataTypeService));
     _contentSettings            = contentSettings.Value ?? throw new ArgumentNullException(nameof(contentSettings));
     _umbracoMapper              = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     _propertyEditorCollection   = propertyEditorCollection ?? throw new ArgumentNullException(nameof(propertyEditorCollection));
     _contentTypeService         = contentTypeService ?? throw new ArgumentNullException(nameof(contentTypeService));
     _mediaTypeService           = mediaTypeService ?? throw new ArgumentNullException(nameof(mediaTypeService));
     _memberTypeService          = memberTypeService ?? throw new ArgumentNullException(nameof(memberTypeService));
     _localizedTextService       = localizedTextService ?? throw new ArgumentNullException(nameof(localizedTextService));
     _backOfficeSecurityAccessor = backOfficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backOfficeSecurityAccessor));
     _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer));
 }
예제 #28
0
        private static PropertyValidationService GetPropertyValidationService()
        {
            IIOHelper                  ioHelper                  = Mock.Of <IIOHelper>();
            IDataTypeService           dataTypeService           = Mock.Of <IDataTypeService>();
            ILocalizedTextService      localizedTextService      = Mock.Of <ILocalizedTextService>();
            IEditorConfigurationParser editorConfigurationParser = Mock.Of <IEditorConfigurationParser>();

            var attribute = new DataEditorAttribute("a", "a", "a");
            IDataValueEditorFactory dataValueEditorFactory = Mock.Of <IDataValueEditorFactory>(x
                                                                                               => x.Create <TextOnlyValueEditor>(It.IsAny <DataEditorAttribute>()) == new TextOnlyValueEditor(attribute, localizedTextService, Mock.Of <IShortStringHelper>(), new JsonNetSerializer(), Mock.Of <IIOHelper>()));


            var textBoxEditor = new TextboxPropertyEditor(
                dataValueEditorFactory,
                ioHelper,
                editorConfigurationParser);

            var serializer = new ConfigurationEditorJsonSerializer();

            var mockDataTypeService = new Mock <IDataTypeService>();

            Mock.Get(dataTypeService).Setup(x => x.GetDataType(It.Is <int>(y => y == Constants.DataTypes.Textbox)))
            .Returns(new DataType(textBoxEditor, serializer));

            var propertyEditorCollection = new PropertyEditorCollection(new DataEditorCollection(() => new[] { textBoxEditor }));

            return(new PropertyValidationService(
                       propertyEditorCollection,
                       dataTypeService,
                       localizedTextService,
                       new ValueEditorCache()));
        }
예제 #29
0
 public MemberRepository(
     IScopeAccessor scopeAccessor,
     AppCaches cache,
     ILogger <MemberRepository> logger,
     IMemberTypeRepository memberTypeRepository,
     IMemberGroupRepository memberGroupRepository,
     ITagRepository tagRepository,
     ILanguageRepository languageRepository,
     IRelationRepository relationRepository,
     IRelationTypeRepository relationTypeRepository,
     IPasswordHasher passwordHasher,
     PropertyEditorCollection propertyEditors,
     DataValueReferenceFactoryCollection dataValueReferenceFactories,
     IDataTypeService dataTypeService,
     IJsonSerializer serializer,
     IEventAggregator eventAggregator,
     IOptions <MemberPasswordConfigurationSettings> passwordConfiguration)
     : base(scopeAccessor, cache, logger, languageRepository, relationRepository, relationTypeRepository,
            propertyEditors, dataValueReferenceFactories, dataTypeService, eventAggregator)
 {
     _memberTypeRepository =
         memberTypeRepository ?? throw new ArgumentNullException(nameof(memberTypeRepository));
     _tagRepository               = tagRepository ?? throw new ArgumentNullException(nameof(tagRepository));
     _passwordHasher              = passwordHasher;
     _jsonSerializer              = serializer;
     _memberGroupRepository       = memberGroupRepository;
     _passwordConfiguration       = passwordConfiguration.Value;
     _memberByUsernameCachePolicy =
         new DefaultRepositoryCachePolicy <IMember, string>(GlobalIsolatedCache, ScopeAccessor, DefaultOptions);
 }
 public BlockListPropertyEditor(
     IDataValueEditorFactory dataValueEditorFactory,
     PropertyEditorCollection propertyEditors,
     IIOHelper ioHelper)
     : this(dataValueEditorFactory, propertyEditors, ioHelper, StaticServiceProvider.Instance.GetRequiredService <IEditorConfigurationParser>())
 {
 }