Example #1
0
 public DirectUrlInjector(IHost host, IUrlParser parser, IContentItemRepository repository, IDefinitionManager definitions)
 {
     this.host        = host;
     this.parser      = parser;
     this.repository  = repository;
     this.definitions = definitions;
 }
        public DiagnosticController(IContentItemRepository repository, IHost host, IDefinitionManager definitions,
            ILinkGenerator linkGenerator, IUrlParser parser, DatabaseSection config, IFlushable flushable, IReplicationStorage repstore, 
            IFileSystemFactory fileSystemFactory)
        {
            _repository = repository;
            _host = host;
            _definitions = definitions;
            _linkGenerator = linkGenerator;
            _parser = parser;
            _flushable = flushable;
            _tablePrefix = config.TablePrefix;

            _repstore = repstore;

            if (_forceWriteLockManager != null) return;

            // Create Force Write Lock Manager
            var storageConfig = (FileSystemNamespace) Enum.Parse(typeof (FileSystemNamespace),
                ConfigurationManager.AppSettings["AzureReplicationStorageContainerName"] ??
                "ReplicationStorageDebug");

            var fileSystem = fileSystemFactory.Create(storageConfig);
            _forceWriteLockManager = new ReplicationForceWriteLockManager(fileSystem);
            _writeLockManager = new ReplicationWriteLockManager(fileSystem);
        }
Example #3
0
 public DirectUrlInjector(IHost host, IUrlParser parser, IContentItemRepository repository, IDefinitionManager definitions)
 {
     this.host = host;
     this.parser = parser;
     this.repository = repository;
     this.definitions = definitions;
 }
Example #4
0
		public VersionManager(ContentVersionRepository versionRepository, IContentItemRepository itemRepository, StateChanger stateChanger, EditSection config)
		{
			this.Repository = versionRepository;
			this.itemRepository = itemRepository;
			this.stateChanger = stateChanger;
			maximumVersionsPerItem = config.Versions.MaximumPerItem;
		}
 public VersionManager(ContentVersionRepository versionRepository, IContentItemRepository itemRepository, StateChanger stateChanger, EditSection config)
 {
     this.Repository        = versionRepository;
     this.itemRepository    = itemRepository;
     this.stateChanger      = stateChanger;
     maximumVersionsPerItem = config.Versions.MaximumPerItem;
 }
 public ContentAdminController(IContentItemRepository contentItemRepository, IContentModelsService contentModelsService, IContentBonusService contentBonusService)
     : base()
 {
     this.contentItemRepository = contentItemRepository;
     this.contentModelsService = contentModelsService;
     this.contentBonusService = contentBonusService;
 }
Example #7
0
 public UpdateFilePrefixMigration(EditSection config, IContentItemRepository repository, Tracker tracker)
 {
     this.config = config;
     this.repository = repository;
     this.tracker = tracker;
     Title = "Updates links to files with prefix";
     Description = "Updates links to files within an upload folder prepending the configured prefix (if any)";
 }
		public FixZoneNamePartsMigration(IContentItemRepository repository, IDefinitionManager definitions)
		{
			this.repository = repository;
			this.definitions = definitions;

			Title = "Fixes zone name on parts with null zone name";
			Description = "In the database parts are defined by having a non-null ZoneName property. This migrations updates parts which have a null zone name and changes it to empty string.";
		}
 public DirectUrlInjector(IHost host, IUrlParser parser, IContentItemRepository repository, IDefinitionManager definitions, Configuration.EngineSection config)
 {
     this.host        = host;
     this.parser      = parser;
     this.repository  = repository;
     this.definitions = definitions;
     this.enabled     = config.DirectUrlInjector.Enabled;
 }
Example #10
0
        public FixZoneNamePartsMigration(IContentItemRepository repository, IDefinitionManager definitions)
        {
            this.repository  = repository;
            this.definitions = definitions;

            Title       = "Fixes zone name on parts with null zone name";
            Description = "In the database parts are defined by having a non-null ZoneName property. This migrations updates parts which have a null zone name and changes it to empty string.";
        }
Example #11
0
        public static ContentPersister SetupFakePersister(out IContentItemRepository repository, IProxyFactory proxyFactory = null)
        {
            repository = new Fakes.FakeContentItemRepository(proxyFactory);

            var sources = SetupContentSource(repository);

            return(new ContentPersister(sources, repository));
        }
Example #12
0
 public UpdateFilePrefixMigration(EditSection config, IContentItemRepository repository, Tracker tracker)
 {
     this.config     = config;
     this.repository = repository;
     this.tracker    = tracker;
     Title           = "Updates links to files with prefix";
     Description     = "Updates links to files within an upload folder prepending the configured prefix (if any)";
 }
Example #13
0
        public UpdateImagesMigration(IRepository <ContentDetail> repository, IContentItemRepository itemRepository, Tracker linkTracker)
        {
            this.repository     = repository;
            this.itemRepository = itemRepository;
            this.linkTracker    = linkTracker;

            Title       = "Update tracked images to v2.3 model";
            Description = "In order to support updating images src:s when moving and renaming more information is stored about references on the site.";
        }
Example #14
0
        public UpdateLinksMigration(IRepository<ContentDetail> repository, IContentItemRepository itemRepository, Tracker linkTracker)
        {
            this.repository = repository;
            this.itemRepository = itemRepository;
            this.linkTracker = linkTracker;

            Title = "Update tracked links to v2.3 model";
            Description = "In order to support updating links on moves more information is stored about references on the site.";
        }
Example #15
0
        public UpdateImagesMigration(IRepository<ContentDetail> repository, IContentItemRepository itemRepository, Tracker linkTracker)
        {
            this.repository = repository;
            this.itemRepository = itemRepository;
            this.linkTracker = linkTracker;

            Title = "Update tracked images to v2.3 model";
            Description = "In order to support updating images src:s when moving and renaming more information is stored about references on the site.";
        }
Example #16
0
        public UpdateLinksMigration(IRepository <ContentDetail> repository, IContentItemRepository itemRepository, Tracker linkTracker)
        {
            this.repository     = repository;
            this.itemRepository = itemRepository;
            this.linkTracker    = linkTracker;

            Title       = "Update tracked links to v2.3 model";
            Description = "In order to support updating links on moves more information is stored about references on the site.";
        }
Example #17
0
        public ContentItemType(IContentItemRepository contentItemRepository)
        {
            Field(x => x.Tenant, nullable: true);
            Field(x => x.Id, nullable: true);
            Field(x => x.Name, nullable: true);
            Field(x => x.CreatedBy, nullable: true);
            Field(x => x.CreatedDate, nullable: true);
            Field(x => x.CreatedDateTicks, nullable: true);
            Field(x => x.UpdatedBy, nullable: true);
            Field(x => x.UpdatedDate, nullable: true);
            Field(x => x.UpdatedDateTicks, nullable: true);
            Field(x => x.ParentId, nullable: true);
            Field(x => x.ChildCount, nullable: true);

            Field(x => x.Alias, nullable: true);
            Field(x => x.Module, nullable: true);
            Field(x => x.Type, nullable: true);
            Field(x => x.SectionItems, nullable: true);
            Field(x => x.Content, nullable: true);
            Field(x => x.Snippet, nullable: true);
            Field(x => x.Tags, nullable: true);
            Field(x => x.Attribute01, nullable: true);
            Field(x => x.Attribute02, nullable: true);
            Field(x => x.Attribute03, nullable: true);
            Field(x => x.Attribute04, nullable: true);
            Field(x => x.Attribute05, nullable: true);
            Field(x => x.Attribute06, nullable: true);
            Field(x => x.Attribute07, nullable: true);
            Field(x => x.Attribute08, nullable: true);
            Field(x => x.Attribute09, nullable: true);
            Field(x => x.Attribute10, nullable: true);
            Field(x => x.Attribute11, nullable: true);
            Field(x => x.Attribute12, nullable: true);
            Field(x => x.Attribute13, nullable: true);
            Field(x => x.Attribute14, nullable: true);
            Field(x => x.Attribute15, nullable: true);
            Field(x => x.Attribute16, nullable: true);
            Field(x => x.Attribute17, nullable: true);
            Field(x => x.Attribute18, nullable: true);
            Field(x => x.Attribute19, nullable: true);
            Field(x => x.Attribute20, nullable: true);

            Field <ListGraphType <ContentSectionItemType>, IEnumerable <ContentSectionItem> > ()
            .Name("ContentSectionItems")
            .Resolve(x => {
                if (x != null)
                {
                    return(contentItemRepository.GetContentSectionItemsByContentItemId(x.Source.Id));
                }
                else
                {
                    return(new List <ContentSectionItem>());
                }
            });
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            repository = Engine.Resolve<IContentItemRepository>();
            activator = Engine.Resolve<ContentActivator>();

            if (!Page.IsPostBack)
            {
                LoadSelectableTypes();
                LoadSelectableItems();
                LoadSelectableEditors();
            }
            else
            {
                ie.EditableNameFilter = Request[EditableNameFilter.UniqueID].Split(',');
            }

            ie.ParentPath = Selection.SelectedItem.Path;
        }
Example #19
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            repository = Engine.Resolve <IContentItemRepository>();
            activator  = Engine.Resolve <ContentActivator>();

            if (!Page.IsPostBack)
            {
                LoadSelectableTypes();
                LoadSelectableItems();
                LoadSelectableEditors();
            }
            else
            {
                ie.EditableNameFilter = Request[EditableNameFilter.UniqueID].Split(',');
            }

            ie.ParentPath = Selection.SelectedItem.Path;
        }
Example #20
0
        public ContentItemType(IContentItemRepository contentItemRepository)
        {
            Field(x => x.Tenant, nullable: true);
            Field(x => x.Id, nullable: true);
            Field(x => x.Name, nullable: true);
            Field(x => x.CreatedBy, nullable: true);
            Field(x => x.CreatedDate, nullable: true);
            Field(x => x.LastUpdate, nullable: true);
            Field(x => x.ParentId, nullable: true);

            Field(x => x.Alias, nullable: true);
            Field(x => x.Module, nullable: true);
            Field(x => x.SectionItems, nullable: true);
            Field(x => x.Content, nullable: true);
            Field(x => x.HtmlContent, nullable: true);
            Field(x => x.Snippet, nullable: true);
            Field(x => x.Attribute01, nullable: true);
            Field(x => x.Attribute02, nullable: true);
            Field(x => x.Attribute03, nullable: true);
            Field(x => x.Attribute04, nullable: true);
            Field(x => x.Attribute05, nullable: true);
            Field(x => x.Attribute06, nullable: true);
            Field(x => x.Attribute07, nullable: true);
            Field(x => x.Attribute08, nullable: true);
            Field(x => x.Attribute09, nullable: true);
            Field(x => x.Attribute10, nullable: true);
            Field(x => x.Attribute11, nullable: true);
            Field(x => x.Attribute12, nullable: true);
            Field(x => x.Attribute13, nullable: true);
            Field(x => x.Attribute14, nullable: true);
            Field(x => x.Attribute15, nullable: true);
            Field(x => x.Attribute16, nullable: true);
            Field(x => x.Attribute17, nullable: true);
            Field(x => x.Attribute18, nullable: true);
            Field(x => x.Attribute19, nullable: true);
            Field(x => x.Attribute20, nullable: true);
        }
Example #21
0
        public AccountController(
            IClaimsService claimsService,
            UserManager <AppUser> userManager,
            SignInManager <AppUser> signInManager,
            IEmailSenderService emailSender,
            ISmsSenderService smsSender,
            ILoggerFactory loggerFactory,
            IInviteService inviteService,
            IConfiguration configuration,
            IJwtFactory jwtFactory,
            IOptions <JwtIssuerOptions> jwtOptions,
            IHttpContextAccessor httpContextAccessor,
            IUserClaimsPrincipalFactory <AppUser> userClaimsPrincipalFactory,
            IAntiforgery antiforgery,
            IContentItemRepository contentItemRepository)
        {
            _claimsService              = claimsService;
            _userManager                = userManager;
            _signInManager              = signInManager;
            _emailSender                = emailSender;
            _smsSender                  = smsSender;
            _logger                     = loggerFactory.CreateLogger <AccountController>();
            _inviteService              = inviteService;
            _configuration              = configuration;
            _jwtFactory                 = jwtFactory;
            _jwtOptions                 = jwtOptions.Value;
            _httpContextAccessor        = httpContextAccessor;
            _userClaimsPrincipalFactory = userClaimsPrincipalFactory;
            _antiforgery                = antiforgery;
            _contentItemRepository      = contentItemRepository;

            if (_configuration["InviteOnly"] == "true")
            {
                _InviteOnly = true;
            }
        }
Example #22
0
 public NewsListController(IContentItemRepository repository)
 {
     this.repository = repository;
 }
Example #23
0
        public BanicoQuery(
            ISectionRepository sectionRepository,
            ISectionItemRepository sectionItemRepository,
            IContentItemRepository contentItemRepository)
        {
            Field <ListGraphType <SectionType> >(
                "sections",
                arguments: new QueryArguments(
                    new QueryArgument <StringGraphType> {
                Name = "id"
            },
                    new QueryArgument <StringGraphType> {
                Name = "module"
            },
                    new QueryArgument <StringGraphType> {
                Name = "name"
            }
                    ),
                resolve: context => sectionRepository.Get(
                    context.GetArgument <string>("id"),
                    context.GetArgument <string>("module"),
                    context.GetArgument <string>("name")
                    ));

            Field <ListGraphType <SectionItemType> >(
                "sectionItems",
                arguments: new QueryArguments(
                    new QueryArgument <StringGraphType> {
                Name = "id"
            },
                    new QueryArgument <StringGraphType> {
                Name = "section"
            },
                    new QueryArgument <StringGraphType> {
                Name = "pathUrl"
            },
                    new QueryArgument <StringGraphType> {
                Name = "alias"
            },
                    new QueryArgument <StringGraphType> {
                Name = "name"
            },
                    new QueryArgument <StringGraphType> {
                Name = "parentId"
            },
                    new QueryArgument <BooleanGraphType> {
                Name = "isRoot"
            }
                    ),
                resolve: context => sectionItemRepository.Get(
                    context.GetArgument <string>("id"),
                    context.GetArgument <string>("section"),
                    context.GetArgument <string>("pathUrl"),
                    context.GetArgument <string>("alias"),
                    context.GetArgument <string>("name"),
                    context.GetArgument <string>("parentId"),
                    context.GetArgument <bool>("isRoot")
                    )
                );

            Field <ListGraphType <ContentItemType> >(
                "contentItems",
                arguments: new QueryArguments(
                    new QueryArgument <StringGraphType> {
                Name = "id"
            },
                    new QueryArgument <StringGraphType> {
                Name = "name"
            },
                    new QueryArgument <StringGraphType> {
                Name = "alias"
            },
                    new QueryArgument <StringGraphType> {
                Name = "module"
            },
                    new QueryArgument <StringGraphType> {
                Name = "parentId"
            },
                    new QueryArgument <StringGraphType> {
                Name = "createdBy"
            },
                    new QueryArgument <StringGraphType> {
                Name = "sectionItems"
            },
                    new QueryArgument <StringGraphType> {
                Name = "content"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute01"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute02"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute03"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute04"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute05"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute06"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute07"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute08"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute09"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute10"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute11"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute12"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute13"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute14"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute15"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute16"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute17"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute18"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute19"
            },
                    new QueryArgument <StringGraphType> {
                Name = "attribute20"
            }
                    ),
                resolve: context => contentItemRepository.Get(
                    context.GetArgument <string>("id"),
                    context.GetArgument <string>("name"),
                    context.GetArgument <string>("alias"),
                    context.GetArgument <string>("module"),
                    context.GetArgument <string>("parentId"),
                    context.GetArgument <string>("createdBy"),
                    context.GetArgument <string>("sectionItems"),
                    context.GetArgument <string>("content"),
                    context.GetArgument <string>("attribute01"),
                    context.GetArgument <string>("attribute02"),
                    context.GetArgument <string>("attribute03"),
                    context.GetArgument <string>("attribute04"),
                    context.GetArgument <string>("attribute05"),
                    context.GetArgument <string>("attribute06"),
                    context.GetArgument <string>("attribute07"),
                    context.GetArgument <string>("attribute08"),
                    context.GetArgument <string>("attribute09"),
                    context.GetArgument <string>("attribute10"),
                    context.GetArgument <string>("attribute11"),
                    context.GetArgument <string>("attribute12"),
                    context.GetArgument <string>("attribute13"),
                    context.GetArgument <string>("attribute14"),
                    context.GetArgument <string>("attribute15"),
                    context.GetArgument <string>("attribute16"),
                    context.GetArgument <string>("attribute17"),
                    context.GetArgument <string>("attribute18"),
                    context.GetArgument <string>("attribute19"),
                    context.GetArgument <string>("attribute20")
                    )
                );
        }
Example #24
0
 public AdminController(/*IAdministrationService administrationService,*/ IContentItemRepository contentItemRepository)
 {
     //_administrationService = administrationService;
     _contentItemRepository = contentItemRepository;
 }
Example #25
0
 public UpgradeVersionWorker(ContentVersionRepository versionRepository, IContentItemRepository itemRepository)
 {
     this.versionRepository = versionRepository;
     this.itemRepository    = itemRepository;
 }
Example #26
0
 public UpdateChildStateMigration(IContentItemRepository repository)
 {
     this.repository = repository;
     Title           = "Upgrades child state flag to v2.3 model";
     Description     = "Child state is used to avoid querying for the presence of children";
 }
Example #27
0
 public static ContentSource SetupContentSource(IContentItemRepository itemRepository)
 {
     return(new ContentSource(MockRepository.GenerateStub <ISecurityManager>(), new SourceBase[] { new ActiveContentSource(), new DatabaseSource(MockRepository.GenerateStub <IHost>(), itemRepository) }));
 }
		/// <summary>Creates a new instance of the <see cref="IntegrityManager"/>.</summary>
		/// <param name="definitions">The definition manager.</param>
		/// <param name="finder"></param>
		/// <param name="urlParser"></param>
		public IntegrityManager(Definitions.IDefinitionManager definitions, IContentItemRepository repository, Web.IUrlParser urlParser)
		{
			this.definitions = definitions;
			this.repository = repository;
			this.urlParser = urlParser;
		}
Example #29
0
        public BanicoMutation(
            ISectionRepository sectionRepository,
            ISectionItemRepository sectionItemRepository,
            IContentItemRepository contentItemRepository
            )
        {
            Name = "BanicoMutation";

            Field <SectionType>(
                "addSection",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionInputType> > {
                Name = "section"
            }
                    ),
                resolve: context =>
            {
                var section = context.GetArgument <Section>("section");
                return(sectionRepository.Add(section));
            });

            Field <SectionItemType>(
                "addSectionItem",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionItemInputType> > {
                Name = "sectionItem"
            }
                    ),
                resolve: context =>
            {
                var sectionItem = context.GetArgument <SectionItem>("sectionItem");
                return(sectionItemRepository.Add(sectionItem));
            });

            Field <ContentItemType>(
                "addContentItem",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ContentItemInputType> > {
                Name = "contentItem"
            }
                    ),
                resolve: context =>
            {
                var contentItem = context.GetArgument <ContentItem>("contentItem");
                return(contentItemRepository.Add(contentItem));
            });

            Field <ContentItemType>(
                "updateContentItem",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ContentItemInputType> > {
                Name = "contentItem"
            }
                    ),
                resolve: context =>
            {
                var contentItem = context.GetArgument <ContentItem>("contentItem");
                return(contentItemRepository.Update(contentItem));
            });
        }
 public MyAdminController(ICacheService cacheService, IAdministrationService administrationService, IContentItemRepository contentItemRepository)
     : base(cacheService, administrationService, contentItemRepository)
 {
 }
		public UpdateChildStateMigration(IContentItemRepository repository)
		{
			this.repository = repository;
			Title = "Upgrades child state flag to v2.3 model";
			Description = "Child state is used to avoid querying for the presence of children";
		}
Example #32
0
 public DatabaseSource(IHost host, IContentItemRepository repository)
 {
     this.host       = host;
     this.repository = repository;
 }
Example #33
0
 /// <summary>Creates a new instance of the <see cref="IntegrityManager"/>.</summary>
 /// <param name="definitions">The definition manager.</param>
 /// <param name="finder"></param>
 /// <param name="urlParser"></param>
 public IntegrityManager(Definitions.IDefinitionManager definitions, IContentItemRepository repository, Web.IUrlParser urlParser)
 {
     this.definitions = definitions;
     this.repository  = repository;
     this.urlParser   = urlParser;
 }
Example #34
0
 public Importer(IPersister persister, IItemXmlReader reader, IFileSystem fs, ContentSource source, IContentItemRepository repository)
 {
     this.persister = new ContentPersisterImport(source, repository);
     this.reader    = reader;
     this.fs        = fs;
     //TODO: Initialize 'logger' ---> this.logger =;
 }
 public HomeController(IContentItemRepository contentItemRepository, IContentModelsService contentModelsService)
     : base()
 {
     this.contentItemRepository = contentItemRepository;
     this.contentModelsService = contentModelsService;
 }
        public override void SetUp()
        {
            base.SetUp();
            
            // create a filesystem for replication and use it as storage
            fsf = CreateFileSystemFactory();
            Storage = new ReplicationStorageFileSystemN2(activator, fsf, definitions, persister);

            // create a master replicator
            MasterFlushable = new FakeFlushable();
            Master = new ReplicationManager(persister, new XmlFinder(repository), Storage, fsf, 
                new DatabaseSection(), 
                new FakeSecurityManager(), 
                null,
                MasterFlushable);
            Master.SetUnitTestMode(true);

            // create a separate slave repository
            SlaveRepo = new XmlContentItemRepository(activator, fs, definitions, null, null);
            var slavesource = TestSupport.SetupContentSource(SlaveRepo);
            SlavePersister = new ContentPersister(slavesource, SlaveRepo);
            new BehaviorInvoker(SlavePersister, new DefinitionMap()).Start();

            // create a slave replicator
            SlaveFlushable = new FakeFlushable();
            Slave = new ReplicationManager(SlavePersister, new XmlFinder(SlaveRepo), Storage, fsf,
                new DatabaseSection(),
                new FakeSecurityManager(),
                null,
                SlaveFlushable);
            Slave.SetUnitTestMode(false);
        }
 public SearchController(IContentItemRepository contentItemRepository)
     : base()
 {
     this.contentItemRepository = contentItemRepository;
 }
        public override void SetUp()
        {
            base.SetUp();

            repository = new XmlContentItemRepository(activator, fs, definitions, null, null);
        }
Example #39
0
        public BanicoMutation(
            IConfiguration configuration,
            ISectionRepository sectionRepository,
            ISectionItemRepository sectionItemRepository,
            IContentItemRepository contentItemRepository,
            IConfigRepository configRepository,
            IAccessService accessService
            )
        {
            _configuration         = configuration;
            _contentItemRepository = contentItemRepository;
            _configRepository      = configRepository;
            _accessService         = accessService;

            Name = "Mutation";

            Field <SectionType>(
                "addOrUpdateSection",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionInputType> > {
                Name = "section"
            }
                    ),
                resolve: context =>
            {
                var section = context.GetArgument <Section>("section");
                this.StampItem(section).Wait();
                var isSectionAdmin = _accessService.Allowed("admin/sections", "", false).Result;
                this.WriteDebugMessage("BanicoMutation: isSectionAdmin " + isSectionAdmin.ToString());
                return(sectionRepository.AddOrUpdate(section, isSectionAdmin));
            });

            Field <SectionItemType>(
                "addOrUpdateSectionItem",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionItemInputType> > {
                Name = "sectionItem"
            }
                    ),
                resolve: context =>
            {
                var sectionItem = context.GetArgument <SectionItem>("sectionItem");
                this.StampItem(sectionItem).Wait();
                var isSectionItemAdmin = _accessService.Allowed("admin/sectionItems", "", false).Result;
                return(sectionItemRepository.AddOrUpdate(sectionItem, isSectionItemAdmin));
            });

            Field <ContentItemType>(
                "addOrUpdateContentItem",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ContentItemInputType> > {
                Name = "contentItem"
            }
                    ),
                resolve: context =>
            {
                var contentItem = context.GetArgument <ContentItem>("contentItem");
                if (_accessService.IsEnabled(contentItem.Module).Result)
                {
                    if (_accessService.Allowed(contentItem).Result)
                    {
                        if (!this.checkTenant(contentItem))
                        {
                            throw new UnauthorizedAccessException("Update of content item is not allowed.");
                        }

                        this.StampItem(contentItem).Wait();
                        var userId  = _accessService.GetUserId();
                        var isAdmin = _accessService.IsAdminOrSuperAdmin();
                        return(contentItemRepository.AddOrUpdate(contentItem, userId, isAdmin));
                    }
                    else
                    {
                        var userId = _accessService.GetUserId();
                        throw new UnauthorizedAccessException("Add or update of content module / type " + contentItem.Module + " / " +
                                                              contentItem.Type + " is not allowed for user " + userId + ".");
                    }
                }
                else
                {
                    throw new UnauthorizedAccessException("Content module " + contentItem.Module + " is not enabled.");
                }
            });

            Field <ContentItemType>(
                "deleteContentItem",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <StringGraphType> > {
                Name = "id"
            }
                    ),
                resolve: context =>
            {
                var id = context.GetArgument <String>("id");
                if (!this.checkTenant(id))
                {
                    throw new UnauthorizedAccessException("Deletion of content item is not allowed.");
                }
                var userId  = _accessService.GetUserId();
                var isAdmin = _accessService.IsAdminOrSuperAdmin();
                return(contentItemRepository.Delete(id, userId, isAdmin));
            });

            Field <ConfigType>(
                "addOrUpdateConfig",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ConfigInputType> > {
                Name = "config"
            }
                    ),
                resolve: context =>
            {
                var config = context.GetArgument <Config>("config");
                this.StampItem(config).Wait();
                var isSuperAdmin = _accessService.IsSuperAdmin();
                return(configRepository.AddOrUpdate(config, isSuperAdmin));
            });
        }
Example #40
0
 public static ContentSource SetupContentSource(IWebContext webContext, IHost host, IContentItemRepository repository)
 {
     return(new ContentSource(new SecurityManager(webContext, new N2.Configuration.EditSection()), new[] { new DatabaseSource(host, repository) }));
 }
Example #41
0
 public GZipImporter(IPersister persister, ItemXmlReader reader, IFileSystem fs, ContentSource source, IContentItemRepository repository)
     : base(persister, reader, fs, source, repository)
 {
 }
Example #42
0
		public DatabaseSource(IHost host, IContentItemRepository repository)
		{
			this.host = host;
			this.repository = repository;
		}
Example #43
0
        public static void Setup(out ContentPersister persister, ISessionProvider sessionProvider, IContentItemRepository itemRepository, IRepository <ContentDetail> linkRepository, SchemaExport schemaCreator)
        {
            var source = SetupContentSource(itemRepository);

            persister = new ContentPersister(source, itemRepository);
            new BehaviorInvoker(persister, new N2.Definitions.Static.DefinitionMap()).Start();

            schemaCreator.Execute(false, true, false, sessionProvider.OpenSession.Session.Connection, null);
        }
 public NumberOfItemsScheduledAction(IHost host, IDefinitionManager definitions, IContentItemRepository repository)
 {
     this.host = host;
     this.definitions = definitions;
     this.repository = repository;
 }
Example #45
0
 public NumberOfItemsScheduledAction(IHost host, IDefinitionManager definitions, IContentItemRepository repository)
 {
     this.host        = host;
     this.definitions = definitions;
     this.repository  = repository;
 }
Example #46
0
        public GraphQLIssueMutation(
            ISectionRepository sectionRepository,
            ISectionItemRepository sectionItemRepository,
            IContentItemRepository contentItemRepository,
            IConfigRepository configRepository,
            IAccessService accessService
            )
        {
            _configRepository = configRepository;
            _accessService    = accessService;

            Field <SectionType>(
                "addOrUpdateSection",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionInputType> > {
                Name = "section"
            }
                    ),
                resolve: context =>
            {
                var section = context.GetArgument <Section>("section");
                this.StampItem(section);
                return(sectionRepository.AddOrUpdate(section));
            });

            Field <SectionItemType>(
                "addOrUpdateSectionItem",
                arguments: new QueryArguments(
                    // <SectionInputType>
                    new QueryArgument <NonNullGraphType <SectionItemInputType> > {
                Name = "sectionItem"
            }
                    ),
                resolve: context =>
            {
                var sectionItem = context.GetArgument <SectionItem>("sectionItem");
                this.StampItem(sectionItem);
                return(sectionItemRepository.AddOrUpdate(sectionItem));
            });

            Field <ContentItemType>(
                "addOrUpdateContentItem",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ContentItemInputType> > {
                Name = "contentItem"
            },
                    new QueryArgument <StringGraphType> {
                Name = "sectionItems"
            }
                    ),
                resolve: context =>
            {
                var contentItem  = context.GetArgument <ContentItem>("contentItem");
                var sectionItems = context.GetArgument <String>("sectionItems");
                if (_accessService.Allowed(contentItem).Result)
                {
                    this.StampItem(contentItem);
                    var userId  = _accessService.GetCurrentUserId();
                    var isAdmin = _accessService.IsAdmin();
                    return(contentItemRepository.AddOrUpdate(contentItem, sectionItems, userId, isAdmin));
                }
                else
                {
                    return(new ContentItem());
                }
            });

            Field <ConfigType>(
                "addOrUpdateConfig",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ConfigInputType> > {
                Name = "config"
            }
                    ),
                resolve: context =>
            {
                var config = context.GetArgument <Config>("config");
                this.StampItem(config);
                return(configRepository.AddOrUpdate(config));
            });
        }
 public CalendarTeaserController(IContentItemRepository repository)
 {
     this.repository = repository;
 }
Example #48
0
		public RavenSource(IContentItemRepository repository)
		{
			this.repository = repository;
		}
Example #49
0
 public UpgradeVersionWorker(ContentVersionRepository versionRepository, IContentItemRepository itemRepository)
 {
     this.versionRepository = versionRepository;
     this.itemRepository = itemRepository;
 }
Example #50
0
 public NewsContainerController(IContentItemRepository finder)
 {
     this.finder = finder;
 }
Example #51
0
 /// <summary>Creates a new instance of the DefaultPersistenceManager.</summary>
 public ContentPersister(ContentSource source, IContentItemRepository itemRepository)
 {
     this.source     = source;
     this.repository = itemRepository;
 }
 public ContentModelsService(IContentItemRepository contentItemRepository)
 {
     this.contentItemRepository = contentItemRepository;
 }