diff --git a/NuGetGallery.sln.DotSettings b/NuGetGallery.sln.DotSettings index a9a1077374..db656af837 100644 --- a/NuGetGallery.sln.DotSettings +++ b/NuGetGallery.sln.DotSettings @@ -1,4 +1,5 @@  + DO_NOT_SHOW Copyright (c) .NET Foundation. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. AUTO \ No newline at end of file diff --git a/src/NuGetGallery/Authentication/AuthenticationService.cs b/src/NuGetGallery/Authentication/AuthenticationService.cs index bfba6a54dc..7513db64be 100644 --- a/src/NuGetGallery/Authentication/AuthenticationService.cs +++ b/src/NuGetGallery/Authentication/AuthenticationService.cs @@ -1,21 +1,19 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Web; -using NuGetGallery.Diagnostics; using System.Data.Entity; using System.Globalization; -using Microsoft.Owin; +using System.Linq; using System.Security.Claims; -using NuGetGallery.Configuration; -using Microsoft.Owin.Security; -using NuGetGallery.Authentication.Providers; -using System.Web.Mvc; using System.Threading.Tasks; +using System.Web.Mvc; +using Microsoft.Owin; using NuGetGallery.Auditing; +using NuGetGallery.Authentication.Providers; +using NuGetGallery.Configuration; +using NuGetGallery.Diagnostics; namespace NuGetGallery.Authentication { @@ -367,7 +365,7 @@ public async virtual Task ReadExternalLoginCred Trace.Error("External Authentication is missing required claim: " + ClaimTypes.NameIdentifier); return new AuthenticateExternalLoginResult(); } - + var nameClaim = result.Identity.FindFirst(ClaimTypes.Name); if (nameClaim == null) { @@ -595,7 +593,7 @@ private async Task MigrateCredentials(User user, List creds, string Entities.DeleteOnCommit(cred); } await Auditing.SaveAuditRecord(new UserAuditRecord(user, UserAuditAction.RemovedCredential, toRemove)); - + // Now add one if there are no credentials left if (creds.Count == 0) { diff --git a/src/NuGetGallery/Controllers/ApiController.cs b/src/NuGetGallery/Controllers/ApiController.cs index af17b1f77d..2cf5446f63 100644 --- a/src/NuGetGallery/Controllers/ApiController.cs +++ b/src/NuGetGallery/Controllers/ApiController.cs @@ -21,7 +21,7 @@ namespace NuGetGallery { - public class ApiController + public partial class ApiController : AppController { private readonly IAppConfiguration _config; diff --git a/src/NuGetGallery/Controllers/AppController.cs b/src/NuGetGallery/Controllers/AppController.cs index 4b623aff4c..b0bdc41fb7 100644 --- a/src/NuGetGallery/Controllers/AppController.cs +++ b/src/NuGetGallery/Controllers/AppController.cs @@ -1,20 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; + using System.Security.Claims; -using System.Security.Principal; -using System.Linq; using System.Web; using System.Web.Mvc; using Microsoft.Owin; -using Ninject; -using NuGetGallery.Authentication; -using System.Net; -using NuGetGallery.Configuration; namespace NuGetGallery { - public abstract partial class AppController : Controller + public abstract partial class AppController + : Controller { private IOwinContext _overrideContext; @@ -51,20 +46,4 @@ protected internal virtual ActionResult SafeRedirect(string returnUrl) return new SafeRedirectResult(returnUrl, Url.Home()); } } - - public class NuGetContext - { - private Lazy _currentUser; - - public ConfigurationService Config { get; internal set; } - public User CurrentUser { get { return _currentUser.Value; } } - - public NuGetContext(AppController ctrl) - { - Config = Container.Kernel.TryGet(); - - _currentUser = new Lazy(() => - ctrl.OwinContext.GetCurrentUser()); - } - } } \ No newline at end of file diff --git a/src/NuGetGallery/Controllers/AuthenticationController.cs b/src/NuGetGallery/Controllers/AuthenticationController.cs index e396fb60b9..5f1cddabe6 100644 --- a/src/NuGetGallery/Controllers/AuthenticationController.cs +++ b/src/NuGetGallery/Controllers/AuthenticationController.cs @@ -1,32 +1,31 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; -using System.Web; using System.Collections.Generic; using System.Linq; +using System.Net.Mail; +using System.Security.Claims; +using System.Threading.Tasks; using System.Web.Mvc; using NuGetGallery.Authentication; using NuGetGallery.Filters; -using System.Threading.Tasks; -using System.Security.Claims; -using System.Text.RegularExpressions; -using System.Diagnostics; -using NuGetGallery.Infrastructure; -using System.Net.Mail; namespace NuGetGallery { - public partial class AuthenticationController : AppController + public partial class AuthenticationController + : AppController { - public AuthenticationService AuthService { get; protected set; } - public IUserService UserService { get; protected set; } - public IMessageService MessageService { get; protected set; } - // For sub-classes to initialize services themselves protected AuthenticationController() { } + public AuthenticationService AuthService { get; protected set; } + public IUserService UserService { get; protected set; } + public IMessageService MessageService { get; protected set; } + + public AuthenticationController( AuthenticationService authService, IUserService userService, diff --git a/src/NuGetGallery/Controllers/CuratedFeedsController.cs b/src/NuGetGallery/Controllers/CuratedFeedsController.cs index 21cb85e10c..a689cdd24f 100644 --- a/src/NuGetGallery/Controllers/CuratedFeedsController.cs +++ b/src/NuGetGallery/Controllers/CuratedFeedsController.cs @@ -1,12 +1,9 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; -using System.Data.Entity; + using System.Linq; using System.Threading.Tasks; using System.Web.Mvc; -using NuGet; -using NuGetGallery; namespace NuGetGallery { @@ -77,7 +74,7 @@ public virtual async Task ListPackages(string curatedFeedName, str int totalHits = results.Hits; if (page == 1 && !results.Data.Any()) { - // In the event the index wasn't updated, we may get an incorrect count. + // In the event the index wasn't updated, we may get an incorrect count. totalHits = 0; } diff --git a/src/NuGetGallery/Controllers/CuratedPackagesController.cs b/src/NuGetGallery/Controllers/CuratedPackagesController.cs index 7ef574d016..f9ef792eb6 100644 --- a/src/NuGetGallery/Controllers/CuratedPackagesController.cs +++ b/src/NuGetGallery/Controllers/CuratedPackagesController.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Linq; using System.Web.Mvc; using System.Data.Entity; @@ -7,7 +8,8 @@ namespace NuGetGallery { [Authorize] - public partial class CuratedPackagesController : AppController + public partial class CuratedPackagesController + : AppController { internal ICuratedFeedService CuratedFeedService { get; set; } internal IEntitiesContext EntitiesContext { get; set; } diff --git a/src/NuGetGallery/Controllers/ErrorsController.cs b/src/NuGetGallery/Controllers/ErrorsController.cs index 6ae59595a1..7141747e28 100644 --- a/src/NuGetGallery/Controllers/ErrorsController.cs +++ b/src/NuGetGallery/Controllers/ErrorsController.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Web.Mvc; namespace NuGetGallery diff --git a/src/NuGetGallery/Controllers/JsonApiController.cs b/src/NuGetGallery/Controllers/JsonApiController.cs index f9bd6ec14f..0253d7e6a7 100644 --- a/src/NuGetGallery/Controllers/JsonApiController.cs +++ b/src/NuGetGallery/Controllers/JsonApiController.cs @@ -1,13 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Globalization; using System.Linq; using System.Web.Mvc; using MvcHaack.Ajax; -using System.Globalization; namespace NuGetGallery { - public partial class JsonApiController : JsonController + public partial class JsonApiController + : JsonController { private readonly IMessageService _messageService; private readonly IEntityRepository _packageOwnerRequestRepository; @@ -79,7 +81,7 @@ public object AddPackageOwner(string id, string username) var ownerRequest = _packageService.CreatePackageOwnerRequest(package, currentUser, user); var confirmationUrl = Url.ConfirmationUrl( - "ConfirmOwner", + "ConfirmOwner", "Packages", user.Username, ownerRequest.ConfirmationCode, diff --git a/src/NuGetGallery/Controllers/NuGetContext.cs b/src/NuGetGallery/Controllers/NuGetContext.cs new file mode 100644 index 0000000000..ab546b2c07 --- /dev/null +++ b/src/NuGetGallery/Controllers/NuGetContext.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Ninject; +using NuGetGallery.Configuration; + +namespace NuGetGallery +{ + public class NuGetContext + { + private readonly Lazy _currentUser; + + public NuGetContext(AppController ctrl) + { + Config = Container.Kernel.TryGet(); + + _currentUser = new Lazy(() => ctrl.OwinContext.GetCurrentUser()); + } + + public ConfigurationService Config { get; internal set; } + public User CurrentUser { get { return _currentUser.Value; } } + } +} \ No newline at end of file diff --git a/src/NuGetGallery/Controllers/PackagesController.cs b/src/NuGetGallery/Controllers/PackagesController.cs index 2e0b7504a5..a3dfcc0740 100644 --- a/src/NuGetGallery/Controllers/PackagesController.cs +++ b/src/NuGetGallery/Controllers/PackagesController.cs @@ -23,7 +23,8 @@ namespace NuGetGallery { - public partial class PackagesController : AppController + public partial class PackagesController + : AppController { // TODO: add support for URL-based package submission // TODO: add support for uploading logos and screenshots @@ -395,7 +396,7 @@ public virtual ActionResult ReportAbuse(string id, string version) // If user logged on in as owner a different tab, then clicked the link, we can redirect them to ReportMyPackage if (package.IsOwner(user)) { - return RedirectToAction("ReportMyPackage", new {id, version}); + return RedirectToAction("ReportMyPackage", new { id, version }); } if (user.Confirmed) @@ -404,11 +405,11 @@ public virtual ActionResult ReportAbuse(string id, string version) } } - ViewData[Constants.ReturnUrlViewDataKey] = Url.Action("ReportMyPackage", new {id, version}); + ViewData[Constants.ReturnUrlViewDataKey] = Url.Action("ReportMyPackage", new { id, version }); return View(model); } - private static readonly ReportPackageReason[] ReportMyPackageReasons = new[] { + private static readonly ReportPackageReason[] ReportMyPackageReasons = { ReportPackageReason.ContainsPrivateAndConfidentialData, ReportPackageReason.PublishedWithWrongVersion, ReportPackageReason.ReleasedInPublicByAccident, @@ -956,7 +957,7 @@ private async Task SafeCreatePackage(NuGetGallery.User currentUser, Stre { caught = ipex.AsUserSafeException(); } - catch(InvalidDataException idex) + catch (InvalidDataException idex) { caught = idex.AsUserSafeException(); } diff --git a/src/NuGetGallery/Controllers/PagesController.cs b/src/NuGetGallery/Controllers/PagesController.cs index e555d68bfe..6e6e26c555 100644 --- a/src/NuGetGallery/Controllers/PagesController.cs +++ b/src/NuGetGallery/Controllers/PagesController.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Linq; using System.Net; @@ -8,7 +9,8 @@ namespace NuGetGallery { - public partial class PagesController : AppController + public partial class PagesController + : AppController { public IContentService ContentService { get; protected set; } diff --git a/src/NuGetGallery/Controllers/StatisticsController.cs b/src/NuGetGallery/Controllers/StatisticsController.cs index 734887e163..294f42f61a 100644 --- a/src/NuGetGallery/Controllers/StatisticsController.cs +++ b/src/NuGetGallery/Controllers/StatisticsController.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Net; @@ -11,7 +11,8 @@ namespace NuGetGallery { - public partial class StatisticsController : AppController + public partial class StatisticsController + : AppController { private readonly IStatisticsService _statisticsService = null; private readonly IAggregateStatsService _aggregateStatsService = null; @@ -108,7 +109,7 @@ public virtual async Task Index() } var availablity = await Task.WhenAll( - _statisticsService.LoadDownloadPackages(), + _statisticsService.LoadDownloadPackages(), _statisticsService.LoadDownloadPackageVersions(), _statisticsService.LoadNuGetClientVersion(), _statisticsService.LoadLast6Months()); @@ -269,7 +270,7 @@ private void ProcessReport(StatisticsPackagesReport report, string[] groupby, st } else { - // the pivot array is used as the Columns in the report so we resize because this was the final set of columns + // the pivot array is used as the Columns in the report so we resize because this was the final set of columns Array.Resize(ref pivot, dim); } diff --git a/src/NuGetGallery/Controllers/UsersController.cs b/src/NuGetGallery/Controllers/UsersController.cs index 6637034123..03a4b06367 100644 --- a/src/NuGetGallery/Controllers/UsersController.cs +++ b/src/NuGetGallery/Controllers/UsersController.cs @@ -11,7 +11,8 @@ namespace NuGetGallery { - public partial class UsersController : AppController + public partial class UsersController + : AppController { public ICuratedFeedService CuratedFeedService { get; protected set; } public IUserService UserService { get; protected set; } diff --git a/src/NuGetGallery/ExtensionMethods.cs b/src/NuGetGallery/ExtensionMethods.cs index eee73e7a19..b39350bf1b 100644 --- a/src/NuGetGallery/ExtensionMethods.cs +++ b/src/NuGetGallery/ExtensionMethods.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Collections.Concurrent; using System.Collections.Generic; @@ -25,26 +26,6 @@ namespace NuGetGallery { public static class ExtensionMethods { - public static string ToJavaScriptUTC(this DateTime self) - { - return self.ToUniversalTime().ToString("O", CultureInfo.CurrentCulture); - } - - public static string ToNuGetShortDateTimeString(this DateTime self) - { - return self.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture); - } - - public static string ToNuGetShortDateString(this DateTime self) - { - return self.ToString("yyyy-MM-dd", CultureInfo.CurrentCulture); - } - - public static string ToNuGetLongDateString(this DateTime self) - { - return self.ToString("dddd, MMMM dd yyyy", CultureInfo.CurrentCulture); - } - public static void AddOrSet(this ConcurrentDictionary self, TKey key, TValue val) { self.AddOrUpdate(key, val, (_, __) => val); @@ -232,16 +213,6 @@ public static string CardinalityLabel(this int count, string singular, string pl return count == 1 ? singular : plural; } - public static bool IsInThePast(this DateTime? date) - { - return date.Value.IsInThePast(); - } - - public static bool IsInThePast(this DateTime date) - { - return date < DateTime.UtcNow; - } - public static IQueryable SortBy(this IQueryable source, string sortExpression) { if (source == null) diff --git a/src/NuGetGallery/Extensions/DateTimeExtensions.cs b/src/NuGetGallery/Extensions/DateTimeExtensions.cs new file mode 100644 index 0000000000..9c58405d15 --- /dev/null +++ b/src/NuGetGallery/Extensions/DateTimeExtensions.cs @@ -0,0 +1,41 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Globalization; + +namespace NuGetGallery +{ + public static class DateTimeExtensions + { + public static bool IsInThePast(this DateTime? date) + { + return date.Value.IsInThePast(); + } + + public static bool IsInThePast(this DateTime date) + { + return date < DateTime.UtcNow; + } + + public static string ToJavaScriptUTC(this DateTime self) + { + return self.ToUniversalTime().ToString("O", CultureInfo.CurrentCulture); + } + + public static string ToNuGetShortDateTimeString(this DateTime self) + { + return self.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.CurrentCulture); + } + + public static string ToNuGetShortDateString(this DateTime self) + { + return self.ToString("yyyy-MM-dd", CultureInfo.CurrentCulture); + } + + public static string ToNuGetLongDateString(this DateTime self) + { + return self.ToString("dddd, MMMM dd yyyy", CultureInfo.CurrentCulture); + } + } +} \ No newline at end of file diff --git a/src/NuGetGallery/NuGetGallery.csproj b/src/NuGetGallery/NuGetGallery.csproj index 9e53bc8983..0e536b4631 100644 --- a/src/NuGetGallery/NuGetGallery.csproj +++ b/src/NuGetGallery/NuGetGallery.csproj @@ -420,6 +420,8 @@ + + @@ -1068,6 +1070,7 @@ + diff --git a/src/NuGetGallery/NuGetGallery.csproj.DotSettings b/src/NuGetGallery/NuGetGallery.csproj.DotSettings index 8f1511919a..a2439a04cd 100644 --- a/src/NuGetGallery/NuGetGallery.csproj.DotSettings +++ b/src/NuGetGallery/NuGetGallery.csproj.DotSettings @@ -2,6 +2,7 @@ True True True + True True True True diff --git a/src/NuGetGallery/Services/IMessageService.cs b/src/NuGetGallery/Services/IMessageService.cs index d5767d3591..d2125b9948 100644 --- a/src/NuGetGallery/Services/IMessageService.cs +++ b/src/NuGetGallery/Services/IMessageService.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Net.Mail; namespace NuGetGallery diff --git a/src/NuGetGallery/Services/MessageService.cs b/src/NuGetGallery/Services/MessageService.cs index eb8a4be4be..a3f04afa57 100644 --- a/src/NuGetGallery/Services/MessageService.cs +++ b/src/NuGetGallery/Services/MessageService.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System; using System.Globalization; using System.Linq; @@ -7,28 +8,29 @@ using System.Text; using System.Web; using AnglicanGeek.MarkdownMailer; -using Elmah; using NuGetGallery.Authentication; -using Glimpse.AspNet.AlternateType; using NuGetGallery.Configuration; namespace NuGetGallery { public class MessageService : IMessageService { - public IMailSender MailSender { get; protected set; } - public IAppConfiguration Config { get; protected set; } - public AuthenticationService AuthService { get; protected set; } - - protected MessageService() { } + protected MessageService() + { + } - public MessageService(IMailSender mailSender, IAppConfiguration config, AuthenticationService authService) :this() + public MessageService(IMailSender mailSender, IAppConfiguration config, AuthenticationService authService) + : this() { MailSender = mailSender; Config = config; AuthService = authService; } + public IMailSender MailSender { get; protected set; } + public IAppConfiguration Config { get; protected set; } + public AuthenticationService AuthService { get; protected set; } + public void ReportAbuse(ReportPackageRequest request) { string subject = "[{GalleryOwnerName}] Support Request for '{Id}' version {Version} (Reason: {Reason})"; @@ -54,7 +56,7 @@ public void ReportAbuse(ReportPackageRequest request) "; - var body = new StringBuilder(""); + var body = new StringBuilder(); body.Append(request.FillIn(bodyTemplate, Config)); body.AppendFormat(CultureInfo.InvariantCulture, @" @@ -313,9 +315,9 @@ public void SendPackageOwnerRequest(User fromUser, User toUser, PackageRegistrat public void SendCredentialRemovedNotice(User user, Credential removed) { SendCredentialChangeNotice( - user, - removed, - Strings.Emails_CredentialRemoved_Body, + user, + removed, + Strings.Emails_CredentialRemoved_Body, Strings.Emails_CredentialRemoved_Subject); } @@ -368,15 +370,16 @@ private void SendMessage(MailMessage mailMessage, bool copySender = false) { var senderCopy = new MailMessage( Config.GalleryOwner, - mailMessage.ReplyToList.First()) { - Subject = mailMessage.Subject + " [Sender Copy]", - Body = String.Format( - CultureInfo.CurrentCulture, - "You sent the following message via {0}: {1}{1}{2}", - Config.GalleryOwner.DisplayName, - Environment.NewLine, - mailMessage.Body), - }; + mailMessage.ReplyToList.First()) + { + Subject = mailMessage.Subject + " [Sender Copy]", + Body = String.Format( + CultureInfo.CurrentCulture, + "You sent the following message via {0}: {1}{1}{2}", + Config.GalleryOwner.DisplayName, + Environment.NewLine, + mailMessage.Body), + }; senderCopy.ReplyToList.Add(mailMessage.ReplyToList.First()); MailSender.Send(senderCopy); } diff --git a/src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs b/src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs index eeb7136430..e4dff5da4d 100644 --- a/src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs +++ b/src/NuGetGallery/ViewModels/ReportAbuseViewModel.cs @@ -1,41 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Web.Mvc; using NuGetGallery.Infrastructure; namespace NuGetGallery { - public enum ReportPackageReason - { - [Description("Other")] - Other, - - [Description("The package has a bug/failed to install")] - HasABugOrFailedToInstall, - - [Description("The package contains malicious code")] - ContainsMaliciousCode, - - [Description("The package violates a license I own")] - ViolatesALicenseIOwn, - - [Description("The package owner is fraudulently claiming authorship")] - IsFraudulent, - - [Description("The package contains private/confidential data")] - ContainsPrivateAndConfidentialData, - - [Description("The package was published as the wrong version")] - PublishedWithWrongVersion, - - [Description("The package was not intended to be published publically on nuget.org")] - ReleasedInPublicByAccident, - } - public class ReportAbuseViewModel { public static readonly string NoReasonSpecifiedText = "Select a reason"; @@ -46,7 +18,7 @@ public class ReportAbuseViewModel [Display(Name = "Contacted Owner")] public bool AlreadyContactedOwner { get; set; } - [NotEqual(ReportPackageReason.HasABugOrFailedToInstall, ErrorMessage = "Unfortunately we cannot provide support for bugs in NuGet Packages. Please contact owner(s) for assistance.")] + [NotEqual(ReportPackageReason.HasABugOrFailedToInstall, ErrorMessage = "Unfortunately we cannot provide support for bugs in NuGet Packages. Please contact owner(s) for assistance.")] [Required(ErrorMessage = "You must select a reason for reporting the package")] [Display(Name = "Reason")] public ReportPackageReason? Reason { get; set; } diff --git a/src/NuGetGallery/ViewModels/ReportPackageReason.cs b/src/NuGetGallery/ViewModels/ReportPackageReason.cs new file mode 100644 index 0000000000..bf91430c0c --- /dev/null +++ b/src/NuGetGallery/ViewModels/ReportPackageReason.cs @@ -0,0 +1,34 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.ComponentModel; + +namespace NuGetGallery +{ + public enum ReportPackageReason + { + [Description("Other")] + Other, + + [Description("The package has a bug/failed to install")] + HasABugOrFailedToInstall, + + [Description("The package contains malicious code")] + ContainsMaliciousCode, + + [Description("The package violates a license I own")] + ViolatesALicenseIOwn, + + [Description("The package owner is fraudulently claiming authorship")] + IsFraudulent, + + [Description("The package contains private/confidential data")] + ContainsPrivateAndConfidentialData, + + [Description("The package was published as the wrong version")] + PublishedWithWrongVersion, + + [Description("The package was not intended to be published publically on nuget.org")] + ReleasedInPublicByAccident, + } +} \ No newline at end of file diff --git a/src/NuGetGallery/Web.config b/src/NuGetGallery/Web.config index b729343402..212493c86d 100644 --- a/src/NuGetGallery/Web.config +++ b/src/NuGetGallery/Web.config @@ -209,7 +209,7 @@ - +