Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 8
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc)
 {
     this.packageSvc            = packageSvc;
     this.packageFileSvc        = packageFileSvc;
     this.userSvc               = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 14
0
 public ApiController(IPackageService packageSvc, IPackageFileService packageFileSvc, IUserService userSvc, INuGetExeDownloaderService nugetExeDownloaderSvc)
 {
     this.packageSvc = packageSvc;
     this.packageFileSvc = packageFileSvc;
     this.userSvc = userSvc;
     this.nugetExeDownloaderSvc = nugetExeDownloaderSvc;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 25
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService)
 {
     _packageService = packageService;
     _packageFileService = packageFileService;
     _userService = userService;
     _nugetExeDownloaderService = nugetExeDownloaderService;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 27
0
 public ApiController(
     IPackageService packageService,
     IPackageFileService packageFileService,
     IUserService userService,
     INuGetExeDownloaderService nugetExeDownloaderService,
     IContentService contentService,
     IStatisticsService statisticsService)
     : this(packageService, packageFileService, userService, nugetExeDownloaderService, contentService)
 {
     _statisticsService = statisticsService;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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));
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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());
                }
            }
        }
Ejemplo n.º 49
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,
     IMessageService messageService,
     AuditingService auditingService,
     IGalleryConfigurationService configurationService)
     : this(entitiesContext, packageService, packageFileService, userService, nugetExeDownloaderService, contentService, indexingService, searchService, autoCuratePackage, statusService, messageService, auditingService, configurationService)
 {
     StatisticsService = statisticsService;
 }
Ejemplo n.º 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)
 {
 }
Ejemplo n.º 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)
 {
 }