Exemplo n.º 1
0
 public StoreController(IPageDataContextRetriever dataRetriever,
                        ICalculationService calculationService,
                        ProductRepository productRepository,
                        PublicStatusRepository publicStatusRepository,
                        ManufacturerRepository manufacturerRepository,
                        HotTipsRepository hotTipsRepository,
                        IPageUrlRetriever pageUrlRetriever)
 {
     this.dataRetriever          = dataRetriever;
     this.pageUrlRetriever       = pageUrlRetriever;
     this.calculationService     = calculationService;
     this.productRepository      = productRepository;
     this.publicStatusRepository = publicStatusRepository;
     this.manufacturerRepository = manufacturerRepository;
     this.hotTipsRepository      = hotTipsRepository;
 }
 public ContactCtbController(
     ILogger <ContactCtbController> logger,
     IOptionsMonitor <XperienceOptions> optionsMonitor,
     IPageDataContextRetriever pageDataContextRetriever,
     IPageRepository <MapLocation, CMS.DocumentEngine.Types.MedioClinic.MapLocation> mapLocationRepository,
     IPageRepository <NamePerexText, CMS.DocumentEngine.Types.MedioClinic.NamePerexText> namePerexTextRepository,
     IPageRepository <Company, CMS.DocumentEngine.Types.MedioClinic.Company> companyRepository,
     IMediaFileRepository mediaFileRepository)
     : base(logger, optionsMonitor)
 {
     _pageDataContextRetriever = pageDataContextRetriever ?? throw new ArgumentNullException(nameof(pageDataContextRetriever));
     _mapLocationRepository    = mapLocationRepository ?? throw new ArgumentNullException(nameof(mapLocationRepository));
     _namePerexTextRepository  = namePerexTextRepository ?? throw new ArgumentNullException(nameof(namePerexTextRepository));
     _companyRepository        = companyRepository ?? throw new ArgumentNullException(nameof(companyRepository));
     _mediaFileRepository      = mediaFileRepository ?? throw new ArgumentNullException(nameof(mediaFileRepository));
 }
            public void SetUp()
            {
                Fake <SKUInfo, SKUInfoProvider>().WithData(sku = new SKUInfo
                {
                    SKUID = SKU_ID
                }, variant = new SKUInfo
                {
                    SKUID = VARIANT_ID
                });
                Fake <VariantOptionInfo, VariantOptionInfoProvider>().WithData();

                page = Substitute.For <SKUTreeNode>();

                retiever          = Substitute.For <IPageDataContextRetriever>();
                variantRepository = Substitute.For <IVariantRepository>();
                controller        = new ProductController(retiever, null, variantRepository, null, null, SKUInfo.Provider);
            }
Exemplo n.º 4
0
 public AuthorizationContext(IProgressiveCache progressiveCache,
                             IHttpContextAccessor httpContextAccessor,
                             IUserInfoProvider userInfoProvider,
                             IUserRoleInfoProvider userRoleInfoProvider,
                             IUserSiteInfoProvider userSiteInfoProvider,
                             IEventLogService eventLogService,
                             IPageRetriever pageRetriever,
                             IPageDataContextRetriever pageDataContextRetriever,
                             IAuthorizationContextCustomizer authorizationContextCustomizer,
                             ISiteService siteService)
 {
     _progressiveCache               = progressiveCache;
     _httpContextAccessor            = httpContextAccessor;
     _userInfoProvider               = userInfoProvider;
     _userRoleInfoProvider           = userRoleInfoProvider;
     _userSiteInfoProvider           = userSiteInfoProvider;
     _eventLogService                = eventLogService;
     _pageRetriever                  = pageRetriever;
     _pageDataContextRetriever       = pageDataContextRetriever;
     _authorizationContextCustomizer = authorizationContextCustomizer;
     _siteService = siteService;
     _httpContext = _httpContextAccessor.HttpContext;
 }
Exemplo n.º 5
0
 public TabViewComponent(IPageDataContextRetriever DataRetriever)
 {
     this.DataRetriever = DataRetriever;
 }
 public SecondaryNavigationViewComponent(INavigationRepository navigationRepository, IPageDataContextRetriever pageDataContextRetriever, IUrlResolver urlResolver, ICacheDependenciesStore cacheDependenciesStore, ICacheDependenciesScope cacheDependenciesScope)
 {
     NavigationRepository     = navigationRepository;
     PageDataContextRetriever = pageDataContextRetriever;
     UrlResolver            = urlResolver;
     CacheDependenciesStore = cacheDependenciesStore;
     CacheDependenciesScope = cacheDependenciesScope;
 }
 public TabController(IPageDataContextRetriever pageDataContextRetriever,
                      IPageRetriever pageRetriever)
 {
     PageDataContextRetriever = pageDataContextRetriever;
     PageRetriever            = pageRetriever;
 }
Exemplo n.º 8
0
 public GoodbyeController(IPageDataContextRetriever dataRetriever)
 {
     // Initializes an instance of a service that provides data context of pages matching the requested URL
     this.dataRetriever = dataRetriever;
 }
 public KenticoAuthorizeFilter(Claim claim, IProgressiveCache progressiveCache, IPageDataContextRetriever pageDataContextRetriever)
 {
     Claim = claim;
     this.progressiveCache         = progressiveCache;
     this.pageDataContextRetriever = pageDataContextRetriever;
 }
        /// <summary>
        /// Can override this if you need to implement custom logic, such as a custom route.  httpContext.Request.RequestContext.RouteData.Values is often used to grab route data.
        /// </summary>
        /// <param name="httpContext">The HttpContext of the request</param>
        /// <returns>The Tree Node for this request, null acceptable.</returns>
        private TreeNode GetTreeNode(HttpContextBase httpContext)
        {
            TreeNode FoundNode      = null;
            string   SiteName       = SiteContextSafe().SiteName;
            string   DefaultCulture = SiteContextSafe().DefaultVisitorCulture;
            // Create GetPage Event Arguments
            GetPageEventArgs PageArgs = new GetPageEventArgs()
            {
                RelativeUrl    = GetUrl(httpContext.Request.Url.AbsolutePath, httpContext.Request.ApplicationPath, SiteName),
                HttpContext    = httpContext,
                SiteName       = SiteName,
                Culture        = GetCulture(),
                DefaultCulture = DefaultCulture
            };

            // Start event, allow user to overwrite FoundPage
            using (var KenticoAuthorizeGetPageTaskHandler = AuthorizeEvents.GetPage.StartEvent(PageArgs))
            {
                if (PageArgs.FoundPage == null)
                {
                    IPageDataContextRetriever PageContextRetriever = DependencyResolver.Current.GetService <IPageDataContextRetriever>();
                    var PageContext = PageContextRetriever.Retrieve <TreeNode>();

                    // Try using Kentico's Page Builder Data Context
                    if (PageContext != null && PageContext.Page != null)
                    {
                        PageArgs.FoundPage = PageContext.Page;
                    }
                    else
                    {
                        try
                        {
                            // Try to find the page from node alias path, default lookup type
                            PageArgs.FoundPage = CacheHelper.Cache(cs =>
                            {
                                TreeNode Page = DocumentHelper.GetDocuments()
                                                .Path(PageArgs.RelativeUrl, PathTypeEnum.Single)
                                                .Culture(!string.IsNullOrWhiteSpace(PageArgs.Culture) ? PageArgs.Culture : PageArgs.DefaultCulture)
                                                .CombineWithAnyCulture()
                                                .CombineWithDefaultCulture()
                                                .OnSite(PageArgs.SiteName)
                                                .Columns("NodeACLID", "NodeID", "DocumentID", "DocumentCulture") // The Fields required for authorization
                                                .FirstOrDefault();

                                if (cs.Cached && Page != null)
                                {
                                    cs.CacheDependency = CacheHelper.GetCacheDependency(new string[]
                                    {
                                        $"nodeid|{Page.NodeID}",
                                        $"documentid|{Page.DocumentID}"
                                    });
                                }
                                return(Page);
                            }, new CacheSettings(1440, "KenticoAuthorizeGetTreeNode", PageArgs.RelativeUrl, PageArgs.SiteName));
                        }
                        catch (Exception ex)
                        {
                            PageArgs.ExceptionOnLookup = ex;
                        }
                    }
                }
                else if (PageArgs.FoundPage.NodeACLID <= 0)
                {
                    PageArgs.ExceptionOnLookup = new NullReferenceException("The TreeNode does not contain the NodeACLID property, which is required for Permission lookup.");
                }

                // Finish the event
                KenticoAuthorizeGetPageTaskHandler.FinishEvent();

                // Pass the Found Node back from the args
                FoundNode = PageArgs.FoundPage;
            }

            return(PageArgs.FoundPage);
        }
 public HomeController(IPageDataContextRetriever pageDataContextRetriever)
 {
     PageDataContextRetriever = pageDataContextRetriever;
 }
 public PartialNavigationViewComponent(IPageDataContextRetriever pageDataContextRetriever)
 {
     PageDataContextRetriever = pageDataContextRetriever;
 }
Exemplo n.º 13
0
 public PageBuilderController(IPageDataContextRetriever pageDataContextRetriever)
 {
     this.pageDataContextRetriever = pageDataContextRetriever;
 }
Exemplo n.º 14
0
 public NavigationPageSelectorTagHelper(IPageDataContextRetriever dataRetriever, IUrlHelper urlHelper)
 {
     DataRetriever = dataRetriever;
     UrlHelper     = urlHelper;
 }
Exemplo n.º 15
0
 public MainNavigationViewComponent(INavigationRepository navigationRepository, IPageDataContextRetriever dataRetriever, IUrlHelper urlHelper)
 {
     NavigationRepository = navigationRepository;
     DataRetriever        = dataRetriever;
     UrlHelper            = urlHelper;
 }
 public PageDataContextTagHelper(IPageDataContextRetriever retriever)
 {
     this.retriever = retriever ?? throw new ArgumentNullException(nameof(retriever));
 }
Exemplo n.º 17
0
 public ArticleWithSidebarPageTemplateService(IPageDataContextRetriever pageDataContextRetriver, IPageUrlRetriever pageUrlRetriever, IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     this.pageDataContextRetriver = pageDataContextRetriver;
     this.pageUrlRetriever        = pageUrlRetriever;
     this.attachmentUrlRetriever  = attachmentUrlRetriever;
 }
 public PageBuilderController(IPageDataContextRetriever dataContextRetriever)
 {
     // Initializes an instance of the page data retrieval service (available when using content tree-based routing)
     dataRetriever = dataContextRetriever;
 }
 public ArticlePageTemplateController(IPageDataContextRetriever pageDataContextRetriver, IPageUrlRetriever pageUrlRetriever, IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     this.pageDataContextRetriver = pageDataContextRetriver;
     this.pageUrlRetriever        = pageUrlRetriever;
     this.attachmentUrlRetriever  = attachmentUrlRetriever;
 }
 public MyAdvancedController(IPageDataContextRetriever dataRetriever, IPageTemplatePropertiesRetriever pageTemplatePropertiesRetriever)
 {
     this.dataRetriever = dataRetriever;
     this.pageTemplatePropertiesRetriever = pageTemplatePropertiesRetriever;
 }
 public MainNavigationViewComponent(INavigationRepository navigationRepository, IPageDataContextRetriever dataRetriever, IUrlHelper urlHelper, ICacheDependenciesStore cacheDependenciesStore, ICacheDependenciesScope cacheDependenciesScope)
 {
     NavigationRepository   = navigationRepository;
     DataRetriever          = dataRetriever;
     UrlHelper              = urlHelper;
     CacheDependenciesStore = cacheDependenciesStore;
     CacheDependenciesScope = cacheDependenciesScope;
 }
 public SecondaryNavigationViewComponent(INavigationRepository navigationRepository, IPageDataContextRetriever pageDataContextRetriever, IUrlResolver urlResolver)
 {
     NavigationRepository     = navigationRepository;
     PageDataContextRetriever = pageDataContextRetriever;
     UrlResolver = urlResolver;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ArticleRepository"/> class.
 /// </summary>
 /// <param name="pageRetriever">The pages retriever.</param>
 public ArticleRepository(IPageRetriever pageRetriever, IPageDataContextRetriever pageDataContextRetriever)
 {
     this.pageRetriever            = pageRetriever;
     this.pageDataContextRetriever = pageDataContextRetriever;
 }
Exemplo n.º 24
0
 public MyAdvancedController(IPageDataContextRetriever dataRetriever)
 {
     this.dataRetriever = dataRetriever;
 }
 public PartialHeaderViewComponent(IPageDataContextRetriever pageDataContextRetriever)
 {
     PageDataContextRetriever = pageDataContextRetriever;
 }
Exemplo n.º 26
0
 public EventRegistrationFormWidgetController(IPageDataContextRetriever pageDataContext, IContactProvider contactProvider)
 {
     this.pageDataContext = pageDataContext;
     this.contactProvider = contactProvider;
 }
Exemplo n.º 27
0
 public ImageUploaderViewComponent(IPageDataContextRetriever pageDataContextRetriever)
 {
     this.pageDataContextRetriever = pageDataContextRetriever;
 }
 public BreadcrumbsJsonViewComponent(IPageDataContextRetriever pageDataContextRetriever,
                                     IBreadcrumbRepository breadcrumbRepository)
 {
     PageDataContextRetriever = pageDataContextRetriever;
     BreadcrumbRepository     = breadcrumbRepository;
 }