Ejemplo n.º 1
0
        public ShopController(ISessionValueProviderService sessionService, IShopService shopService,
                              ISearchService searchService, IShopClientService clientService, IShopActionService shopActionService,
                              IShopCategoryService shopCategoryService, IShopManufacturerService shopManufacturerService,
                              IPrincipalResolver principalResolver, IHeartService heartService, IShopOrderService shopOrderService, IShopPickupPointService pickupPointService)
        {
            _sessionService          = sessionService;
            _shopService             = shopService;
            _searchService           = searchService;
            _clientService           = clientService;
            _shopActionService       = shopActionService;
            _shopCategoryService     = shopCategoryService;
            _shopManufacturerService = shopManufacturerService;
            _principalResolver       = principalResolver;
            _heartService            = heartService;
            _shopOrderService        = shopOrderService;
            _pickupPointService      = pickupPointService;


            var service = DependencyResolver.Current.GetService <IShopSettingsService>();

            try
            {
                var settings = service.GetShopSettings();
                _shopUrl = String.IsNullOrEmpty(settings.ShopUrl) ? "catalog" : settings.ShopUrl;
            }
            catch
            {
                _shopUrl = "catalog";
            }
        }
Ejemplo n.º 2
0
 public PersonalBlogController(INewsItemService newsItemService, IPrincipalResolver principalResolver, IBlogService blogService, INewsCategoryService newsCategoryService)
 {
     _newsItemService     = newsItemService;
     _principalResolver   = principalResolver;
     _blogService         = blogService;
     _newsCategoryService = newsCategoryService;
 }
Ejemplo n.º 3
0
        public static RepositoryContext Create(IConfiguration configuration, IPrincipalResolver principalResolver, ILoggerFactory loggerFactory)
        {
            NullGuard.NotNull(configuration, nameof(configuration))
            .NotNull(principalResolver, nameof(principalResolver))
            .NotNull(loggerFactory, nameof(loggerFactory));

            return(new RepositoryContext(configuration, principalResolver, loggerFactory));
        }
Ejemplo n.º 4
0
        public void GetCurrentPrincipal_WhenCalled_AssertHttpContextWasCalledOnHttpContextAccessor()
        {
            IPrincipalResolver sut = CreateSut();

            sut.GetCurrentPrincipal();

            _httpContextAccessorMock.Verify(m => m.HttpContext, Times.Once);
        }
Ejemplo n.º 5
0
        public void GetCurrentPrincipal_WhenCalled_ReturnsPrincipalFromHttpContext()
        {
            ClaimsPrincipal    claimsPrincipal = new ClaimsPrincipal();
            IPrincipalResolver sut             = CreateSut(claimsPrincipal);

            IPrincipal result = sut.GetCurrentPrincipal();

            Assert.That(result, Is.EqualTo(claimsPrincipal));
        }
Ejemplo n.º 6
0
        public void GetCurrentPrincipal_WhenCalledAndCurrentPrincipalIsNull_ReturnsNull()
        {
            const IPrincipal   currentPrincipal = null;
            IPrincipalResolver sut = CreateSut(currentPrincipal);

            IPrincipal result = sut.GetCurrentPrincipal();

            Assert.That(result, Is.Null);
        }
Ejemplo n.º 7
0
        public void GetCurrentPrincipal_WhenCalledAndCurrentPrincipalIsNotNull_ReturnsCurrentPrincipal()
        {
            IPrincipal         currentPrincipal = CreatePrincipalMock().Object;
            IPrincipalResolver sut = CreateSut(currentPrincipal);

            IPrincipal result = sut.GetCurrentPrincipal();

            Assert.That(result, Is.EqualTo(currentPrincipal));
        }
Ejemplo n.º 8
0
        public RepositoryContext(IConfiguration configuration, IPrincipalResolver principalResolver, ILoggerFactory loggerFactory)
        {
            NullGuard.NotNull(configuration, nameof(configuration))
            .NotNull(principalResolver, nameof(principalResolver))
            .NotNull(loggerFactory, nameof(loggerFactory));

            Configuration     = configuration;
            PrincipalResolver = principalResolver;
            LoggerFactory     = loggerFactory;
        }
Ejemplo n.º 9
0
        public void RemoveUser(string username)
        {
            var user = _userGateway.SelectByUsername(username);

            IPrincipalResolver principal = DependencyResolver.Current.GetService <IPrincipalResolver>();

            if (user.UserId == principal.GetUserId())
            {
                throw new Exception("Вы не можете удалить себя");
            }

            _userGateway.Delete(user.UserId);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Create a new publisher
        /// </summary>
        /// <remarks>The publisher is a very central class; generally there should be only one per process.
        /// More specifically, there should be a one to one relationship between publisher, packet cache, and
        /// messengers to ensure integrity of the message output.</remarks>
        internal Publisher(string sessionName, AgentConfiguration configuration, SessionSummary sessionSummary, IPrincipalResolver principalResolver, IApplicationUserProvider userProvider)
        {
            if (string.IsNullOrEmpty(sessionName))
            {
                throw new ArgumentNullException(nameof(sessionName));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (sessionSummary == null)
            {
                throw new ArgumentNullException(nameof(sessionSummary));
            }

            //store off all our input
            m_SessionName    = sessionName;
            m_SessionSummary = sessionSummary;
            m_Configuration  = configuration;

            var serverConfig = Log.Configuration.Server;

            if (serverConfig.AutoSendOnError && serverConfig.AutoSendSessions && serverConfig.Enabled)
            {
                m_AutoSendOnError = true;
            }

            //create our queue, cache, and messenger objects
            m_MessageQueue         = new Queue <PacketEnvelope>(50); //a more or less arbitrary initial queue size.
            m_MessageOverflowQueue = new Queue <PacketEnvelope>(50); //a more or less arbitrary initial queue size.
            m_CachedTypes          = new PacketDefinitionList();
            m_PacketCache          = new PacketCache();
            m_Messengers           = new List <IMessenger>();
            m_Filters = new List <ILoupeFilter>();

            m_MessageQueueMaxLength = Math.Max(configuration.Publisher.MaxQueueLength, 1); //make sure there's no way to get it below 1.

            m_PrincipalResolver       = principalResolver;
            m_ApplicationUserProvider = userProvider;

            //create the thread we use for dispatching messages
            CreateMessageDispatchThread();
        }
Ejemplo n.º 11
0
 public SupportTicketService(IMapperService mapper, IMailService mailService, IPrincipalResolver principal)
     : base(mapper)
 {
     _mailService = mailService;
     _principal   = principal;
 }
 /// <summary>
 /// Create a new principal resolver
 /// </summary>
 /// <param name="contextAccessor"></param>
 public ClaimsPrincipalResolver(IHttpContextAccessor contextAccessor)
 {
     _contextAccessor          = contextAccessor;
     _defaultPrincipalResolver = new DefaultPrincipalResolver();
 }
Ejemplo n.º 13
0
 internal void RegisterPrincipalResolver(IPrincipalResolver resolver)
 {
     m_PrincipalResolver = resolver;
 }
Ejemplo n.º 14
0
 public TicketApiController(ISupportTicketService supportTicketService, IMapperService mapper, IPrincipalResolver resolver)
 {
     _supportTicketService = supportTicketService;
     _mapper   = mapper;
     _resolver = resolver;
 }
Ejemplo n.º 15
0
 public GoodsAwaitingApiController(IShopGoodsAwaitingService shopGoodsAwaitingService, IPrincipalResolver principalResolver)
 {
     _shopGoodsAwaitingService = shopGoodsAwaitingService;
     _principalResolver        = principalResolver;
 }
Ejemplo n.º 16
0
        public ClaimResolver(IPrincipalResolver principalResolver)
        {
            NullGuard.NotNull(principalResolver, nameof(principalResolver));

            _principalResolver = principalResolver;
        }
Ejemplo n.º 17
0
 public CalendarBookActions(IPrincipalResolver principalResolver)
 {
     _principalResolver = principalResolver;
 }
Ejemplo n.º 18
0
 public ViewModelDependencies(IViewModelFactory f, IFrozenContext frozenCtx, IPrincipalResolver principalResolver, IIconConverter iconConverter, IAssetsManager assetMgr, IValidationManager validationManager, IPerfCounter perfCounter)
 {
     Factory = f;
     FrozenContext = frozenCtx;
     PrincipalResolver = principalResolver;
     IconConverter = iconConverter;
     Assets = assetMgr;
     ValidationManager = validationManager;
     PerfCounter = perfCounter;
 }