Пример #1
0
        public PackageDeleteService(
            IEntityRepository <Package> packageRepository,
            IEntityRepository <PackageRegistration> packageRegistrationRepository,
            IEntityRepository <PackageDelete> packageDeletesRepository,
            IEntitiesContext entitiesContext,
            IPackageService packageService,
            IIndexingService indexingService,
            IPackageFileService packageFileService,
            IAuditingService auditingService,
            IPackageDeleteConfiguration config,
            IStatisticsService statisticsService,
            ITelemetryService telemetryService)
        {
            _packageRepository             = packageRepository ?? throw new ArgumentNullException(nameof(packageRepository));
            _packageRegistrationRepository = packageRegistrationRepository ?? throw new ArgumentNullException(nameof(packageRegistrationRepository));
            _packageDeletesRepository      = packageDeletesRepository ?? throw new ArgumentNullException(nameof(packageDeletesRepository));
            _entitiesContext    = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _packageService     = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _indexingService    = indexingService ?? throw new ArgumentNullException(nameof(indexingService));
            _packageFileService = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _auditingService    = auditingService ?? throw new ArgumentNullException(nameof(auditingService));
            _config             = config ?? throw new ArgumentNullException(nameof(config));
            _statisticsService  = statisticsService ?? throw new ArgumentNullException(nameof(statisticsService));
            _telemetryService   = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));

            if (config.HourLimitWithMaximumDownloads.HasValue &&
                config.StatisticsUpdateFrequencyInHours.HasValue &&
                config.HourLimitWithMaximumDownloads.Value <= config.StatisticsUpdateFrequencyInHours.Value)
            {
                throw new ArgumentException($"{nameof(_config.StatisticsUpdateFrequencyInHours)} must be less than " +
                                            $"{nameof(_config.HourLimitWithMaximumDownloads)}.",
                                            nameof(config));
            }
        }
Пример #2
0
 public ApiController(
     IApiScopeEvaluator apiScopeEvaluator,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IStatisticsService statisticsService,
     IMessageService messageService,
     IAuditingService auditingService,
     IGalleryConfigurationService configurationService,
     ITelemetryService telemetryService,
     AuthenticationService authenticationService,
     ICredentialBuilder credentialBuilder,
     ISecurityPolicyService securityPolicies,
     IReservedNamespaceService reservedNamespaceService,
     IPackageUploadService packageUploadService)
     : this(apiScopeEvaluator, entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService,
            indexingService, searchService, autoCuratePackage, statusService, messageService, auditingService,
            configurationService, telemetryService, authenticationService, credentialBuilder, securityPolicies,
            reservedNamespaceService, packageUploadService)
 {
     StatisticsService = statisticsService;
 }
Пример #3
0
 public ReadMeService(
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext)
 {
     _packageFileService = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext    = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
 }
 public PackagesController(
     IPackageService packageService,
     IUploadFileService uploadFileService,
     IMessageService messageService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratedPackageCmd,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IAppConfiguration config,
     IIndexingService indexingService,
     ICacheService cacheService,
     EditPackageService editPackageService,
     IPackageDeleteService packageDeleteService,
     ISupportRequestService supportRequestService,
     AuditingService auditingService)
 {
     _packageService = packageService;
     _uploadFileService = uploadFileService;
     _messageService = messageService;
     _searchService = searchService;
     _autoCuratedPackageCmd = autoCuratedPackageCmd;
     _packageFileService = packageFileService;
     _entitiesContext = entitiesContext;
     _config = config;
     _indexingService = indexingService;
     _cacheService = cacheService;
     _editPackageService = editPackageService;
     _packageDeleteService = packageDeleteService;
     _supportRequestService = supportRequestService;
     _auditingService = auditingService;
 }
Пример #5
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository<PackageRegistration> packageRegistrationRepo,
     IEntityRepository<Package> packageRepo,
     IEntityRepository<PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc,
     IEntityRepository<PackageOwnerRequest> packageOwnerRequestRepository,
     IIndexingService indexingSvc,
     IEntityRepository<PackageAuthor> packageAuthorRepo,
     IEntityRepository<PackageFramework> packageFrameworksRepo,
     IEntityRepository<PackageDependency> packageDependenciesRepo,
     IEntityRepository<PackageFile> packageFilesRepo,
     IMessageService messageSvc)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageRegistrationRepo = packageRegistrationRepo;
     this.packageRepo = packageRepo;
     this.packageStatsRepo = packageStatsRepo;
     this.packageFileSvc = packageFileSvc;
     this.packageOwnerRequestRepository = packageOwnerRequestRepository;
     this.indexingSvc = indexingSvc;
     this.packageAuthorRepo = packageAuthorRepo;
     this.packageFrameworksRepo = packageFrameworksRepo;
     this.packageDependenciesRepo = packageDependenciesRepo;
     this.packageFilesRepo = packageFilesRepo;
     this.messageSvc = messageSvc;
 }
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IAppConfiguration config)
 {
     EntitiesContext = entitiesContext;
     PackageService = packageService;
     PackageFileService = packageFileService;
     UserService = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService = contentService;
     StatisticsService = null;
     IndexingService = indexingService;
     SearchService = searchService;
     AutoCuratePackage = autoCuratePackage;
     StatusService = statusService;
     _config = config;
 }
 public PackagesController(
     IPackageService packageService,
     IUploadFileService uploadFileService,
     IUserService userService,
     IMessageService messageService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratedPackageCmd,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IAppConfiguration config,
     IIndexingService indexingService,
     ICacheService cacheService)
 {
     _packageService = packageService;
     _uploadFileService = uploadFileService;
     _userService = userService;
     _messageService = messageService;
     _searchService = searchService;
     _autoCuratedPackageCmd = autoCuratedPackageCmd;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _packageFileService = packageFileService;
     _entitiesContext = entitiesContext;
     _config = config;
     _indexingService = indexingService;
     _cacheService = cacheService;
 }
Пример #8
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc)
 {
     this.packageSvc            = packageSvc;
     this.packageFileSvc        = packageFileSvc;
     this.userSvc               = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
 }
Пример #9
0
        public PackageUploadService(
            IPackageService packageService,
            IPackageFileService packageFileService,
            IEntitiesContext entitiesContext,
            IReservedNamespaceService reservedNamespaceService,
            IValidationService validationService,
            ICoreLicenseFileService coreLicenseFileService,
            ICoreReadmeFileService coreReadmeFileService,
            IDiagnosticsService diagnosticsService,
            IPackageVulnerabilitiesManagementService vulnerabilityService,
            IPackageMetadataValidationService metadataValidationService)
        {
            _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
            _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
            _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
            _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
            _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
            _coreLicenseFileService   = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
            _coreReadmeFileService    = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));

            if (diagnosticsService == null)
            {
                throw new ArgumentNullException(nameof(diagnosticsService));
            }
            _vulnerabilityService      = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
            _metadataValidationService = metadataValidationService ?? throw new ArgumentNullException(nameof(metadataValidationService));
        }
Пример #10
0
 public PackagesController(
     IPackageService packageService,
     IUploadFileService uploadFileService,
     IMessageService messageService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratedPackageCmd,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IAppConfiguration config,
     IIndexingService indexingService,
     ICacheService cacheService,
     EditPackageService editPackageService,
     IPackageDeleteService packageDeleteService,
     ISupportRequestService supportRequestService)
 {
     _packageService        = packageService;
     _uploadFileService     = uploadFileService;
     _messageService        = messageService;
     _searchService         = searchService;
     _autoCuratedPackageCmd = autoCuratedPackageCmd;
     _packageFileService    = packageFileService;
     _entitiesContext       = entitiesContext;
     _config                = config;
     _indexingService       = indexingService;
     _cacheService          = cacheService;
     _editPackageService    = editPackageService;
     _packageDeleteService  = packageDeleteService;
     _supportRequestService = supportRequestService;
 }
Пример #11
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService,
     ITelemetryService telemetryService,
     ICoreLicenseFileService coreLicenseFileService,
     IDiagnosticsService diagnosticsService,
     IFeatureFlagService featureFlagService,
     IPackageVulnerabilityService vulnerabilityService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService   = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
     _telemetryService       = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _coreLicenseFileService = coreLicenseFileService ?? throw new ArgumentNullException(nameof(coreLicenseFileService));
     if (diagnosticsService == null)
     {
         throw new ArgumentNullException(nameof(diagnosticsService));
     }
     _trace = diagnosticsService.GetSource(nameof(PackageUploadService));
     _featureFlagService   = featureFlagService ?? throw new ArgumentNullException(nameof(featureFlagService));
     _vulnerabilityService = vulnerabilityService ?? throw new ArgumentNullException(nameof(vulnerabilityService));
 }
Пример #12
0
 public PackagesController(
     IPackageService packageService,
     IUploadFileService uploadFileService,
     IUserService userService,
     IMessageService messageService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratedPackageCmd,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IAppConfiguration config,
     IIndexingService indexingService,
     ICacheService cacheService)
 {
     _packageService            = packageService;
     _uploadFileService         = uploadFileService;
     _userService               = userService;
     _messageService            = messageService;
     _searchService             = searchService;
     _autoCuratedPackageCmd     = autoCuratedPackageCmd;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _packageFileService        = packageFileService;
     _entitiesContext           = entitiesContext;
     _config          = config;
     _indexingService = indexingService;
     _cacheService    = cacheService;
 }
Пример #13
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository <PackageRegistration> packageRegistrationRepo,
     IEntityRepository <Package> packageRepo,
     IEntityRepository <PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc,
     IEntityRepository <PackageOwnerRequest> packageOwnerRequestRepository,
     IIndexingService indexingSvc,
     IEntityRepository <PackageAuthor> packageAuthorRepo,
     IEntityRepository <PackageFramework> packageFrameworksRepo,
     IEntityRepository <PackageDependency> packageDependenciesRepo,
     IEntityRepository <PackageFile> packageFilesRepo,
     IMessageService messageSvc)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageRegistrationRepo       = packageRegistrationRepo;
     this.packageRepo                   = packageRepo;
     this.packageStatsRepo              = packageStatsRepo;
     this.packageFileSvc                = packageFileSvc;
     this.packageOwnerRequestRepository = packageOwnerRequestRepository;
     this.indexingSvc                   = indexingSvc;
     this.packageAuthorRepo             = packageAuthorRepo;
     this.packageFrameworksRepo         = packageFrameworksRepo;
     this.packageDependenciesRepo       = packageDependenciesRepo;
     this.packageFilesRepo              = packageFilesRepo;
     this.messageSvc = messageSvc;
 }
Пример #14
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc)
 {
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileSvc;
     this.userSvc = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
 }
Пример #15
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IMessageService messageService,
     ConfigurationService configurationService)
 {
     EntitiesContext           = entitiesContext;
     PackageService            = packageService;
     PackageFileService        = packageFileService;
     UserService               = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService            = contentService;
     StatisticsService         = null;
     IndexingService           = indexingService;
     SearchService             = searchService;
     AutoCuratePackage         = autoCuratePackage;
     StatusService             = statusService;
     MessageService            = messageService;
     ConfigurationService      = configurationService;
 }
Пример #16
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc, GallerySetting settings)
 {
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileSvc;
     this.userSvc = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
     this.settings = settings;
 }
 public NuGetExeDownloaderService(
     IPackageService packageSvc,
     IPackageFileService packageFileSvc,
     IFileStorageService fileStorageSvc)
 {
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileSvc;
     this.fileStorageSvc = fileStorageSvc;
 }
Пример #18
0
 public ApiController(IPackageService packageSvc, IScanService scanSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc, IConfiguration settings)
 {
     this.packageSvc = packageSvc;
     this.scanSvc = scanSvc;
     this.packageFileSvc = packageFileSvc;
     this.userSvc = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
     this.settings = settings;
 }
 public NuGetExeDownloaderService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IFileStorageService fileStorageService)
 {
     _packageService = packageService;
     _packageFileService = packageFileService;
     _fileStorageService = fileStorageService;
 }
 public ReflowPackageService(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService)
 {
     _entitiesContext = entitiesContext;
     _packageService = packageService;
     _packageFileService = packageFileService;
 }
Пример #21
0
 public NuGetExeDownloaderService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IFileStorageService fileStorageService)
 {
     _packageService     = packageService;
     _packageFileService = packageFileService;
     _fileStorageService = fileStorageService;
 }
 public ReflowPackageService(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService)
 {
     _entitiesContext    = entitiesContext;
     _packageService     = packageService;
     _packageFileService = packageFileService;
 }
 public NuGetExeDownloaderService(
     IPackageService packageSvc,
     IPackageFileService packageFileSvc,
     IFileStorageService fileStorageSvc)
 {
     _packageSvc     = packageSvc;
     _packageFileSvc = packageFileSvc;
     _fileStorageSvc = fileStorageSvc;
 }
Пример #24
0
 public ApiController(IPackageService packageSvc, IScanService scanSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc, IConfiguration settings)
 {
     this.packageSvc            = packageSvc;
     this.scanSvc               = scanSvc;
     this.packageFileSvc        = packageFileSvc;
     this.userSvc               = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
     this.settings              = settings;
 }
Пример #25
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService)
 {
     _packageService = packageService;
     _packageFileService = packageFileService;
     _userService = userService;
     _nugetExeDownloaderService = nugetExeDownloaderService;
 }
Пример #26
0
 public ReflowPackageService(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     ITelemetryService telemetryService)
 {
     _entitiesContext    = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _packageService     = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _telemetryService   = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
 }
Пример #27
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IStatisticsService statisticsService)
     : this(packageService, packageFileService, userService, nugetExeDownloaderService, contentService)
 {
     _statisticsService = statisticsService;
 }
Пример #28
0
 public ReadMeService(
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IMarkdownService markdownService,
     ICoreReadmeFileService coreReadmeFileService)
 {
     _packageFileService    = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext       = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _markdownService       = markdownService ?? throw new ArgumentNullException(nameof(markdownService));
     _coreReadmeFileService = coreReadmeFileService ?? throw new ArgumentNullException(nameof(coreReadmeFileService));
 }
Пример #29
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     IStatisticsService statisticsService)
     : this(packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService)
 {
     _statisticsService = statisticsService;
 }
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService)
 {
     _packageService            = packageService;
     _packageFileService        = packageFileService;
     _userService               = userService;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _statisticsService         = null;
 }
Пример #31
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
 }
Пример #32
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     IStatisticsService statisticsService)
     : this(entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService)
 {
     StatisticsService = statisticsService;
 }
Пример #33
0
 public PackagesController(
     ICryptographyService cryptoSvc,
     IPackageService packageSvc,
     IPackageFileService packageFileRepo,
     IUserService userSvc,
     IMessageService messageService)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileRepo;
     this.userSvc = userSvc;
     this.messageService = messageService;
 }
Пример #34
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository<PackageRegistration> packageRegistrationRepo,
     IEntityRepository<Package> packageRepo,
     IEntityRepository<PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageRegistrationRepo = packageRegistrationRepo;
     this.packageRepo = packageRepo;
     this.packageStatsRepo = packageStatsRepo;
     this.packageFileSvc = packageFileSvc;
 }
Пример #35
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatisticsService statisticsService)
     : this(entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService, autoCuratePackage)
 {
     StatisticsService = statisticsService;
 }
Пример #36
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository <PackageRegistration> packageRegistrationRepo,
     IEntityRepository <Package> packageRepo,
     IEntityRepository <PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc,
     IEntityRepository <PackageOwnerRequest> packageOwnerRequestRepository)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageRegistrationRepo       = packageRegistrationRepo;
     this.packageRepo                   = packageRepo;
     this.packageStatsRepo              = packageStatsRepo;
     this.packageFileSvc                = packageFileSvc;
     this.packageOwnerRequestRepository = packageOwnerRequestRepository;
 }
Пример #37
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService)
 {
     _packageService            = packageService;
     _packageFileService        = packageFileService;
     _userService               = userService;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _contentService            = contentService;
     _statisticsService         = null;
     _indexingService           = indexingService;
 }
Пример #38
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService)
 {
     _packageService = packageService;
     _packageFileService = packageFileService;
     _userService = userService;
     _nugetExeDownloaderService = nugetExeDownloaderService;
     _contentService = contentService;
     _statisticsService = null;
     _indexingService = indexingService;
 }
Пример #39
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IStatisticsService statisticsService)
     : this(entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService, searchService, autoCuratePackage, statusService)
 {
     StatisticsService = statisticsService;
 }
Пример #40
0
 public PackageDeleteService(
     IEntityRepository <Package> packageRepository,
     IEntityRepository <PackageDelete> packageDeletesRepository,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IIndexingService indexingService,
     IPackageFileService packageFileService,
     IAuditingService auditingService)
 {
     _packageRepository        = packageRepository;
     _packageDeletesRepository = packageDeletesRepository;
     _entitiesContext          = entitiesContext;
     _packageService           = packageService;
     _indexingService          = indexingService;
     _packageFileService       = packageFileService;
     _auditingService          = auditingService;
 }
Пример #41
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository <PackageRegistration> packageRegistrationRepo,
     IEntityRepository <Package> packageRepo,
     IEntityRepository <PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc,
     IEntityRepository <PackageOwnerRequest> packageOwnerRequestRepository,
     IIndexingService indexingSvc)
 {
     _cryptoSvc = cryptoSvc;
     _packageRegistrationRepo       = packageRegistrationRepo;
     _packageRepo                   = packageRepo;
     _packageStatsRepo              = packageStatsRepo;
     _packageFileSvc                = packageFileSvc;
     _packageOwnerRequestRepository = packageOwnerRequestRepository;
     _indexingSvc                   = indexingSvc;
 }
 public PackageDeleteService(
     IEntityRepository<Package> packageRepository,
     IEntityRepository<PackageDelete> packageDeletesRepository,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IIndexingService indexingService,
     IPackageFileService packageFileService,
     AuditingService auditingService)
 {
     _packageRepository = packageRepository;
     _packageDeletesRepository = packageDeletesRepository;
     _entitiesContext = entitiesContext;
     _packageService = packageService;
     _indexingService = indexingService;
     _packageFileService = packageFileService;
     _auditingService = auditingService;
 }
Пример #43
0
 public PackageUploadService(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IEntitiesContext entitiesContext,
     IReservedNamespaceService reservedNamespaceService,
     IValidationService validationService,
     IAppConfiguration config,
     ITyposquattingService typosquattingService)
 {
     _packageService           = packageService ?? throw new ArgumentNullException(nameof(packageService));
     _packageFileService       = packageFileService ?? throw new ArgumentNullException(nameof(packageFileService));
     _entitiesContext          = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext));
     _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService));
     _validationService        = validationService ?? throw new ArgumentNullException(nameof(validationService));
     _config = config ?? throw new ArgumentNullException(nameof(config));
     _typosquattingService = typosquattingService ?? throw new ArgumentNullException(nameof(typosquattingService));
 }
Пример #44
0
 public PackageService(
     ICryptographyService cryptoSvc,
     IEntityRepository<PackageRegistration> packageRegistrationRepo,
     IEntityRepository<Package> packageRepo,
     IEntityRepository<PackageStatistics> packageStatsRepo,
     IPackageFileService packageFileSvc,
     IEntityRepository<PackageOwnerRequest> packageOwnerRequestRepository,
     IIndexingService indexingSvc)
 {
     this.cryptoSvc = cryptoSvc;
     this.packageRegistrationRepo = packageRegistrationRepo;
     this.packageRepo = packageRepo;
     this.packageStatsRepo = packageStatsRepo;
     this.packageFileSvc = packageFileSvc;
     this.packageOwnerRequestRepository = packageOwnerRequestRepository;
     this.indexingSvc = indexingSvc;
 }
Пример #45
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService)
 {
     EntitiesContext           = entitiesContext;
     PackageService            = packageService;
     PackageFileService        = packageFileService;
     UserService               = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService            = contentService;
     StatisticsService         = null;
     IndexingService           = indexingService;
 }
Пример #46
0
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService)
 {
     EntitiesContext = entitiesContext;
     PackageService = packageService;
     PackageFileService = packageFileService;
     UserService = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService = contentService;
     StatisticsService = null;
     IndexingService = indexingService;
 }
Пример #47
0
 public ApiController(
     IApiScopeEvaluator apiScopeEvaluator,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IMessageService messageService,
     IAuditingService auditingService,
     IGalleryConfigurationService configurationService,
     ITelemetryService telemetryService,
     AuthenticationService authenticationService,
     ICredentialBuilder credentialBuilder,
     ISecurityPolicyService securityPolicies,
     IReservedNamespaceService reservedNamespaceService,
     IPackageUploadService packageUploadService)
 {
     ApiScopeEvaluator         = apiScopeEvaluator;
     EntitiesContext           = entitiesContext;
     PackageService            = packageService;
     PackageFileService        = packageFileService;
     UserService               = userService;
     NugetExeDownloaderService = nugetExeDownloaderService;
     ContentService            = contentService;
     IndexingService           = indexingService;
     SearchService             = searchService;
     AutoCuratePackage         = autoCuratePackage;
     StatusService             = statusService;
     MessageService            = messageService;
     AuditingService           = auditingService;
     ConfigurationService      = configurationService;
     TelemetryService          = telemetryService;
     AuthenticationService     = authenticationService;
     CredentialBuilder         = credentialBuilder;
     SecurityPolicyService     = securityPolicies;
     ReservedNamespaceService  = reservedNamespaceService;
     PackageUploadService      = packageUploadService;
     StatisticsService         = null;
 }
Пример #48
0
        public ApiController(IPackageService packageSvc, IScanService scanSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc, IConfiguration settings)
        {
            this.packageSvc            = packageSvc;
            this.scanSvc               = scanSvc;
            this.packageFileSvc        = packageFileSvc;
            this.userSvc               = userSvc;
            this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
            this.settings              = settings;

            var forbiddenPackageNames = Configuration.ReadAppSettings("ForbiddenPackageNames");

            if (!string.IsNullOrWhiteSpace(forbiddenPackageNames))
            {
                foreach (var forbiddenPackageName in forbiddenPackageNames.Split(new [] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    _forbiddenPackageNames.Add(forbiddenPackageName.to_string().Trim());
                }
            }
        }
 public ApiController(
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IIndexingService indexingService,
     ISearchService searchService,
     IAutomaticallyCuratePackageCommand autoCuratePackage,
     IStatusService statusService,
     IStatisticsService statisticsService,
     IMessageService messageService,
     AuditingService auditingService,
     IGalleryConfigurationService configurationService)
     : this(entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService, searchService, autoCuratePackage, statusService, messageService, auditingService, configurationService)
 {
     StatisticsService = statisticsService;
 }
Пример #50
0
        /// <summary>
        /// Look for the INupkg instance in the cache first. If it's in the cache, return it.
        /// Otherwise, download the package from the storage service and store it into the cache.
        /// </summary>
        public static async Task<INupkg> GetPackageFromCacheOrDownloadIt(
            Package package,
            IPackageCacheService cacheService,
            IPackageFileService packageFileService)
        {
            Debug.Assert(package != null);
            Debug.Assert(cacheService != null);
            Debug.Assert(packageFileService != null);

            string cacheKey = CreateCacheKey(package.PackageRegistration.Id, package.Version);
            byte[] buffer = cacheService.GetBytes(cacheKey);
            if (buffer == null)
            {
                // In the past, some very old packages can specify an external package binary not hosted at nuget.org.
                // We no longer allow that today.
                if (!String.IsNullOrEmpty(package.ExternalPackageUrl))
                {
                    var httpClient = new HttpClient();
                    using (var responseStream = await httpClient.GetStreamAsync(package.ExternalPackageUrl))
                    {
                        buffer = responseStream.ReadAllBytes();
                    }
                }
                else
                {
                    using (Stream stream = await packageFileService.DownloadPackageFileAsync(package))
                    {
                        if (stream == null)
                        {
                            throw new InvalidOperationException("Couldn't download the package from the storage.");
                        }

                        buffer = stream.ReadAllBytes();
                    }
                }

                cacheService.SetBytes(cacheKey, buffer);
            }

            return new Nupkg(new MemoryStream(buffer), leaveOpen: false);
        }
 public TestPackageDeleteService(
     IEntityRepository <Package> packageRepository,
     IEntityRepository <PackageRegistration> packageRegistrationRepository,
     IEntityRepository <PackageDelete> packageDeletesRepository,
     IEntitiesContext entitiesContext,
     IPackageService packageService,
     IIndexingService indexingService,
     IPackageFileService packageFileService,
     IAuditingService auditingService,
     IPackageDeleteConfiguration config) : base(
         packageRepository,
         packageRegistrationRepository,
         packageDeletesRepository,
         entitiesContext,
         packageService,
         indexingService,
         packageFileService,
         auditingService,
         config)
 {
 }
Пример #52
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc)
 {
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileSvc;
     this.userSvc = userSvc;
 }
 public TestPackageDeleteService(IEntityRepository<Package> packageRepository, IEntityRepository<PackageDelete> packageDeletesRepository, IEntitiesContext entitiesContext, IPackageService packageService, IIndexingService indexingService, IPackageFileService packageFileService, AuditingService auditingService)
     : base(packageRepository, packageDeletesRepository, entitiesContext, packageService, indexingService, packageFileService, auditingService)
 {
 }