Merge branch 'temp8' into temp8-remove-unused-filesystem-config

# Conflicts:
#	src/Umbraco.Web.UI/web.Template.config
This commit is contained in:
Shannon
2019-01-30 16:58:57 +11:00
848 changed files with 4986 additions and 5899 deletions

View File

@@ -1,30 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AccessElement : RawXmlConfigurationElement, IAccess
{
public AccessElement()
{ }
public AccessElement(XElement rawXml)
: base(rawXml)
{ }
public IEnumerable<IAccessRule> Rules
{
get
{
var result = new List<AccessRule>();
if (RawXml == null) return result;
result.AddRange(RawXml.Elements("deny").Select(x => new AccessRule {Type = AccessRuleType.Deny, Value = x.Value }));
result.AddRange(RawXml.Elements("grant").Select(x => new AccessRule { Type = AccessRuleType.Grant, Value = x.Value }));
result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessRule { Type = AccessRuleType.GrantBySection, Value = x.Value }));
return result;
}
}
}
}

View File

@@ -1,14 +0,0 @@
namespace Umbraco.Core.Configuration.Dashboard
{
/// <summary>
/// Implements <see cref="IAccessRule"/>.
/// </summary>
internal class AccessRule : IAccessRule
{
/// <inheritdoc />
public AccessRuleType Type { get; set; }
/// <inheritdoc />
public string Value { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
namespace Umbraco.Core.Configuration.Dashboard
{
/// <summary>
/// Defines dashboard access rules type.
/// </summary>
public enum AccessRuleType
{
/// <summary>
/// Unknown (default value).
/// </summary>
Unknown = 0,
/// <summary>
/// Grant access to the dashboard if user belongs to the specified user group.
/// </summary>
Grant,
/// <summary>
/// Deny access to the dashboard if user belongs to the specified user group.
/// </summary>
Deny,
/// <summary>
/// Grant access to the dashboard if user has access to the specified section.
/// </summary>
GrantBySection
}
}

View File

@@ -1,32 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaCollection : ConfigurationElementCollection, IEnumerable<IArea>
{
protected override ConfigurationElement CreateNewElement()
{
return new AreaElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((AreaElement) element).Value;
}
IEnumerator<IArea> IEnumerable<IArea>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IArea;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -1,12 +0,0 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreaElement : InnerTextConfigurationElement<string>, IArea
{
string IArea.AreaName
{
get { return Value; }
}
}
}

View File

@@ -1,15 +0,0 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class AreasElement : ConfigurationElement
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "area")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public AreaCollection AreaCollection
{
get { return (AreaCollection)base[""]; }
set { base[""] = value; }
}
}
}

View File

@@ -1,37 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlCollection : ConfigurationElementCollection, IEnumerable<IDashboardControl>
{
internal void Add(ControlElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new ControlElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((ControlElement)element).ControlPath;
}
IEnumerator<IDashboardControl> IEnumerable<IDashboardControl>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardControl;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -1,44 +0,0 @@
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class ControlElement : RawXmlConfigurationElement, IDashboardControl
{
public string PanelCaption
{
get
{
var panelCaption = RawXml.Attribute("panelCaption");
return panelCaption == null ? "" : panelCaption.Value;
}
}
public AccessElement Access
{
get
{
var access = RawXml.Element("access");
return access == null ? new AccessElement() : new AccessElement(access);
}
}
public string ControlPath
{
get
{
//we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P )
var txt = RawXml.Nodes().OfType<XText>().FirstOrDefault();
if (txt == null)
{
throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path");
}
return txt.Value.Trim();
}
}
IAccess IDashboardControl.AccessRights => Access;
}
}

View File

@@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class DashboardSection : ConfigurationSection, IDashboardSection
{
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public SectionCollection SectionCollection
{
get { return (SectionCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<ISection> IDashboardSection.Sections
{
get { return SectionCollection; }
}
}
}

View File

@@ -1,9 +0,0 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IAccess
{
IEnumerable<IAccessRule> Rules { get; }
}
}

View File

@@ -1,18 +0,0 @@
namespace Umbraco.Core.Configuration.Dashboard
{
/// <summary>
/// Represents an access rule.
/// </summary>
public interface IAccessRule
{
/// <summary>
/// Gets or sets the rule type.
/// </summary>
AccessRuleType Type { get; set; }
/// <summary>
/// Gets or sets the value for the rule.
/// </summary>
string Value { get; set; }
}
}

View File

@@ -1,7 +0,0 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IArea
{
string AreaName { get; }
}
}

View File

@@ -1,11 +0,0 @@
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardControl
{
string PanelCaption { get; }
string ControlPath { get; }
IAccess AccessRights { get; }
}
}

View File

@@ -1,9 +0,0 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardSection
{
IEnumerable<ISection> Sections { get; }
}
}

View File

@@ -1,13 +0,0 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface IDashboardTab
{
string Caption { get; }
IEnumerable<IDashboardControl> Controls { get; }
IAccess AccessRights { get; }
}
}

View File

@@ -1,15 +0,0 @@
using System.Collections.Generic;
namespace Umbraco.Core.Configuration.Dashboard
{
public interface ISection
{
string Alias { get; }
IEnumerable<string> Areas { get; }
IEnumerable<IDashboardTab> Tabs { get; }
IAccess AccessRights { get; }
}
}

View File

@@ -1,37 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionCollection : ConfigurationElementCollection, IEnumerable<ISection>
{
internal void Add(SectionElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new SectionElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((SectionElement)element).Alias;
}
IEnumerator<ISection> IEnumerable<ISection>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as ISection;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -1,50 +0,0 @@
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class SectionElement : ConfigurationElement, ISection
{
[ConfigurationProperty("alias", IsRequired = true)]
public string Alias
{
get { return (string) this["alias"]; }
}
[ConfigurationProperty("areas", IsRequired = true)]
public AreasElement Areas
{
get { return (AreasElement)this["areas"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public TabCollection TabCollection
{
get { return (TabCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardTab> ISection.Tabs
{
get { return TabCollection; }
}
IEnumerable<string> ISection.Areas
{
get { return Areas.AreaCollection.Cast<AreaElement>().Select(x => x.Value); }
}
IAccess ISection.AccessRights
{
get { return Access; }
}
}
}

View File

@@ -1,37 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabCollection : ConfigurationElementCollection, IEnumerable<IDashboardTab>
{
internal void Add(TabElement c)
{
BaseAdd(c);
}
protected override ConfigurationElement CreateNewElement()
{
return new TabElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((TabElement)element).Caption;
}
IEnumerator<IDashboardTab> IEnumerable<IDashboardTab>.GetEnumerator()
{
for (var i = 0; i < Count; i++)
{
yield return BaseGet(i) as IDashboardTab;
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@@ -1,38 +0,0 @@
using System.Collections.Generic;
using System.Configuration;
namespace Umbraco.Core.Configuration.Dashboard
{
internal class TabElement : ConfigurationElement, IDashboardTab
{
[ConfigurationProperty("caption", IsRequired = true)]
public string Caption
{
get { return (string)this["caption"]; }
}
[ConfigurationProperty("access")]
public AccessElement Access
{
get { return (AccessElement)this["access"]; }
}
[ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")]
[ConfigurationProperty("", IsDefaultCollection = true)]
public ControlCollection ControlCollection
{
get { return (ControlCollection)base[""]; }
set { base[""] = value; }
}
IEnumerable<IDashboardControl> IDashboardTab.Controls
{
get { return ControlCollection; }
}
IAccess IDashboardTab.AccessRights
{
get { return Access; }
}
}
}

View File

@@ -31,8 +31,8 @@ namespace Umbraco.Core.Configuration
private static string _reservedPaths;
private static string _reservedUrls;
//ensure the built on (non-changeable) reserved paths are there at all times
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,";
internal const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,";
internal const string StaticReservedPaths = "~/app_plugins/,~/install/,"; //must end with a comma!
internal const string StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma!
#endregion
/// <summary>
@@ -82,19 +82,18 @@ namespace Umbraco.Core.Configuration
public string ReservedUrls
{
get
{
if (_reservedUrls == null)
{
var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
: string.Empty;
{
if (_reservedUrls != null) return _reservedUrls;
//ensure the built on (non-changeable) reserved paths are there at all times
_reservedUrls = StaticReservedUrls + urls;
}
var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls")
? ConfigurationManager.AppSettings["umbracoReservedUrls"]
: string.Empty;
//ensure the built on (non-changeable) reserved paths are there at all times
_reservedUrls = StaticReservedUrls + urls;
return _reservedUrls;
}
internal set { _reservedUrls = value; }
internal set => _reservedUrls = value;
}
/// <summary>
@@ -105,22 +104,20 @@ namespace Umbraco.Core.Configuration
{
get
{
if (_reservedPaths == null)
{
var reservedPaths = StaticReservedPaths;
//always add the umbraco path to the list
if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath")
&& !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace())
{
reservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(',');
}
if (_reservedPaths != null) return _reservedPaths;
var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
: string.Empty;
var reservedPaths = StaticReservedPaths;
var umbPath = ConfigurationManager.AppSettings.ContainsKey("umbracoPath") && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()
? ConfigurationManager.AppSettings["umbracoPath"]
: "~/umbraco";
//always add the umbraco path to the list
reservedPaths += umbPath.EnsureEndsWith(',');
_reservedPaths = reservedPaths + allPaths;
}
var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths")
? ConfigurationManager.AppSettings["umbracoReservedPaths"]
: string.Empty;
_reservedPaths = reservedPaths + allPaths;
return _reservedPaths;
}
}
@@ -260,26 +257,7 @@ namespace Umbraco.Core.Configuration
}
}
}
/// <summary>
/// Gets a value indicating whether umbraco uses directory urls.
/// </summary>
/// <value><c>true</c> if umbraco uses directory urls; otherwise, <c>false</c>.</value>
public bool UseDirectoryUrls
{
get
{
try
{
return bool.Parse(ConfigurationManager.AppSettings["umbracoUseDirectoryUrls"]);
}
catch
{
return false;
}
}
}
/// <summary>
/// Returns the number of days that should take place between version checks.
/// </summary>

View File

@@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration.Grid
{
List<GridEditor> GetResult()
{
// TODO should use the common one somehow! + ignoring _appPlugins here!
// TODO: should use the common one somehow! + ignoring _appPlugins here!
var parser = new ManifestParser(_appCaches, Current.ManifestValidators, _logger);
var editors = new List<GridEditor>();

View File

@@ -34,12 +34,6 @@ namespace Umbraco.Core.Configuration
/// </summary>
int TimeOutInMinutes { get; }
/// <summary>
/// Gets a value indicating whether umbraco uses directory urls.
/// </summary>
/// <value><c>true</c> if umbraco uses directory urls; otherwise, <c>false</c>.</value>
bool UseDirectoryUrls { get; }
/// <summary>
/// Gets the default UI language.
/// </summary>

View File

@@ -40,9 +40,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
[ConfigurationProperty("XmlContentCheckForDiskChanges")]
internal InnerTextConfigurationElement<bool> XmlContentCheckForDiskChanges => GetOptionalTextElement("XmlContentCheckForDiskChanges", false);
[ConfigurationProperty("EnableSplashWhileLoading")]
internal InnerTextConfigurationElement<bool> EnableSplashWhileLoading => GetOptionalTextElement("EnableSplashWhileLoading", false);
[ConfigurationProperty("PropertyContextHelpOption")]
internal InnerTextConfigurationElement<string> PropertyContextHelpOption => GetOptionalTextElement("PropertyContextHelpOption", "text");
@@ -110,8 +107,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
bool IContentSection.XmlContentCheckForDiskChanges => XmlContentCheckForDiskChanges;
bool IContentSection.EnableSplashWhileLoading => EnableSplashWhileLoading;
string IContentSection.PropertyContextHelpOption => PropertyContextHelpOption;
bool IContentSection.ForceSafeAliases => ForceSafeAliases;

View File

@@ -35,8 +35,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
bool XmlContentCheckForDiskChanges { get; }
bool EnableSplashWhileLoading { get; }
string PropertyContextHelpOption { get; }
bool ForceSafeAliases { get; }
@@ -67,4 +65,4 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string LoginBackgroundImage { get; }
}
}
}

View File

@@ -5,13 +5,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
internal class TourConfigElement : UmbracoConfigurationElement, ITourSection
{
//disabled by default so that upgraders don't get it enabled by default
//TODO: we probably just want to disable the initial one from automatically loading ?
// TODO: we probably just want to disable the initial one from automatically loading ?
[ConfigurationProperty("enable", DefaultValue = false)]
public bool EnableTours
{
get { return (bool)this["enable"]; }
}
//TODO: We could have additional filters, etc... defined here
// TODO: We could have additional filters, etc... defined here
}
}

View File

@@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration
/// <summary>
/// Gets the non-semantic version of the Umbraco code.
/// </summary>
// TODO rename to Version
// TODO: rename to Version
public static Version Current { get; }
/// <summary>
@@ -81,7 +81,7 @@ namespace Umbraco.Core.Configuration
{
try
{
// TODO - https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"];
return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null;
}