public GetRightsListCommand(
     IRightLocalizationRepository repository,
     IRightInfoMapper mapper,
     IAccessValidator accessValidator,
     IResponseCreator responseCreator)
 {
     _repository      = repository;
     _mapper          = mapper;
     _accessValidator = accessValidator;
     _responseCreator = responseCreator;
 }
示例#2
0
        public RightsIdsValidator(
            IRightLocalizationRepository repository,
            IMemoryCache cache,
            IRoleRepository roleRepository)
        {
            _repository     = repository;
            _cache          = cache;
            _roleRepository = roleRepository;

            RuleFor(rightsIds => rightsIds)
            .NotEmpty().WithMessage("Rights list can not be empty.")
            .MustAsync(async(rightIds, _) => await CheckRightsUniquenessAsync(rightIds))
            .WithMessage("Set of rights must be unique.");

            RuleForEach(rightsIds => rightsIds)
            .MustAsync(async(id, _) => (await GetRightIdsAsync()).Contains(id))
            .WithMessage("Element: {CollectionIndex} of rights list is not correct.");
        }