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"; } }
public PersonalBlogController(INewsItemService newsItemService, IPrincipalResolver principalResolver, IBlogService blogService, INewsCategoryService newsCategoryService) { _newsItemService = newsItemService; _principalResolver = principalResolver; _blogService = blogService; _newsCategoryService = newsCategoryService; }
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)); }
public void GetCurrentPrincipal_WhenCalled_AssertHttpContextWasCalledOnHttpContextAccessor() { IPrincipalResolver sut = CreateSut(); sut.GetCurrentPrincipal(); _httpContextAccessorMock.Verify(m => m.HttpContext, Times.Once); }
public void GetCurrentPrincipal_WhenCalled_ReturnsPrincipalFromHttpContext() { ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(); IPrincipalResolver sut = CreateSut(claimsPrincipal); IPrincipal result = sut.GetCurrentPrincipal(); Assert.That(result, Is.EqualTo(claimsPrincipal)); }
public void GetCurrentPrincipal_WhenCalledAndCurrentPrincipalIsNull_ReturnsNull() { const IPrincipal currentPrincipal = null; IPrincipalResolver sut = CreateSut(currentPrincipal); IPrincipal result = sut.GetCurrentPrincipal(); Assert.That(result, Is.Null); }
public void GetCurrentPrincipal_WhenCalledAndCurrentPrincipalIsNotNull_ReturnsCurrentPrincipal() { IPrincipal currentPrincipal = CreatePrincipalMock().Object; IPrincipalResolver sut = CreateSut(currentPrincipal); IPrincipal result = sut.GetCurrentPrincipal(); Assert.That(result, Is.EqualTo(currentPrincipal)); }
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; }
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); }
/// <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(); }
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(); }
internal void RegisterPrincipalResolver(IPrincipalResolver resolver) { m_PrincipalResolver = resolver; }
public TicketApiController(ISupportTicketService supportTicketService, IMapperService mapper, IPrincipalResolver resolver) { _supportTicketService = supportTicketService; _mapper = mapper; _resolver = resolver; }
public GoodsAwaitingApiController(IShopGoodsAwaitingService shopGoodsAwaitingService, IPrincipalResolver principalResolver) { _shopGoodsAwaitingService = shopGoodsAwaitingService; _principalResolver = principalResolver; }
public ClaimResolver(IPrincipalResolver principalResolver) { NullGuard.NotNull(principalResolver, nameof(principalResolver)); _principalResolver = principalResolver; }
public CalendarBookActions(IPrincipalResolver principalResolver) { _principalResolver = principalResolver; }
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; }