V9: Allowlisting remote URLs for displaying content on the content dashboard (#11825)

* Fixing ContentDashboardSettings to work when set in the config

* Moving file in Models folder and adding ContentDashboardUrlAllowlist setting

* Implementing allowlist for content dashboard base url

* Cleanup

* Error msg vs log msg
This commit is contained in:
Elitsa Marinovska
2022-01-18 15:37:31 +01:00
committed by GitHub
parent 1b5830a9d7
commit 229ca989eb
5 changed files with 67 additions and 10 deletions

View File

@@ -0,0 +1,35 @@
using System.ComponentModel;
namespace Umbraco.Cms.Core.Configuration.Models
{
/// <summary>
/// Typed configuration options for content dashboard settings.
/// </summary>
[UmbracoOptions(Constants.Configuration.ConfigContentDashboard)]
public class ContentDashboardSettings
{
private const string DefaultContentDashboardPath = "cms";
/// <summary>
/// Gets a value indicating whether the content dashboard should be available to all users.
/// </summary>
/// <value>
/// <c>true</c> if the dashboard is visible for all user groups; otherwise, <c>false</c>
/// and the default access rules for that dashboard will be in use.
/// </value>
public bool AllowContentDashboardAccessToAllUsers { get; set; } = true;
/// <summary>
/// Gets the path to use when constructing the URL for retrieving data for the content dashboard.
/// </summary>
/// <value>The URL path.</value>
[DefaultValue(DefaultContentDashboardPath)]
public string ContentDashboardPath { get; set; } = DefaultContentDashboardPath;
/// <summary>
/// Gets the allowed addresses to retrieve data for the content dashboard.
/// </summary>
/// <value>The URLs.</value>
public string[] ContentDashboardUrlAllowlist { get; set; }
}
}