public SynchronizationService(
     ILogger <SynchronizationService> logger,
     ITelemetryClient telemetryClient,
     IMediator mediator,
     IClaimsProvider claimsProvider,
     IPlantSetter plantSetter,
     ICurrentUserSetter currentUserSetter,
     IBearerTokenSetter bearerTokenSetter,
     IClaimsTransformation claimsTransformation,
     IApplicationAuthenticator authenticator,
     IPlantCache plantCache,
     IOptionsMonitor <SynchronizationOptions> options)
 {
     _logger                 = logger;
     _telemetryClient        = telemetryClient;
     _mediator               = mediator;
     _claimsProvider         = claimsProvider;
     _currentUserSetter      = currentUserSetter;
     _claimsTransformation   = claimsTransformation;
     _plantSetter            = plantSetter;
     _authenticator          = authenticator;
     _bearerTokenSetter      = bearerTokenSetter;
     _plantCache             = plantCache;
     _options                = options;
     _synchronizationUserOid = options.CurrentValue.UserOid;
 }
 public CacheController(IPlantCache plantCache, IPermissionCache permissionCache, ICurrentUserProvider currentUserProvider, IPermissionApiService permissionApiService)
 {
     _plantCache           = plantCache;
     _permissionCache      = permissionCache;
     _currentUserProvider  = currentUserProvider;
     _permissionApiService = permissionApiService;
 }
Ejemplo n.º 3
0
 public GetActionsCrossPlantQueryHandler(
     IReadOnlyContext context,
     IPlantCache plantCache,
     IPlantSetter plantSetter)
 {
     _context     = context;
     _plantCache  = plantCache;
     _plantSetter = plantSetter;
 }
Ejemplo n.º 4
0
 public MainApiResponsibleService(IBearerTokenApiClient mainApiClient,
                                  IPlantCache plantCache,
                                  IOptionsMonitor <MainApiOptions> options)
 {
     _mainApiClient = mainApiClient;
     _plantCache    = plantCache;
     _apiVersion    = options.CurrentValue.ApiVersion;
     _baseAddress   = new Uri(options.CurrentValue.BaseAddress);
 }
Ejemplo n.º 5
0
 public GetTagsCrossPlantQueryHandler(
     IReadOnlyContext context,
     IPlantCache plantCache,
     IPlantSetter plantSetter)
 {
     _context     = context;
     _plantCache  = plantCache;
     _plantSetter = plantSetter;
     _utcNow      = TimeService.UtcNow;
 }
 public ClaimsTransformation(
     IPlantProvider plantProvider,
     IPlantCache plantCache,
     IPermissionCache permissionCache,
     ILogger <ClaimsTransformation> logger)
 {
     _plantProvider   = plantProvider;
     _plantCache      = plantCache;
     _permissionCache = permissionCache;
     _logger          = logger;
 }
        public CloneCommandValidator(IPlantCache plantCache)
        {
            CascadeMode = CascadeMode.Stop;

            RuleFor(command => command.SourcePlant)
            .MustAsync((_, sourcePlant, token) => UserHaveAccessToPlantAsync(sourcePlant.ToUpperInvariant()))
            .WithMessage(command => $"Source plant is not valid or access missing! Plant={command.SourcePlant}");

            RuleFor(command => command.TargetPlant)
            .MustAsync((_, targetPlant, token) => UserHaveAccessToPlantAsync(targetPlant.ToUpperInvariant()))
            .WithMessage(command => $"Target plant is not valid or access missing! Plant={command.TargetPlant}")
            .Must((_, targetPlant, token) => NotBeABasisPlant(targetPlant.ToUpperInvariant()))
            .WithMessage(command => $"Target plant can not be a basis plant! Plant={command.TargetPlant}");

            async Task <bool> UserHaveAccessToPlantAsync(string plantId)
            => await plantCache.HasCurrentUserAccessToPlantAsync(plantId);

            bool NotBeABasisPlant(string plantId) => !BasisPlants.Contains(plantId);
        }
 public ClaimsTransformation(IPlantProvider plantProvider, IPlantCache plantCache, IPermissionCache permissionCache)
 {
     _plantProvider   = plantProvider;
     _plantCache      = plantCache;
     _permissionCache = permissionCache;
 }