Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AccountDeleter/Configuration/GalleryConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ public string SiteRoot
public int MaxJsonLengthOverride { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public int MaxOwnerPerPackageRegistration { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public int MaxOwnerRequestsPerPackageRegistration { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public string ExternalYourPrivacyChoicesUrl { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
}
}
5 changes: 5 additions & 0 deletions src/NuGetGallery.Services/Configuration/AppConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ public class AppConfiguration : IAppConfiguration
/// </summary>
public string ExternalPrivacyPolicyUrl { get; set; }

/// <summary>
/// Gets/sets a string that is a link to an external "Your Privacy Choices" page
/// </summary>
public string ExternalYourPrivacyChoicesUrl { get; set; }

/// <summary>
/// Gets/sets a string that is a link to an external terms of use document
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ public interface IAppConfiguration : IMessageServiceConfiguration
/// </summary>
string ExternalPrivacyPolicyUrl { get; set; }

/// <summary>
/// Gets/sets a string that is a link to an external privacy choices page
/// </summary>
string ExternalYourPrivacyChoicesUrl { get; set; }

/// <summary>
/// Gets/sets a string that is a link to an external terms of use document
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions src/NuGetGallery/UrlHelperExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,16 @@ public static string Privacy(this UrlHelper url, bool relativeUrl = true)
return GetActionLink(url, "Privacy", "Pages", relativeUrl);
}

public static string YourPrivacyChoices(this UrlHelper url, bool relativeUrl = true)
{
if (!String.IsNullOrEmpty(_configuration.Current.ExternalYourPrivacyChoicesUrl))
{
return _configuration.Current.ExternalYourPrivacyChoicesUrl;
}

return GetActionLink(url, "Your Privacy Choices", "Pages", relativeUrl);
}

public static string ExternalPrivacyUrl(this UrlHelper url)
{
return _configuration.Current.ExternalPrivacyPolicyUrl;
Expand Down
20 changes: 19 additions & 1 deletion src/NuGetGallery/Views/Shared/Gallery/Footer.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
!String.IsNullOrEmpty(this.Config.Current.ExternalBrandingUrl) ||
!String.IsNullOrEmpty(this.Config.Current.ExternalAboutUrl) ||
!String.IsNullOrEmpty(this.Config.Current.ExternalTermsOfUseUrl) ||
!String.IsNullOrEmpty(this.Config.Current.ExternalPrivacyPolicyUrl))
!String.IsNullOrEmpty(this.Config.Current.ExternalPrivacyPolicyUrl) ||
!String.IsNullOrEmpty(this.Config.Current.ExternalYourPrivacyChoicesUrl))
{
<div class="col-md-12 footer-release-info">
<p>
Expand All @@ -52,7 +53,16 @@

<a href="@Url.About()">About</a> -
<a href="@Url.Terms()">Terms of Use</a> -
<a href="@Url.YourPrivacyChoices()">
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" style="vertical-align:middle">
<title>Your Privacy Choices Opt-Out Icon</title>
<path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path>
<path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path>
<path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path>
<path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path>
</svg><span style="font-size: 16px; font-weight:400">Your Privacy Choices</span></a> -
<a href="@Url.Privacy()" id="footer-privacy-policy-link">Privacy Statement</a>

@if (!String.IsNullOrEmpty(this.Config.Current.TrademarksUrl))
{
@:- <a href="@this.Config.Current.TrademarksUrl">Trademarks</a>
Expand All @@ -76,6 +86,14 @@
&copy; @DateTime.UtcNow.Year .NET Foundation -
<a href="@Url.About()">About</a> -
<a href="@Url.Terms()">Terms of Use</a> -
<a href="@Url.YourPrivacyChoices()">
<svg role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 14" xml:space="preserve" height="16" width="43" style="vertical-align:middle">
<title>Your Privacy Choices Opt-Out Icon</title>
<path d="M7.4 12.8h6.8l3.1-11.6H7.4C4.2 1.2 1.6 3.8 1.6 7s2.6 5.8 5.8 5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#fff"></path>
<path d="M22.6 0H7.4c-3.9 0-7 3.1-7 7s3.1 7 7 7h15.2c3.9 0 7-3.1 7-7s-3.2-7-7-7zm-21 7c0-3.2 2.6-5.8 5.8-5.8h9.9l-3.1 11.6H7.4c-3.2 0-5.8-2.6-5.8-5.8z" style="fill-rule:evenodd;clip-rule:evenodd;fill:#06f"></path>
<path d="M24.6 4c.2.2.2.6 0 .8L22.5 7l2.2 2.2c.2.2.2.6 0 .8-.2.2-.6.2-.8 0l-2.2-2.2-2.2 2.2c-.2.2-.6.2-.8 0-.2-.2-.2-.6 0-.8L20.8 7l-2.2-2.2c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0l2.2 2.2L23.8 4c.2-.2.6-.2.8 0z" style="fill:#fff"></path>
<path d="M12.7 4.1c.2.2.3.6.1.8L8.6 9.8c-.1.1-.2.2-.3.2-.2.1-.5.1-.7-.1L5.4 7.7c-.2-.2-.2-.6 0-.8.2-.2.6-.2.8 0L8 8.6l3.8-4.5c.2-.2.6-.2.9 0z" style="fill:#06f"></path>
</svg><span style="font-size: 16px; font-weight: 400">Your Privacy Choices</span></a> -
<a href="@Url.Privacy()" id="footer-privacy-policy-link">Privacy Policy</a>
@if (!String.IsNullOrEmpty(this.Config.Current.TrademarksUrl))
{
Expand Down
1 change: 1 addition & 0 deletions src/NuGetGallery/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<add key="Gallery.ExternalStatusUrl" value="https://status.nuget.org/"/>
<add key="Gallery.ExternalAboutUrl" value=""/>
<add key="Gallery.ExternalPrivacyPolicyUrl" value=""/>
<add key="Gallery.ExternalYourPrivacyChoicesUrl" value="https://aka.ms/yourcaliforniaprivacychoices"/>
<add key="Gallery.ExternalTermsOfUseUrl" value=""/>
<add key="Gallery.ExternalBrandingUrl" value=""/>
<add key="Gallery.ExternalBrandingMessage" value=""/>
Expand Down
43 changes: 43 additions & 0 deletions tests/NuGetGallery.Facts/Controllers/PagesControllerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,48 @@ public async Task WithoutExternalPrivacyUrlConfigured()
It.IsAny<TimeSpan>()), Times.Once);
}
}

public class TheYourPrivacyChoicesUrl : TestContainer
{
[Fact]
public void WithExternalYourPrivacyChoicesUrlConfigured()
{
var expectedUrl = "https://aka.ms/yourcaliforniaprivacychoices";
var configuration = GetConfigurationService();
configuration.Current.ExternalYourPrivacyChoicesUrl = expectedUrl;

var urlHelper = TestUtility.MockUrlHelper();

var result = UrlHelperExtensions.YourPrivacyChoices(urlHelper);

Assert.Equal(expectedUrl, result);
}

[Fact]
public void WithoutExternalYourPrivacyChoicesUrlConfigured()
{
var configuration = GetConfigurationService();
configuration.Current.ExternalYourPrivacyChoicesUrl = "";

var urlHelper = TestUtility.MockUrlHelper();

var result = UrlHelperExtensions.YourPrivacyChoices(urlHelper);

Assert.NotEqual("https://aka.ms/yourcaliforniaprivacychoices", result);
}

[Fact]
public void WithNullExternalYourPrivacyChoicesUrlConfigured()
{
var configuration = GetConfigurationService();
configuration.Current.ExternalYourPrivacyChoicesUrl = null;

var urlHelper = TestUtility.MockUrlHelper();

var result = UrlHelperExtensions.YourPrivacyChoices(urlHelper);

Assert.NotEqual("https://aka.ms/yourcaliforniaprivacychoices", result);
}
}
}
}