Esempio n. 1
0
        /// <summary>
        /// Creates a partial service context with only some services (for tests).
        /// </summary>
        /// <remarks>
        /// <para>Using a true constructor for this confuses DI containers.</para>
        /// </remarks>
        public static ServiceContext CreatePartial(
            IContentService contentService         = null,
            IMediaService mediaService             = null,
            IContentTypeService contentTypeService = null,
            IMediaTypeService mediaTypeService     = null,
            IDataTypeService dataTypeService       = null,
            IFileService fileService = null,
            ILocalizationService localizationService = null,
            IPackagingService packagingService       = null,
            IEntityService entityService             = null,
            IRelationService relationService         = null,
            IMemberGroupService memberGroupService   = null,
            IMemberTypeService memberTypeService     = null,
            IMemberService memberService             = null,
            IUserService userService            = null,
            ISectionService sectionService      = null,
            IApplicationTreeService treeService = null,
            ITagService tagService = null,
            INotificationService notificationService   = null,
            ILocalizedTextService localizedTextService = null,
            IAuditService auditService                           = null,
            IDomainService domainService                         = null,
            IMacroService macroService                           = null,
            IPublicAccessService publicAccessService             = null,
            IExternalLoginService externalLoginService           = null,
            IServerRegistrationService serverRegistrationService = null,
            IRedirectUrlService redirectUrlService               = null,
            IConsentService consentService                       = null)
        {
            Lazy <T> Lazy <T>(T service) => service == null ? null : new Lazy <T>(() => service);

            return(new ServiceContext(
                       Lazy(publicAccessService),
                       Lazy(domainService),
                       Lazy(auditService),
                       Lazy(localizedTextService),
                       Lazy(tagService),
                       Lazy(contentService),
                       Lazy(userService),
                       Lazy(memberService),
                       Lazy(mediaService),
                       Lazy(contentTypeService),
                       Lazy(mediaTypeService),
                       Lazy(dataTypeService),
                       Lazy(fileService),
                       Lazy(localizationService),
                       Lazy(packagingService),
                       Lazy(serverRegistrationService),
                       Lazy(entityService),
                       Lazy(relationService),
                       Lazy(treeService),
                       Lazy(sectionService),
                       Lazy(macroService),
                       Lazy(memberTypeService),
                       Lazy(memberGroupService),
                       Lazy(notificationService),
                       Lazy(externalLoginService),
                       Lazy(redirectUrlService),
                       Lazy(consentService)));
        }
Esempio n. 2
0
        protected virtual bool HandleUmbracoRedirect(SpaApiRequest request, out HttpResponseMessage response)
        {
            response = null;

            // Get a reference to Umbraco's redirect URL service
            IRedirectUrlService service = UmbracoContext.Application.Services.RedirectUrlService;

            // Look for a matching redirect
            IRedirectUrl umbRedirect = service.GetMostRecentRedirectUrl(request.SiteId + request.Url.TrimEnd('/'));

            if (umbRedirect == null)
            {
                return(false);
            }

            // Get the destination page from the content cache
            IPublishedContent newContent = UmbracoContext.ContentCache.GetById(umbRedirect.ContentId);

            if (newContent == null)
            {
                return(false);
            }

            // Send a redirect response if a page was found
            response = ReturnRedirect(request, newContent.Url, true);
            return(true);
        }
Esempio n. 3
0
 public ResultsController(
     ISearchAndCompareApi api,
     IFeatureFlags featureFlags,
     IRedirectUrlService redirectUrlService)
 {
     _api                = api;
     _featureFlags       = featureFlags;
     _redirectUrlService = redirectUrlService;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedirectsApiController"/> class.
 /// </summary>
 public RedirectsApiController()
 {
     this.redirectUrlService   = this.Services.RedirectUrlService;
     this.mapper               = Mapper.Engine;
     this.logger               = this.Logger;
     this.localizedTextService = this.Services.TextService;
     this.contentService       = this.Services.ContentService;
     this.domainService        = this.Services.DomainService;
 }
 public FilterController(ISearchAndCompareApi api, IGeocoder geocoder, TelemetryClient telemetryClient,
                         GoogleAnalyticsClient gaClient, IRedirectUrlService redirectUrlService, IFeatureFlags featureFlags)
 {
     _api                = api;
     _geocoder           = geocoder;
     _telemetryClient    = telemetryClient;
     _gaClient           = gaClient;
     _redirectUrlService = redirectUrlService;
     _featureFlags       = featureFlags;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContentFinderByRedirectUrl"/> class.
 /// </summary>
 public ContentFinderByRedirectUrl(
     IRedirectUrlService redirectUrlService,
     ILogger <ContentFinderByRedirectUrl> logger,
     IPublishedUrlProvider publishedUrlProvider,
     IUmbracoContextAccessor umbracoContextAccessor)
 {
     _redirectUrlService     = redirectUrlService;
     _logger                 = logger;
     _publishedUrlProvider   = publishedUrlProvider;
     _umbracoContextAccessor = umbracoContextAccessor;
 }
Esempio n. 7
0
 public RedirectTrackingHandler(
     ILogger <RedirectTrackingHandler> logger,
     IOptionsMonitor <WebRoutingSettings> webRoutingSettings,
     IPublishedSnapshotAccessor publishedSnapshotAccessor,
     IRedirectUrlService redirectUrlService,
     IVariationContextAccessor variationContextAccessor)
 {
     _logger                    = logger;
     _webRoutingSettings        = webRoutingSettings;
     _publishedSnapshotAccessor = publishedSnapshotAccessor;
     _redirectUrlService        = redirectUrlService;
     _variationContextAccessor  = variationContextAccessor;
 }
Esempio n. 8
0
 public RedirectUrlManagementController(
     ILogger <RedirectUrlManagementController> logger,
     IOptionsMonitor <WebRoutingSettings> webRoutingSettings,
     IBackOfficeSecurityAccessor backofficeSecurityAccessor,
     IRedirectUrlService redirectUrlService,
     IUmbracoMapper umbracoMapper,
     IConfigManipulator configManipulator)
 {
     _logger                     = logger ?? throw new ArgumentNullException(nameof(logger));
     _webRoutingSettings         = webRoutingSettings ?? throw new ArgumentNullException(nameof(webRoutingSettings));
     _backofficeSecurityAccessor = backofficeSecurityAccessor ?? throw new ArgumentNullException(nameof(backofficeSecurityAccessor));
     _redirectUrlService         = redirectUrlService ?? throw new ArgumentNullException(nameof(redirectUrlService));
     _umbracoMapper              = umbracoMapper ?? throw new ArgumentNullException(nameof(umbracoMapper));
     _configManipulator          = configManipulator ?? throw new ArgumentNullException(nameof(configManipulator));
 }
Esempio n. 9
0
 public RedirectTrackingHandler(
     ILogger <RedirectTrackingHandler> logger,
     IOptionsMonitor <WebRoutingSettings> webRoutingSettings,
     IPublishedSnapshotAccessor publishedSnapshotAccessor,
     IRedirectUrlService redirectUrlService,
     IVariationContextAccessor variationContextAccessor)
     : this(
         logger,
         webRoutingSettings,
         publishedSnapshotAccessor,
         redirectUrlService,
         variationContextAccessor,
         StaticServiceProvider.Instance.GetRequiredService <ILocalizationService>())
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RedirectsApiController"/> class.
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 /// <param name="redirectUrlService">
 /// The redirect url service.
 /// </param>
 /// <param name="mapper">
 /// The mapper.
 /// </param>
 /// <param name="logger">
 /// The logger.
 /// </param>
 /// <param name="localizedTextService">
 /// The localized Text Service.
 /// </param>
 /// <param name="contentService">
 /// The content Service.
 /// </param>
 /// <param name="domainService">
 /// The domain Service.
 /// </param>
 public RedirectsApiController(
     UmbracoContext context,
     IRedirectUrlService redirectUrlService,
     IMappingEngine mapper,
     ILogger logger,
     ILocalizedTextService localizedTextService,
     IContentService contentService,
     IDomainService domainService) : base(context)
 {
     this.redirectUrlService   = redirectUrlService;
     this.mapper               = mapper;
     this.logger               = logger;
     this.localizedTextService = localizedTextService;
     this.contentService       = contentService;
     this.domainService        = domainService;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedirectsApiController"/> class.
        /// </summary>
        public RedirectsApiController(IUmbracoSettingsSection umbracoSettings,
                                      IGlobalSettings globalSettings,
                                      IUmbracoContextAccessor umbracoContextAccessor,
                                      ISqlContext sqlContext,
                                      ServiceContext services,
                                      AppCaches appCaches,
                                      IProfilingLogger logger,
                                      IRuntimeState runtimeState,
                                      UmbracoHelper umbracoHelper, UmbracoMapper mapper) : base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
        {
            _redirectUrlService = this.Services.RedirectUrlService;

            _umbracoSettings      = umbracoSettings;
            _mapper               = mapper;
            _logger               = logger;
            _localizedTextService = services.TextService;
            _contentService       = services.ContentService;
            _domainService        = services.DomainService;
        }
Esempio n. 12
0
 public EnterspeedJobHandler(
     IEnterspeedJobRepository enterspeedJobRepository,
     IUmbracoContextFactory umbracoContextFactory,
     IEnterspeedPropertyService enterspeedPropertyService,
     ILogger logger,
     IRedirectUrlService redirectUrlService,
     IUmbracoUrlService umbracoUrlService,
     IEnterspeedIngestService enterspeedIngestService,
     IEntityIdentityService entityIdentityService,
     IUmbracoRedirectsService redirectsService)
 {
     _enterspeedJobRepository   = enterspeedJobRepository;
     _umbracoContextFactory     = umbracoContextFactory;
     _enterspeedPropertyService = enterspeedPropertyService;
     _logger                  = logger;
     _redirectUrlService      = redirectUrlService;
     _umbracoUrlService       = umbracoUrlService;
     _enterspeedIngestService = enterspeedIngestService;
     _entityIdentityService   = entityIdentityService;
     _redirectsService        = redirectsService;
 }
 public ContentFinderByRedirectUrl(IRedirectUrlService redirectUrlService, ILogger logger)
 {
     _redirectUrlService = redirectUrlService;
     _logger             = logger;
 }
 public CourseController(ISearchAndCompareApi api, IRedirectUrlService redirectUrlService, IFeatureFlags featureFlags)
 {
     _api = api;
     this.redirectUrlService = redirectUrlService;
     this.featureFlags       = featureFlags;
 }
 public RedirectTrackingComponent(IUmbracoSettingsSection umbracoSettings, IPublishedSnapshotAccessor publishedSnapshotAccessor, IRedirectUrlService redirectUrlService)
 {
     _umbracoSettings           = umbracoSettings;
     _publishedSnapshotAccessor = publishedSnapshotAccessor;
     _redirectUrlService        = redirectUrlService;
 }
Esempio n. 16
0
 public CourseController(ISearchAndCompareApi api, IRedirectUrlService redirectUrlService)
 {
     _api = api;
     this.redirectUrlService = redirectUrlService;
 }
 public UmbracoRedirectsService(IRedirectUrlService redirectUrlService, IUmbracoUrlService umbracoUrlService)
 {
     _redirectUrlService = redirectUrlService;
     _umbracoUrlService  = umbracoUrlService;
 }
Esempio n. 18
0
 /// <summary>
 /// public ctor - will generally just be used for unit testing all items are optional and if not specified, the defaults will be used
 /// </summary>
 /// <param name="contentService"></param>
 /// <param name="mediaService"></param>
 /// <param name="contentTypeService"></param>
 /// <param name="dataTypeService"></param>
 /// <param name="fileService"></param>
 /// <param name="localizationService"></param>
 /// <param name="packagingService"></param>
 /// <param name="entityService"></param>
 /// <param name="relationService"></param>
 /// <param name="memberGroupService"></param>
 /// <param name="memberTypeService"></param>
 /// <param name="memberService"></param>
 /// <param name="userService"></param>
 /// <param name="sectionService"></param>
 /// <param name="treeService"></param>
 /// <param name="tagService"></param>
 /// <param name="notificationService"></param>
 /// <param name="localizedTextService"></param>
 /// <param name="auditService"></param>
 /// <param name="domainService"></param>
 /// <param name="taskService"></param>
 /// <param name="macroService"></param>
 /// <param name="publicAccessService"></param>
 /// <param name="externalLoginService"></param>
 /// <param name="migrationEntryService"></param>
 /// <param name="redirectUrlService"></param>
 public ServiceContext(
     IContentService contentService         = null,
     IMediaService mediaService             = null,
     IContentTypeService contentTypeService = null,
     IDataTypeService dataTypeService       = null,
     IFileService fileService = null,
     ILocalizationService localizationService = null,
     IPackagingService packagingService       = null,
     IEntityService entityService             = null,
     IRelationService relationService         = null,
     IMemberGroupService memberGroupService   = null,
     IMemberTypeService memberTypeService     = null,
     IMemberService memberService             = null,
     IUserService userService            = null,
     ISectionService sectionService      = null,
     IApplicationTreeService treeService = null,
     ITagService tagService = null,
     INotificationService notificationService   = null,
     ILocalizedTextService localizedTextService = null,
     IAuditService auditService                   = null,
     IDomainService domainService                 = null,
     ITaskService taskService                     = null,
     IMacroService macroService                   = null,
     IPublicAccessService publicAccessService     = null,
     IExternalLoginService externalLoginService   = null,
     IMigrationEntryService migrationEntryService = null,
     IRedirectUrlService redirectUrlService       = null)
 {
     if (migrationEntryService != null)
     {
         _migrationEntryService = new Lazy <IMigrationEntryService>(() => migrationEntryService);
     }
     if (externalLoginService != null)
     {
         _externalLoginService = new Lazy <IExternalLoginService>(() => externalLoginService);
     }
     if (auditService != null)
     {
         _auditService = new Lazy <IAuditService>(() => auditService);
     }
     if (localizedTextService != null)
     {
         _localizedTextService = new Lazy <ILocalizedTextService>(() => localizedTextService);
     }
     if (tagService != null)
     {
         _tagService = new Lazy <ITagService>(() => tagService);
     }
     if (contentService != null)
     {
         _contentService = new Lazy <IContentService>(() => contentService);
     }
     if (mediaService != null)
     {
         _mediaService = new Lazy <IMediaService>(() => mediaService);
     }
     if (contentTypeService != null)
     {
         _contentTypeService = new Lazy <IContentTypeService>(() => contentTypeService);
     }
     if (dataTypeService != null)
     {
         _dataTypeService = new Lazy <IDataTypeService>(() => dataTypeService);
     }
     if (fileService != null)
     {
         _fileService = new Lazy <IFileService>(() => fileService);
     }
     if (localizationService != null)
     {
         _localizationService = new Lazy <ILocalizationService>(() => localizationService);
     }
     if (packagingService != null)
     {
         _packagingService = new Lazy <IPackagingService>(() => packagingService);
     }
     if (entityService != null)
     {
         _entityService = new Lazy <IEntityService>(() => entityService);
     }
     if (relationService != null)
     {
         _relationService = new Lazy <IRelationService>(() => relationService);
     }
     if (sectionService != null)
     {
         _sectionService = new Lazy <ISectionService>(() => sectionService);
     }
     if (memberGroupService != null)
     {
         _memberGroupService = new Lazy <IMemberGroupService>(() => memberGroupService);
     }
     if (memberTypeService != null)
     {
         _memberTypeService = new Lazy <IMemberTypeService>(() => memberTypeService);
     }
     if (treeService != null)
     {
         _treeService = new Lazy <IApplicationTreeService>(() => treeService);
     }
     if (memberService != null)
     {
         _memberService = new Lazy <IMemberService>(() => memberService);
     }
     if (userService != null)
     {
         _userService = new Lazy <IUserService>(() => userService);
     }
     if (notificationService != null)
     {
         _notificationService = new Lazy <INotificationService>(() => notificationService);
     }
     if (domainService != null)
     {
         _domainService = new Lazy <IDomainService>(() => domainService);
     }
     if (taskService != null)
     {
         _taskService = new Lazy <ITaskService>(() => taskService);
     }
     if (macroService != null)
     {
         _macroService = new Lazy <IMacroService>(() => macroService);
     }
     if (publicAccessService != null)
     {
         _publicAccessService = new Lazy <IPublicAccessService>(() => publicAccessService);
     }
     if (redirectUrlService != null)
     {
         _redirectUrlService = new Lazy <IRedirectUrlService>(() => redirectUrlService);
     }
 }