From eabfa7f414fcf89efbe34cf49b7e8563c0d2de3c Mon Sep 17 00:00:00 2001 From: Elitsa Marinovska Date: Wed, 24 Mar 2021 15:28:06 +0100 Subject: [PATCH] Getting rid of the config file and implementing an appSetting instead --- .../Configuration/GlobalSettings.cs | 22 +++++++++++++++++++ .../Configuration/IGlobalSettings.cs | 9 ++++++++ src/Umbraco.Core/Constants-AppSettings.cs | 5 +++++ src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../config/content.dashboard.access.config.js | 22 ------------------- src/Umbraco.Web.UI/web.Template.config | 1 + 6 files changed, 37 insertions(+), 23 deletions(-) delete mode 100644 src/Umbraco.Web.UI/config/content.dashboard.access.config.js diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index ba5baf9e87..0765a35a29 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -395,6 +395,28 @@ namespace Umbraco.Core.Configuration } } + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + public bool AllowContentDashboardAccessToAllUsers + { + get + { + try + { + return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.AllowContentDashboardAccessToAllUsers]); + } + catch + { + return false; + } + } + } + /// /// An int value representing the time in milliseconds to lock the database for a write operation diff --git a/src/Umbraco.Core/Configuration/IGlobalSettings.cs b/src/Umbraco.Core/Configuration/IGlobalSettings.cs index 483829f85f..6016de2917 100644 --- a/src/Umbraco.Core/Configuration/IGlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/IGlobalSettings.cs @@ -57,6 +57,15 @@ /// bool UseHttps { get; } + /// + /// Gets a value indicating whether the content dashboard should be available to all users. + /// + /// + /// true if the dashboard is visible for all user groups; otherwise, false + /// and the default access rules for that dashboard will be in use. + /// + bool AllowContentDashboardAccessToAllUsers { get; } + /// /// Returns a string value to determine if umbraco should skip version-checking. /// diff --git a/src/Umbraco.Core/Constants-AppSettings.cs b/src/Umbraco.Core/Constants-AppSettings.cs index f04f0e1f5f..1f096ab9f9 100644 --- a/src/Umbraco.Core/Constants-AppSettings.cs +++ b/src/Umbraco.Core/Constants-AppSettings.cs @@ -110,6 +110,11 @@ namespace Umbraco.Core /// public const string UseHttps = "Umbraco.Core.UseHttps"; + /// + /// A true/false value indicating whether the content dashboard should be visible for all user groups. + /// + public const string AllowContentDashboardAccessToAllUsers = "Umbraco.Core.AllowContentDashboardAccessToAllUsers"; + /// /// TODO: FILL ME IN /// diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 7fb27deb7e..eb6649a7c4 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -148,7 +148,6 @@ True Settings.settings - diff --git a/src/Umbraco.Web.UI/config/content.dashboard.access.config.js b/src/Umbraco.Web.UI/config/content.dashboard.access.config.js deleted file mode 100644 index 93c727d85a..0000000000 --- a/src/Umbraco.Web.UI/config/content.dashboard.access.config.js +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "Type": "grant", - "Value": "admin" - }, - { - "Type": "grant", - "Value": "editor" - }, - { - "Type": "grant", - "Value": "sensitiveData" - }, - { - "Type": "grant", - "Value": "translator" - }, - { - "Type": "grant", - "Value": "writer" - } -] diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index 03f462fb9e..ae141e5408 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -37,6 +37,7 @@ +