public async Task <Package> GeneratePackageAsync( string id, PackageArchiveReader nugetPackage, PackageStreamMetadata packageStreamMetadata, User user) { var isPushAllowed = _reservedNamespaceService.IsPushAllowed(id, user, out IReadOnlyCollection <ReservedNamespace> userOwnedNamespaces); var shouldMarkIdVerified = isPushAllowed && userOwnedNamespaces != null && userOwnedNamespaces.Any(); var package = await _packageService.CreatePackageAsync( nugetPackage, packageStreamMetadata, user, isVerified : shouldMarkIdVerified); await _validationService.StartValidationAsync(package); if (shouldMarkIdVerified) { // Add all relevant package registrations to the applicable namespaces foreach (var rn in userOwnedNamespaces) { _reservedNamespaceService.AddPackageRegistrationToNamespace( rn.Value, package.PackageRegistration); } } return(package); }
public async Task <Package> GeneratePackageAsync(string id, PackageArchiveReader nugetPackage, PackageStreamMetadata packageStreamMetadata, User user, bool commitChanges) { var isPushAllowed = _reservedNamespaceService.IsPushAllowed(id, user, out IReadOnlyCollection <ReservedNamespace> userOwnedNamespaces); var shouldMarkIdVerified = isPushAllowed && userOwnedNamespaces != null && userOwnedNamespaces.Any(); var package = await _packageService.CreatePackageAsync( nugetPackage, packageStreamMetadata, user, isVerified : shouldMarkIdVerified, commitChanges : commitChanges); if (shouldMarkIdVerified) { // Add all relevant package registrations to the applicable namespaces await Task.WhenAll(userOwnedNamespaces .Select(rn => _reservedNamespaceService.AddPackageRegistrationToNamespaceAsync(rn.Value, package.PackageRegistration, commitChanges))); } return(package); }