diff --git a/src/Umbraco.Core/Constants-AppSettings.cs b/src/Umbraco.Abstractions/Constants-AppSettings.cs similarity index 99% rename from src/Umbraco.Core/Constants-AppSettings.cs rename to src/Umbraco.Abstractions/Constants-AppSettings.cs index 509be46b61..c9725317f3 100644 --- a/src/Umbraco.Core/Constants-AppSettings.cs +++ b/src/Umbraco.Abstractions/Constants-AppSettings.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Specific web.config AppSetting keys for Umbraco.Core application diff --git a/src/Umbraco.Core/Constants-Applications.cs b/src/Umbraco.Abstractions/Constants-Applications.cs similarity index 99% rename from src/Umbraco.Core/Constants-Applications.cs rename to src/Umbraco.Abstractions/Constants-Applications.cs index cf4f80d87b..bb9f57a2a1 100644 --- a/src/Umbraco.Core/Constants-Applications.cs +++ b/src/Umbraco.Abstractions/Constants-Applications.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the alias identifiers for Umbraco's core application sections. diff --git a/src/Umbraco.Core/Constants-Composing.cs b/src/Umbraco.Abstractions/Constants-Composing.cs similarity index 84% rename from src/Umbraco.Core/Constants-Composing.cs rename to src/Umbraco.Abstractions/Constants-Composing.cs index e65629a278..c286fd0af6 100644 --- a/src/Umbraco.Core/Constants-Composing.cs +++ b/src/Umbraco.Abstractions/Constants-Composing.cs @@ -3,7 +3,7 @@ /// /// Defines constants. /// - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines constants for composition. diff --git a/src/Umbraco.Core/Constants-DataTypes.cs b/src/Umbraco.Abstractions/Constants-DataTypes.cs similarity index 99% rename from src/Umbraco.Core/Constants-DataTypes.cs rename to src/Umbraco.Abstractions/Constants-DataTypes.cs index 673da8f9a3..84c680f98a 100644 --- a/src/Umbraco.Core/Constants-DataTypes.cs +++ b/src/Umbraco.Abstractions/Constants-DataTypes.cs @@ -2,7 +2,7 @@ using System; namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { public static class DataTypes { @@ -42,7 +42,7 @@ namespace Umbraco.Core /// Defines the identifiers for Umbraco data types as constants for easy centralized access/management. /// public static class Guids - { + { /// /// Guid for Content Picker as string @@ -367,8 +367,8 @@ namespace Umbraco.Core /// Guid for Label decimal /// public static readonly Guid LabelDecimalGuid = new Guid(LabelDecimal); - - + + } } } diff --git a/src/Umbraco.Core/Constants-DatabaseProviders.cs b/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs similarity index 84% rename from src/Umbraco.Core/Constants-DatabaseProviders.cs rename to src/Umbraco.Abstractions/Constants-DatabaseProviders.cs index e93e524bbc..f8a25c28e6 100644 --- a/src/Umbraco.Core/Constants-DatabaseProviders.cs +++ b/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { public static class DatabaseProviders { diff --git a/src/Umbraco.Core/Constants-DeploySelector.cs b/src/Umbraco.Abstractions/Constants-DeploySelector.cs similarity index 91% rename from src/Umbraco.Core/Constants-DeploySelector.cs rename to src/Umbraco.Abstractions/Constants-DeploySelector.cs index f6f3f5fbae..6ab5d7e3c6 100644 --- a/src/Umbraco.Core/Constants-DeploySelector.cs +++ b/src/Umbraco.Abstractions/Constants-DeploySelector.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Contains the valid selector values. diff --git a/src/Umbraco.Core/Constants-Icons.cs b/src/Umbraco.Abstractions/Constants-Icons.cs similarity index 98% rename from src/Umbraco.Core/Constants-Icons.cs rename to src/Umbraco.Abstractions/Constants-Icons.cs index 05213ed1c4..7309292aef 100644 --- a/src/Umbraco.Core/Constants-Icons.cs +++ b/src/Umbraco.Abstractions/Constants-Icons.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { public static class Icons { diff --git a/src/Umbraco.Core/Constants-Indexes.cs b/src/Umbraco.Abstractions/Constants-Indexes.cs similarity index 92% rename from src/Umbraco.Core/Constants-Indexes.cs rename to src/Umbraco.Abstractions/Constants-Indexes.cs index 1add0f721b..b294bb5f3b 100644 --- a/src/Umbraco.Core/Constants-Indexes.cs +++ b/src/Umbraco.Abstractions/Constants-Indexes.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { public static class UmbracoIndexes { diff --git a/src/Umbraco.Core/Constants-ObjectTypes.cs b/src/Umbraco.Abstractions/Constants-ObjectTypes.cs similarity index 97% rename from src/Umbraco.Core/Constants-ObjectTypes.cs rename to src/Umbraco.Abstractions/Constants-ObjectTypes.cs index 9a6a1a0632..0ef51a7003 100644 --- a/src/Umbraco.Core/Constants-ObjectTypes.cs +++ b/src/Umbraco.Abstractions/Constants-ObjectTypes.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the Umbraco object type unique identifiers. @@ -69,7 +69,7 @@ namespace Umbraco.Core public const string IdReservation = "92849B1E-3904-4713-9356-F646F87C25F4"; [Obsolete("This no longer exists in the database")] - internal const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840"; + public const string Stylesheet = "9F68DA4F-A3A8-44C2-8226-DCBD125E4840"; // ReSharper restore MemberHidesStaticFromOuterClass } diff --git a/src/Umbraco.Core/Constants-PackageRepository.cs b/src/Umbraco.Abstractions/Constants-PackageRepository.cs similarity index 91% rename from src/Umbraco.Core/Constants-PackageRepository.cs rename to src/Umbraco.Abstractions/Constants-PackageRepository.cs index 42cf61f982..dbf7692ec0 100644 --- a/src/Umbraco.Core/Constants-PackageRepository.cs +++ b/src/Umbraco.Abstractions/Constants-PackageRepository.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the constants used for the Umbraco package repository diff --git a/src/Umbraco.Core/Constants-PropertyTypeGroups.cs b/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs similarity index 94% rename from src/Umbraco.Core/Constants-PropertyTypeGroups.cs rename to src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs index d3402e69f8..60b3a84233 100644 --- a/src/Umbraco.Core/Constants-PropertyTypeGroups.cs +++ b/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the identifiers for property-type groups conventions that are used within the Umbraco core. diff --git a/src/Umbraco.Core/Constants-Security.cs b/src/Umbraco.Abstractions/Constants-Security.cs similarity index 90% rename from src/Umbraco.Core/Constants-Security.cs rename to src/Umbraco.Abstractions/Constants-Security.cs index 27d6716000..b01ba83fa5 100644 --- a/src/Umbraco.Core/Constants-Security.cs +++ b/src/Umbraco.Abstractions/Constants-Security.cs @@ -1,9 +1,6 @@ -using System; -using System.ComponentModel; - -namespace Umbraco.Core +namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { public static class Security { @@ -37,8 +34,8 @@ namespace Umbraco.Core public const string BackOfficeTokenAuthenticationType = "UmbracoBackOfficeToken"; public const string BackOfficeTwoFactorAuthenticationType = "UmbracoTwoFactorCookie"; - internal const string EmptyPasswordPrefix = "___UIDEMPTYPWORD__"; - internal const string ForceReAuthFlag = "umbraco-force-auth"; + public const string EmptyPasswordPrefix = "___UIDEMPTYPWORD__"; + public const string ForceReAuthFlag = "umbraco-force-auth"; /// /// The prefix used for external identity providers for their authentication type diff --git a/src/Umbraco.Core/Constants-System.cs b/src/Umbraco.Abstractions/Constants-System.cs similarity index 98% rename from src/Umbraco.Core/Constants-System.cs rename to src/Umbraco.Abstractions/Constants-System.cs index abb92298f4..3b1db0be09 100644 --- a/src/Umbraco.Core/Constants-System.cs +++ b/src/Umbraco.Abstractions/Constants-System.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the identifiers for Umbraco system nodes. diff --git a/src/Umbraco.Core/Constants-Web.cs b/src/Umbraco.Abstractions/Constants-Web.cs similarity index 94% rename from src/Umbraco.Core/Constants-Web.cs rename to src/Umbraco.Abstractions/Constants-Web.cs index 64216ba571..eb55385838 100644 --- a/src/Umbraco.Core/Constants-Web.cs +++ b/src/Umbraco.Abstractions/Constants-Web.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class Constants + public static partial class ConstantsCore { /// /// Defines the identifiers for Umbraco system nodes. diff --git a/src/Umbraco.Core/Compose/AuditEventsComponent.cs b/src/Umbraco.Core/Compose/AuditEventsComponent.cs index 453fd6314a..8f78213107 100644 --- a/src/Umbraco.Core/Compose/AuditEventsComponent.cs +++ b/src/Umbraco.Core/Compose/AuditEventsComponent.cs @@ -44,7 +44,7 @@ namespace Umbraco.Core.Compose public void Terminate() { } - internal static IUser UnknownUser => new User { Id = Constants.Security.UnknownUserId, Name = Constants.Security.UnknownUserName, Email = "" }; + internal static IUser UnknownUser => new User { Id = ConstantsCore.Security.UnknownUserId, Name = ConstantsCore.Security.UnknownUserName, Email = "" }; private IUser CurrentPerformingUser { diff --git a/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs b/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs index 63a7e170da..d20191ad5d 100644 --- a/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs +++ b/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs @@ -26,8 +26,8 @@ namespace Umbraco.Core.Compose if (relationType == null) { - relationType = new RelationType(Constants.ObjectTypes.Document, - Constants.ObjectTypes.Document, + relationType = new RelationType(ConstantsCore.ObjectTypes.Document, + ConstantsCore.ObjectTypes.Document, Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, Constants.Conventions.RelationTypes.RelateDocumentOnCopyName) { IsBidirectional = true }; diff --git a/src/Umbraco.Core/Compose/RelateOnTrashComponent.cs b/src/Umbraco.Core/Compose/RelateOnTrashComponent.cs index 8371f9b279..2a0616eda3 100644 --- a/src/Umbraco.Core/Compose/RelateOnTrashComponent.cs +++ b/src/Umbraco.Core/Compose/RelateOnTrashComponent.cs @@ -22,7 +22,7 @@ namespace Umbraco.Core.Compose private static void ContentService_Moved(IContentService sender, MoveEventArgs e) { - foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.System.RecycleBinContentString))) + foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(ConstantsCore.System.RecycleBinContentString))) { var relationService = Current.Services.RelationService; const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias; @@ -37,7 +37,7 @@ namespace Umbraco.Core.Compose private static void MediaService_Moved(IMediaService sender, MoveEventArgs e) { - foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.System.RecycleBinMediaString))) + foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(ConstantsCore.System.RecycleBinMediaString))) { var relationService = Current.Services.RelationService; const string relationTypeAlias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias; @@ -60,7 +60,7 @@ namespace Umbraco.Core.Compose // check that the relation-type exists, if not, then recreate it if (relationType == null) { - var documentObjectType = Constants.ObjectTypes.Document; + var documentObjectType = ConstantsCore.ObjectTypes.Document; const string relationTypeName = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName; relationType = new RelationType(documentObjectType, documentObjectType, relationTypeAlias, relationTypeName); @@ -72,7 +72,7 @@ namespace Umbraco.Core.Compose var originalPath = item.OriginalPath.ToDelimitedList(); var originalParentId = originalPath.Count > 2 ? int.Parse(originalPath[originalPath.Count - 2]) - : Constants.System.Root; + : ConstantsCore.System.Root; //before we can create this relation, we need to ensure that the original parent still exists which //may not be the case if the encompassing transaction also deleted it when this item was moved to the bin @@ -104,7 +104,7 @@ namespace Umbraco.Core.Compose // check that the relation-type exists, if not, then recreate it if (relationType == null) { - var documentObjectType = Constants.ObjectTypes.Document; + var documentObjectType = ConstantsCore.ObjectTypes.Document; const string relationTypeName = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName; relationType = new RelationType(documentObjectType, documentObjectType, relationTypeAlias, relationTypeName); relationService.Save(relationType); @@ -114,7 +114,7 @@ namespace Umbraco.Core.Compose var originalPath = item.OriginalPath.ToDelimitedList(); var originalParentId = originalPath.Count > 2 ? int.Parse(originalPath[originalPath.Count - 2]) - : Constants.System.Root; + : ConstantsCore.System.Root; //before we can create this relation, we need to ensure that the original parent still exists which //may not be the case if the encompassing transaction also deleted it when this item was moved to the bin if (entityService.Exists(originalParentId)) diff --git a/src/Umbraco.Core/Composing/RegisterFactory.cs b/src/Umbraco.Core/Composing/RegisterFactory.cs index ea25d6a135..31b7dd9113 100644 --- a/src/Umbraco.Core/Composing/RegisterFactory.cs +++ b/src/Umbraco.Core/Composing/RegisterFactory.cs @@ -25,7 +25,7 @@ namespace Umbraco.Core.Composing { Type type; - var configuredTypeName = ConfigurationManager.AppSettings[Constants.AppSettings.RegisterType]; + var configuredTypeName = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.RegisterType]; if (configuredTypeName.IsNullOrWhiteSpace()) { // try to get the web LightInject container type, diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs index 5ad1e43580..97f7ad965c 100644 --- a/src/Umbraco.Core/Composing/TypeFinder.cs +++ b/src/Umbraco.Core/Composing/TypeFinder.cs @@ -32,7 +32,7 @@ namespace Umbraco.Core.Composing if (_assembliesAcceptingLoadExceptions != null) return _assembliesAcceptingLoadExceptions; - var s = ConfigurationManager.AppSettings[Constants.AppSettings.AssembliesAcceptingLoadExceptions]; + var s = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.AssembliesAcceptingLoadExceptions]; return _assembliesAcceptingLoadExceptions = string.IsNullOrWhiteSpace(s) ? Array.Empty() : s.Split(',').Select(x => x.Trim()).ToArray(); diff --git a/src/Umbraco.Core/Configuration/CoreDebug.cs b/src/Umbraco.Core/Configuration/CoreDebug.cs index b24e8a3329..9f8e8c4861 100644 --- a/src/Umbraco.Core/Configuration/CoreDebug.cs +++ b/src/Umbraco.Core/Configuration/CoreDebug.cs @@ -7,8 +7,8 @@ namespace Umbraco.Core.Configuration public CoreDebug() { var appSettings = System.Configuration.ConfigurationManager.AppSettings; - LogUncompletedScopes = string.Equals("true", appSettings[Constants.AppSettings.Debug.LogUncompletedScopes], StringComparison.OrdinalIgnoreCase); - DumpOnTimeoutThreadAbort = string.Equals("true", appSettings[Constants.AppSettings.Debug.DumpOnTimeoutThreadAbort], StringComparison.OrdinalIgnoreCase); + LogUncompletedScopes = string.Equals("true", appSettings[ConstantsCore.AppSettings.Debug.LogUncompletedScopes], StringComparison.OrdinalIgnoreCase); + DumpOnTimeoutThreadAbort = string.Equals("true", appSettings[ConstantsCore.AppSettings.Debug.DumpOnTimeoutThreadAbort], StringComparison.OrdinalIgnoreCase); } // when true, Scope logs the stack trace for any scope that gets disposed without being completed. diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index a888e3c42b..3cc9d05052 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -77,8 +77,8 @@ namespace Umbraco.Core.Configuration { if (_reservedUrls != null) return _reservedUrls; - var urls = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedUrls) - ? ConfigurationManager.AppSettings[Constants.AppSettings.ReservedUrls] + var urls = ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ReservedUrls) + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ReservedUrls] : string.Empty; //ensure the built on (non-changeable) reserved paths are there at all times @@ -99,14 +99,14 @@ namespace Umbraco.Core.Configuration if (_reservedPaths != null) return _reservedPaths; var reservedPaths = StaticReservedPaths; - var umbPath = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.Path) && !ConfigurationManager.AppSettings[Constants.AppSettings.Path].IsNullOrWhiteSpace() - ? ConfigurationManager.AppSettings[Constants.AppSettings.Path] + var umbPath = ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.Path) && !ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path].IsNullOrWhiteSpace() + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path] : "~/umbraco"; //always add the umbraco path to the list reservedPaths += umbPath.EnsureEndsWith(','); - var allPaths = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedPaths) - ? ConfigurationManager.AppSettings[Constants.AppSettings.ReservedPaths] + var allPaths = ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ReservedPaths) + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ReservedPaths] : string.Empty; _reservedPaths = reservedPaths + allPaths; @@ -125,8 +125,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ContentXML) - ? ConfigurationManager.AppSettings[Constants.AppSettings.ContentXML] + return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ContentXML) + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ContentXML] : "~/App_Data/umbraco.config"; } } @@ -139,8 +139,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.Path) - ? IOHelper.ResolveUrl(ConfigurationManager.AppSettings[Constants.AppSettings.Path]) + return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.Path) + ? IOHelper.ResolveUrl(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path]) : string.Empty; } } @@ -153,13 +153,13 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ConfigurationStatus) - ? ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus] + return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ConfigurationStatus) + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ConfigurationStatus] : string.Empty; } set { - SaveSetting(Constants.AppSettings.ConfigurationStatus, value); + SaveSetting(ConstantsCore.AppSettings.ConfigurationStatus, value); } } @@ -241,7 +241,7 @@ namespace Umbraco.Core.Configuration { try { - return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.TimeOutInMinutes]); + return int.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.TimeOutInMinutes]); } catch { @@ -260,7 +260,7 @@ namespace Umbraco.Core.Configuration { try { - return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.VersionCheckPeriod]); + return int.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.VersionCheckPeriod]); } catch { @@ -274,7 +274,7 @@ namespace Umbraco.Core.Configuration { get { - var setting = ConfigurationManager.AppSettings[Constants.AppSettings.LocalTempStorage]; + var setting = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.LocalTempStorage]; if (!string.IsNullOrWhiteSpace(setting)) return Enum.Parse(setting); @@ -333,8 +333,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.DefaultUILanguage) - ? ConfigurationManager.AppSettings[Constants.AppSettings.DefaultUILanguage] + return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.DefaultUILanguage) + ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.DefaultUILanguage] : string.Empty; } } @@ -351,7 +351,7 @@ namespace Umbraco.Core.Configuration { try { - return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.HideTopLevelNodeFromPath]); + return bool.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.HideTopLevelNodeFromPath]); } catch { @@ -369,7 +369,7 @@ namespace Umbraco.Core.Configuration { try { - return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.UseHttps]); + return bool.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.UseHttps]); } catch { diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 2f615d26b3..371e7e0516 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -82,7 +82,7 @@ namespace Umbraco.Core.Configuration try { // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings - var value = ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus]; + var value = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ConfigurationStatus]; return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null; } catch diff --git a/src/Umbraco.Core/Events/RecycleBinEventArgs.cs b/src/Umbraco.Core/Events/RecycleBinEventArgs.cs index be9a65cb0e..22265d8d7b 100644 --- a/src/Umbraco.Core/Events/RecycleBinEventArgs.cs +++ b/src/Umbraco.Core/Events/RecycleBinEventArgs.cs @@ -20,13 +20,13 @@ namespace Umbraco.Core.Events NodeObjectType = nodeObjectType; } - + /// /// Gets the Id of the node object type of the items /// being deleted from the Recycle Bin. /// public Guid NodeObjectType { get; } - + /// /// Boolean indicating whether the Recycle Bin was emptied successfully /// @@ -35,12 +35,12 @@ namespace Umbraco.Core.Events /// /// Boolean indicating whether this event was fired for the Content's Recycle Bin. /// - public bool IsContentRecycleBin => NodeObjectType == Constants.ObjectTypes.Document; + public bool IsContentRecycleBin => NodeObjectType == ConstantsCore.ObjectTypes.Document; /// /// Boolean indicating whether this event was fired for the Media's Recycle Bin. /// - public bool IsMediaRecycleBin => NodeObjectType == Constants.ObjectTypes.Media; + public bool IsMediaRecycleBin => NodeObjectType == ConstantsCore.ObjectTypes.Media; public bool Equals(RecycleBinEventArgs other) { diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index d86c682bd5..7a4f3efbcb 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -98,7 +98,7 @@ namespace Umbraco.Core.Migrations.Install var sql = scope.Database.SqlContext.Sql() .SelectCount() .From() - .Where(x => x.Id == Constants.Security.SuperUserId && x.Password == "default"); + .Where(x => x.Id == ConstantsCore.Security.SuperUserId && x.Password == "default"); var result = scope.Database.ExecuteScalar(sql); var has = result != 1; if (has == false) @@ -308,11 +308,11 @@ namespace Umbraco.Core.Migrations.Install } // create or update connection string - var setting = connectionStrings.Descendants("add").FirstOrDefault(s => s.Attribute("name")?.Value == Constants.System.UmbracoConnectionName); + var setting = connectionStrings.Descendants("add").FirstOrDefault(s => s.Attribute("name")?.Value == ConstantsCore.System.UmbracoConnectionName); if (setting == null) { connectionStrings.Add(new XElement("add", - new XAttribute("name", Constants.System.UmbracoConnectionName), + new XAttribute("name", ConstantsCore.System.UmbracoConnectionName), new XAttribute("connectionString", connectionString), new XAttribute("providerName", providerName))); } diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index 94d8cfbc62..bc85824abc 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -91,51 +91,51 @@ namespace Umbraco.Core.Migrations.Install SortOrder = sortOrder, UniqueId = new Guid(uniqueId), Text = text, - NodeObjectType = Constants.ObjectTypes.DataType, + NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }; _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, nodeDto); } - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = Constants.ObjectTypes.SystemRoot, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -20, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-20", SortOrder = 0, UniqueId = new Guid("0F582A79-1E41-4CF0-BFA0-76340651891A"), Text = "Recycle Bin", NodeObjectType = Constants.ObjectTypes.ContentRecycleBin, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = Constants.ObjectTypes.MediaRecycleBin, CreateDate = DateTime.Now }); - InsertDataTypeNodeDto(Constants.DataTypes.LabelString, 35, Constants.DataTypes.Guids.LabelString, "Label (string)"); - InsertDataTypeNodeDto(Constants.DataTypes.LabelInt, 36, Constants.DataTypes.Guids.LabelInt, "Label (integer)"); - InsertDataTypeNodeDto(Constants.DataTypes.LabelBigint, 36, Constants.DataTypes.Guids.LabelBigInt, "Label (bigint)"); - InsertDataTypeNodeDto(Constants.DataTypes.LabelDateTime, 37, Constants.DataTypes.Guids.LabelDateTime, "Label (datetime)"); - InsertDataTypeNodeDto(Constants.DataTypes.LabelTime, 38, Constants.DataTypes.Guids.LabelTime, "Label (time)"); - InsertDataTypeNodeDto(Constants.DataTypes.LabelDecimal, 39, Constants.DataTypes.Guids.LabelDecimal, "Label (decimal)"); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Upload, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Upload}", SortOrder = 34, UniqueId = Constants.DataTypes.Guids.UploadGuid, Text = "Upload", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Textarea, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Textarea}", SortOrder = 33, UniqueId = Constants.DataTypes.Guids.TextareaGuid, Text = "Textarea", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Textbox, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Textbox}", SortOrder = 32, UniqueId = Constants.DataTypes.Guids.TextstringGuid, Text = "Textstring", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.RichtextEditor, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.RichtextEditor}", SortOrder = 4, UniqueId = Constants.DataTypes.Guids.RichtextEditorGuid, Text = "Richtext editor", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.NumericGuid, Text = "Numeric", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Boolean, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Boolean}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.CheckboxGuid, Text = "True/false", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.CheckboxListGuid, Text = "Checkbox list", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownSingle, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownSingle}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DropdownGuid, Text = "Dropdown", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DatePickerGuid, Text = "Date Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.RadioboxGuid, Text = "Radiobox", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DropDownMultiple, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DropDownMultiple}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DropdownMultipleGuid, Text = "Dropdown multiple", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ApprovedColorGuid, Text = "Approved Color", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DateTime, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DateTime}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.DatePickerWithTimeGuid, Text = "Date Picker with time", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultContentListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewContentGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMediaListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewMediaGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.DefaultMembersListView}", SortOrder = 2, UniqueId = Constants.DataTypes.Guids.ListViewMembersGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1031, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1031", SortOrder = 2, UniqueId = new Guid("f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d"), Text = Constants.Conventions.MediaTypes.Folder, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1032, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1032", SortOrder = 2, UniqueId = new Guid("cc07b313-0843-4aa8-bbda-871c8da728c8"), Text = Constants.Conventions.MediaTypes.Image, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1033, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1033", SortOrder = 2, UniqueId = new Guid("4c52d8ab-54e6-40cd-999c-7a5f24903e4d"), Text = Constants.Conventions.MediaTypes.File, NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.Tags, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.Tags}", SortOrder = 2, UniqueId = new Guid("b6b73142-b9c1-4bf8-a16d-e1c23320b549"), Text = "Tags", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = Constants.DataTypes.ImageCropper, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{Constants.DataTypes.ImageCropper}", SortOrder = 2, UniqueId = new Guid("1df9f033-e6d4-451f-b8d2-e0cbc50a836f"), Text = "Image Cropper", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1044, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = new Guid("d59be02f-1df9-4228-aa1e-01917d806cda"), Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = Constants.ObjectTypes.MemberType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = ConstantsCore.ObjectTypes.SystemRoot, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -20, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-20", SortOrder = 0, UniqueId = new Guid("0F582A79-1E41-4CF0-BFA0-76340651891A"), Text = "Recycle Bin", NodeObjectType = ConstantsCore.ObjectTypes.ContentRecycleBin, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -21, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,-21", SortOrder = 0, UniqueId = new Guid("BF7C7CBC-952F-4518-97A2-69E9C7B33842"), Text = "Recycle Bin", NodeObjectType = ConstantsCore.ObjectTypes.MediaRecycleBin, CreateDate = DateTime.Now }); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelString, 35, ConstantsCore.DataTypes.Guids.LabelString, "Label (string)"); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelInt, 36, ConstantsCore.DataTypes.Guids.LabelInt, "Label (integer)"); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelBigint, 36, ConstantsCore.DataTypes.Guids.LabelBigInt, "Label (bigint)"); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelDateTime, 37, ConstantsCore.DataTypes.Guids.LabelDateTime, "Label (datetime)"); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelTime, 38, ConstantsCore.DataTypes.Guids.LabelTime, "Label (time)"); + InsertDataTypeNodeDto(ConstantsCore.DataTypes.LabelDecimal, 39, ConstantsCore.DataTypes.Guids.LabelDecimal, "Label (decimal)"); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.Upload, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.Upload}", SortOrder = 34, UniqueId = ConstantsCore.DataTypes.Guids.UploadGuid, Text = "Upload", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.Textarea, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.Textarea}", SortOrder = 33, UniqueId = ConstantsCore.DataTypes.Guids.TextareaGuid, Text = "Textarea", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.Textbox, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.Textbox}", SortOrder = 32, UniqueId = ConstantsCore.DataTypes.Guids.TextstringGuid, Text = "Textstring", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.RichtextEditor, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.RichtextEditor}", SortOrder = 4, UniqueId = ConstantsCore.DataTypes.Guids.RichtextEditorGuid, Text = "Richtext editor", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -51, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.NumericGuid, Text = "Numeric", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.Boolean, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.Boolean}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.CheckboxGuid, Text = "True/false", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -43, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.CheckboxListGuid, Text = "Checkbox list", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DropDownSingle, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DropDownSingle}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.DropdownGuid, Text = "Dropdown", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -41, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.DatePickerGuid, Text = "Date Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -40, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.RadioboxGuid, Text = "Radiobox", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DropDownMultiple, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DropDownMultiple}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.DropdownMultipleGuid, Text = "Dropdown multiple", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -37, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.ApprovedColorGuid, Text = "Approved Color", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DateTime, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DateTime}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.DatePickerWithTimeGuid, Text = "Date Picker with time", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DefaultContentListView}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.ListViewContentGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DefaultMediaListView}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.ListViewMediaGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.DefaultMembersListView}", SortOrder = 2, UniqueId = ConstantsCore.DataTypes.Guids.ListViewMembersGuid, Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1031, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1031", SortOrder = 2, UniqueId = new Guid("f38bd2d7-65d0-48e6-95dc-87ce06ec2d3d"), Text = Constants.Conventions.MediaTypes.Folder, NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1032, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1032", SortOrder = 2, UniqueId = new Guid("cc07b313-0843-4aa8-bbda-871c8da728c8"), Text = Constants.Conventions.MediaTypes.Image, NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1033, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1033", SortOrder = 2, UniqueId = new Guid("4c52d8ab-54e6-40cd-999c-7a5f24903e4d"), Text = Constants.Conventions.MediaTypes.File, NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.Tags, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.Tags}", SortOrder = 2, UniqueId = new Guid("b6b73142-b9c1-4bf8-a16d-e1c23320b549"), Text = "Tags", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = ConstantsCore.DataTypes.ImageCropper, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = $"-1,{ConstantsCore.DataTypes.ImageCropper}", SortOrder = 2, UniqueId = new Guid("1df9f033-e6d4-451f-b8d2-e0cbc50a836f"), Text = "Image Cropper", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1044, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = new Guid("d59be02f-1df9-4228-aa1e-01917d806cda"), Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = ConstantsCore.ObjectTypes.MemberType, CreateDate = DateTime.Now }); //New UDI pickers with newer Ids - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1046, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1046", SortOrder = 2, UniqueId = new Guid("FD1E0DA5-5606-4862-B679-5D0CF3A52A59"), Text = "Content Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = new Guid("1EA2E01F-EBD8-4CE1-8D71-6B1149E63548"), Text = "Member Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = new Guid("135D60E0-64D9-49ED-AB08-893C9BA44AE5"), Text = "Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = new Guid("9DBBCBBB-2327-434A-B355-AF1B84E5010A"), Text = "Multiple Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Multi URL Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1046, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1046", SortOrder = 2, UniqueId = new Guid("FD1E0DA5-5606-4862-B679-5D0CF3A52A59"), Text = "Content Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = new Guid("1EA2E01F-EBD8-4CE1-8D71-6B1149E63548"), Text = "Member Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = new Guid("135D60E0-64D9-49ED-AB08-893C9BA44AE5"), Text = "Media Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = new Guid("9DBBCBBB-2327-434A-B355-AF1B84E5010A"), Text = "Multiple Media Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Multi URL Picker", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); } private void CreateLockData() @@ -155,80 +155,80 @@ namespace Umbraco.Core.Migrations.Install private void CreateContentTypeData() { - _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = Constants.Icons.MediaFolder, Thumbnail = Constants.Icons.MediaFolder, IsContainer = false, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = Constants.Icons.MediaImage, Thumbnail = Constants.Icons.MediaImage, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = Constants.Icons.MediaFile, Thumbnail = Constants.Icons.MediaFile, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = Constants.Icons.Member, Thumbnail = Constants.Icons.Member, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 532, NodeId = 1031, Alias = Constants.Conventions.MediaTypes.Folder, Icon = ConstantsCore.Icons.MediaFolder, Thumbnail = ConstantsCore.Icons.MediaFolder, IsContainer = false, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 533, NodeId = 1032, Alias = Constants.Conventions.MediaTypes.Image, Icon = ConstantsCore.Icons.MediaImage, Thumbnail = ConstantsCore.Icons.MediaImage, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 534, NodeId = 1033, Alias = Constants.Conventions.MediaTypes.File, Icon = ConstantsCore.Icons.MediaFile, Thumbnail = ConstantsCore.Icons.MediaFile, AllowAtRoot = true, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.ContentType, "pk", false, new ContentTypeDto { PrimaryKey = 531, NodeId = 1044, Alias = Constants.Conventions.MemberTypes.DefaultAlias, Icon = ConstantsCore.Icons.Member, Thumbnail = ConstantsCore.Icons.Member, Variations = (byte) ContentVariation.Nothing }); } private void CreateUserData() { - _database.Insert(Constants.DatabaseSchema.Tables.User, "id", false, new UserDto { Id = Constants.Security.SuperUserId, Disabled = false, NoConsole = false, UserName = "Administrator", Login = "admin", Password = "default", Email = "", UserLanguage = "en-US", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.User, "id", false, new UserDto { Id = ConstantsCore.Security.SuperUserId, Disabled = false, NoConsole = false, UserName = "Administrator", Login = "admin", Password = "default", Email = "", UserLanguage = "en-US", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); } private void CreateUserGroupData() { - _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 1, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.AdminGroupAlias, Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7ï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-medal" }); + _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 1, StartMediaId = -1, StartContentId = -1, Alias = ConstantsCore.Security.AdminGroupAlias, Name = "Administrators", DefaultPermissions = "CADMOSKTPIURZ:5F7ï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-medal" }); _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 2, StartMediaId = -1, StartContentId = -1, Alias = "writer", Name = "Writers", DefaultPermissions = "CAH:F", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-edit" }); _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 3, StartMediaId = -1, StartContentId = -1, Alias = "editor", Name = "Editors", DefaultPermissions = "CADMOSKTPUZ:5Fï", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-tools" }); - _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 4, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.TranslatorGroupAlias, Name = "Translators", DefaultPermissions = "AF", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-globe" }); - _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 5, StartMediaId = -1, StartContentId = -1, Alias = Constants.Security.SensitiveDataGroupAlias, Name = "Sensitive data", DefaultPermissions = "", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-lock" }); + _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 4, StartMediaId = -1, StartContentId = -1, Alias = ConstantsCore.Security.TranslatorGroupAlias, Name = "Translators", DefaultPermissions = "AF", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-globe" }); + _database.Insert(Constants.DatabaseSchema.Tables.UserGroup, "id", false, new UserGroupDto { Id = 5, StartMediaId = -1, StartContentId = -1, Alias = ConstantsCore.Security.SensitiveDataGroupAlias, Name = "Sensitive data", DefaultPermissions = "", CreateDate = DateTime.Now, UpdateDate = DateTime.Now, Icon = "icon-lock" }); } private void CreateUser2UserGroupData() { - _database.Insert(new User2UserGroupDto { UserGroupId = 1, UserId = Constants.Security.SuperUserId }); // add super to admins - _database.Insert(new User2UserGroupDto { UserGroupId = 5, UserId = Constants.Security.SuperUserId }); // add super to sensitive data + _database.Insert(new User2UserGroupDto { UserGroupId = 1, UserId = ConstantsCore.Security.SuperUserId }); // add super to admins + _database.Insert(new User2UserGroupDto { UserGroupId = 5, UserId = ConstantsCore.Security.SuperUserId }); // add super to sensitive data } private void CreateUserGroup2AppData() { - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Content }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Packages }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Media }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Members }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Settings }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Users }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Forms }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = Constants.Applications.Translation }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Content }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Packages }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Media }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Members }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Settings }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Users }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Forms }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 1, AppAlias = ConstantsCore.Applications.Translation }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = ConstantsCore.Applications.Content }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Content }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Media }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = Constants.Applications.Forms }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = ConstantsCore.Applications.Content }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = ConstantsCore.Applications.Media }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 3, AppAlias = ConstantsCore.Applications.Forms }); - _database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.Applications.Translation }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = ConstantsCore.Applications.Translation }); } private void CreatePropertyTypeGroupData() { - _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 3, ContentTypeNodeId = 1032, Text = "Image", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Image) }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 4, ContentTypeNodeId = 1033, Text = "File", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.File) }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 3, ContentTypeNodeId = 1032, Text = "Image", SortOrder = 1, UniqueId = new Guid(ConstantsCore.PropertyTypeGroups.Image) }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 4, ContentTypeNodeId = 1033, Text = "File", SortOrder = 1, UniqueId = new Guid(ConstantsCore.PropertyTypeGroups.File) }); //membership property group - _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership) }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(ConstantsCore.PropertyTypeGroups.Membership) }); } private void CreatePropertyTypeData() { - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = Constants.DataTypes.ImageCropper, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 7, UniqueId = 7.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Width, Name = "Width", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 8, UniqueId = 8.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Height, Name = "Height", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 9, UniqueId = 9.ToGuid(), DataTypeId = Constants.DataTypes.LabelBigint, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 6, UniqueId = 6.ToGuid(), DataTypeId = ConstantsCore.DataTypes.ImageCropper, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.File, Name = "Upload image", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 7, UniqueId = 7.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Width, Name = "Width", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 8, UniqueId = 8.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelInt, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Height, Name = "Height", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in pixels", Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 9, UniqueId = 9.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelBigint, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing }); _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 10, UniqueId = 10.ToGuid(), DataTypeId = -92, ContentTypeId = 1032, PropertyTypeGroupId = 3, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = Constants.DataTypes.Upload, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 24, UniqueId = 24.ToGuid(), DataTypeId = ConstantsCore.DataTypes.Upload, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.File, Name = "Upload file", SortOrder = 0, Mandatory = true, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 25, UniqueId = 25.ToGuid(), DataTypeId = -92, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Extension, Name = "Type", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 26, UniqueId = 26.ToGuid(), DataTypeId = Constants.DataTypes.LabelBigint, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 26, UniqueId = 26.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelBigint, ContentTypeId = 1033, PropertyTypeGroupId = 4, Alias = Constants.Conventions.Media.Bytes, Name = "Size", SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = "in bytes", Variations = (byte) ContentVariation.Nothing }); //membership property types - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = Constants.DataTypes.Textarea, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 29, UniqueId = 29.ToGuid(), DataTypeId = Constants.DataTypes.LabelInt, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.FailedPasswordAttempts, Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel, SortOrder = 1, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = Constants.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = Constants.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 32, UniqueId = 32.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLockoutDate, Name = Constants.Conventions.Member.LastLockoutDateLabel, SortOrder = 4, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 33, UniqueId = 33.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLoginDate, Name = Constants.Conventions.Member.LastLoginDateLabel, SortOrder = 5, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 34, UniqueId = 34.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastPasswordChangeDate, Name = Constants.Conventions.Member.LastPasswordChangeDateLabel, SortOrder = 6, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 35, UniqueId = 35.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.PasswordQuestion, Name = Constants.Conventions.Member.PasswordQuestionLabel, SortOrder = 7, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte)ContentVariation.Nothing }); - _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 36, UniqueId = 36.ToGuid(), DataTypeId = Constants.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.PasswordAnswer, Name = Constants.Conventions.Member.PasswordAnswerLabel, SortOrder = 8, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte)ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 28, UniqueId = 28.ToGuid(), DataTypeId = ConstantsCore.DataTypes.Textarea, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.Comments, Name = Constants.Conventions.Member.CommentsLabel, SortOrder = 0, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 29, UniqueId = 29.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelInt, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.FailedPasswordAttempts, Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel, SortOrder = 1, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 30, UniqueId = 30.ToGuid(), DataTypeId = ConstantsCore.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsApproved, Name = Constants.Conventions.Member.IsApprovedLabel, SortOrder = 2, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 31, UniqueId = 31.ToGuid(), DataTypeId = ConstantsCore.DataTypes.Boolean, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.IsLockedOut, Name = Constants.Conventions.Member.IsLockedOutLabel, SortOrder = 3, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 32, UniqueId = 32.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLockoutDate, Name = Constants.Conventions.Member.LastLockoutDateLabel, SortOrder = 4, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 33, UniqueId = 33.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastLoginDate, Name = Constants.Conventions.Member.LastLoginDateLabel, SortOrder = 5, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 34, UniqueId = 34.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.LastPasswordChangeDate, Name = Constants.Conventions.Member.LastPasswordChangeDateLabel, SortOrder = 6, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte) ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 35, UniqueId = 35.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.PasswordQuestion, Name = Constants.Conventions.Member.PasswordQuestionLabel, SortOrder = 7, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte)ContentVariation.Nothing }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyType, "id", false, new PropertyTypeDto { Id = 36, UniqueId = 36.ToGuid(), DataTypeId = ConstantsCore.DataTypes.LabelDateTime, ContentTypeId = 1044, PropertyTypeGroupId = 11, Alias = Constants.Conventions.Member.PasswordAnswer, Name = Constants.Conventions.Member.PasswordAnswerLabel, SortOrder = 8, Mandatory = false, ValidationRegExp = null, Description = null, Variations = (byte)ContentVariation.Nothing }); } @@ -267,35 +267,35 @@ namespace Umbraco.Core.Migrations.Install const string layouts = "[" + cardLayout + "," + listLayout + "]"; // TODO: Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors. - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Boolean, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.Boolean, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -51, EditorAlias = Constants.PropertyEditors.Aliases.Integer, DbType = "Integer" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -87, EditorAlias = Constants.PropertyEditors.Aliases.TinyMce, DbType = "Ntext", Configuration = "{\"value\":\",code,undo,redo,cut,copy,mcepasteword,stylepicker,bold,italic,bullist,numlist,outdent,indent,mcelink,unlink,mceinsertanchor,mceimage,umbracomacro,mceinserttable,umbracoembed,mcecharmap,|1|1,2,3,|0|500,400|1049,|true|\"}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Textbox, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Textarea, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Upload, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" }); - InsertDataTypeDto(Constants.DataTypes.LabelString, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.Label, "Integer", "{\"umbracoDataValueType\":\"INT\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.Label, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"TIME\"}"); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DateTime, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.Textbox, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.Textarea, EditorAlias = Constants.PropertyEditors.Aliases.TextArea, DbType = "Ntext" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.Upload, EditorAlias = Constants.PropertyEditors.Aliases.UploadField, DbType = "Nvarchar" }); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelString, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"STRING\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelInt, Constants.PropertyEditors.Aliases.Label, "Integer", "{\"umbracoDataValueType\":\"INT\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelBigint, Constants.PropertyEditors.Aliases.Label, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelDateTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelDecimal, Constants.PropertyEditors.Aliases.Label, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelTime, Constants.PropertyEditors.Aliases.Label, "Date", "{\"umbracoDataValueType\":\"TIME\"}"); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.DateTime, EditorAlias = Constants.PropertyEditors.Aliases.DateTime, DbType = "Date" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -37, EditorAlias = Constants.PropertyEditors.Aliases.ColorPicker, DbType = "Nvarchar" }); - InsertDataTypeDto(Constants.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}"); + InsertDataTypeDto(ConstantsCore.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}"); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -40, EditorAlias = Constants.PropertyEditors.Aliases.RadioButtonList, DbType = "Nvarchar" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -41, EditorAlias = "Umbraco.DateTime", DbType = "Date", Configuration = "{\"format\":\"YYYY-MM-DD\"}" }); - InsertDataTypeDto(Constants.DataTypes.DropDownMultiple, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":true}"); + InsertDataTypeDto(ConstantsCore.DataTypes.DropDownMultiple, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":true}"); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -43, EditorAlias = Constants.PropertyEditors.Aliases.CheckBoxList, DbType = "Nvarchar" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.Tags, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.Tags, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext", Configuration = "{\"group\":\"default\", \"storageType\":\"Json\"}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.ImageCropper, EditorAlias = Constants.PropertyEditors.Aliases.ImageCropper, DbType = "Ntext" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DefaultContentListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.ImageCropper, EditorAlias = Constants.PropertyEditors.Aliases.ImageCropper, DbType = "Ntext" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.DefaultContentListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", Configuration = "{\"pageSize\":100, \"orderBy\":\"updateDate\", \"orderDirection\":\"desc\", \"layouts\":" + layouts + ", \"includeProperties\":[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DefaultMediaListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.DefaultMediaListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", Configuration = "{\"pageSize\":100, \"orderBy\":\"updateDate\", \"orderDirection\":\"desc\", \"layouts\":" + layouts + ", \"includeProperties\":[{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1},{\"alias\":\"owner\",\"header\":\"Updated by\",\"isSystem\":1}]}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.DataTypes.DefaultMembersListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = ConstantsCore.DataTypes.DefaultMembersListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", Configuration = "{\"pageSize\":10, \"orderBy\":\"username\", \"orderDirection\":\"asc\", \"includeProperties\":[{\"alias\":\"username\",\"isSystem\":1},{\"alias\":\"email\",\"isSystem\":1},{\"alias\":\"updateDate\",\"header\":\"Last edited\",\"isSystem\":1}]}" }); //New UDI pickers with newer Ids @@ -309,13 +309,13 @@ namespace Umbraco.Core.Migrations.Install private void CreateRelationTypeData() { - var relationType = new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = Constants.ObjectTypes.Document, ParentObjectType = Constants.ObjectTypes.Document, Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName }; + var relationType = new RelationTypeDto { Id = 1, Alias = Constants.Conventions.RelationTypes.RelateDocumentOnCopyAlias, ChildObjectType = ConstantsCore.ObjectTypes.Document, ParentObjectType = ConstantsCore.ObjectTypes.Document, Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName }; relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid(); _database.Insert(Constants.DatabaseSchema.Tables.RelationType, "id", false, relationType); - relationType = new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = Constants.ObjectTypes.Document, ParentObjectType = Constants.ObjectTypes.Document, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName }; + relationType = new RelationTypeDto { Id = 2, Alias = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteAlias, ChildObjectType = ConstantsCore.ObjectTypes.Document, ParentObjectType = ConstantsCore.ObjectTypes.Document, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName }; relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid(); _database.Insert(Constants.DatabaseSchema.Tables.RelationType, "id", false, relationType); - relationType = new RelationTypeDto { Id = 3, Alias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias, ChildObjectType = Constants.ObjectTypes.Media, ParentObjectType = Constants.ObjectTypes.Media, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName }; + relationType = new RelationTypeDto { Id = 3, Alias = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteAlias, ChildObjectType = ConstantsCore.ObjectTypes.Media, ParentObjectType = ConstantsCore.ObjectTypes.Media, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName }; relationType.UniqueId = (relationType.Alias + "____" + relationType.Name).ToGuid(); _database.Insert(Constants.DatabaseSchema.Tables.RelationType, "id", false, relationType); } diff --git a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs index e8fd3414ec..3eeaa28f1e 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Migrations.Upgrade /// Initializes a new instance of the class. /// public UmbracoPlan() - : base(Constants.System.UmbracoUpgradePlanName) + : base(ConstantsCore.System.UmbracoUpgradePlanName) { DefinePlan(); } @@ -61,8 +61,8 @@ namespace Umbraco.Core.Migrations.Upgrade get { // no state in database yet - assume we have something in web.config that makes some sense - if (!SemVersion.TryParse(ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus], out var currentVersion)) - throw new InvalidOperationException($"Could not get current version from web.config {Constants.AppSettings.ConfigurationStatus} appSetting."); + if (!SemVersion.TryParse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ConfigurationStatus], out var currentVersion)) + throw new InvalidOperationException($"Could not get current version from web.config {ConstantsCore.AppSettings.ConfigurationStatus} appSetting."); // cannot go back in time if (currentVersion > UmbracoVersion.SemanticVersion) diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs index 309f8acbc3..d3dbf66b44 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddTypedLabels.cs @@ -30,7 +30,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 SortOrder = sortOrder, UniqueId = new Guid(uniqueId), Text = text, - NodeObjectType = Constants.ObjectTypes.DataType, + NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }; @@ -40,11 +40,11 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 if (SqlSyntax.SupportsIdentityInsert()) Database.Execute(new Sql($"SET IDENTITY_INSERT {SqlSyntax.GetQuotedTableName(Constants.DatabaseSchema.Tables.Node)} ON ")); - InsertNodeDto(Constants.DataTypes.LabelInt, 36, "8e7f995c-bd81-4627-9932-c40e568ec788", "Label (integer)"); - InsertNodeDto(Constants.DataTypes.LabelBigint, 36, "930861bf-e262-4ead-a704-f99453565708", "Label (bigint)"); - InsertNodeDto(Constants.DataTypes.LabelDateTime, 37, "0e9794eb-f9b5-4f20-a788-93acd233a7e4", "Label (datetime)"); - InsertNodeDto(Constants.DataTypes.LabelTime, 38, "a97cec69-9b71-4c30-8b12-ec398860d7e8", "Label (time)"); - InsertNodeDto(Constants.DataTypes.LabelDecimal, 39, "8f1ef1e1-9de4-40d3-a072-6673f631ca64", "Label (decimal)"); + InsertNodeDto(ConstantsCore.DataTypes.LabelInt, 36, "8e7f995c-bd81-4627-9932-c40e568ec788", "Label (integer)"); + InsertNodeDto(ConstantsCore.DataTypes.LabelBigint, 36, "930861bf-e262-4ead-a704-f99453565708", "Label (bigint)"); + InsertNodeDto(ConstantsCore.DataTypes.LabelDateTime, 37, "0e9794eb-f9b5-4f20-a788-93acd233a7e4", "Label (datetime)"); + InsertNodeDto(ConstantsCore.DataTypes.LabelTime, 38, "a97cec69-9b71-4c30-8b12-ec398860d7e8", "Label (time)"); + InsertNodeDto(ConstantsCore.DataTypes.LabelDecimal, 39, "8f1ef1e1-9de4-40d3-a072-6673f631ca64", "Label (decimal)"); if (SqlSyntax.SupportsIdentityInsert()) Database.Execute(new Sql($"SET IDENTITY_INSERT {SqlSyntax.GetQuotedTableName(Constants.DatabaseSchema.Tables.Node)} OFF ")); @@ -64,18 +64,18 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, dataTypeDto); } - InsertDataTypeDto(Constants.DataTypes.LabelInt, "Integer", "{\"umbracoDataValueType\":\"INT\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelBigint, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelDateTime, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelDecimal, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}"); - InsertDataTypeDto(Constants.DataTypes.LabelTime, "Date", "{\"umbracoDataValueType\":\"TIME\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelInt, "Integer", "{\"umbracoDataValueType\":\"INT\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelBigint, "Nvarchar", "{\"umbracoDataValueType\":\"BIGINT\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelDateTime, "Date", "{\"umbracoDataValueType\":\"DATETIME\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelDecimal, "Decimal", "{\"umbracoDataValueType\":\"DECIMAL\"}"); + InsertDataTypeDto(ConstantsCore.DataTypes.LabelTime, "Date", "{\"umbracoDataValueType\":\"TIME\"}"); // flip known property types var labelPropertyTypes = Database.Fetch(Sql() .Select(x => x.Id, x => x.Alias) .From() - .Where(x => x.DataTypeId == Constants.DataTypes.LabelString) + .Where(x => x.DataTypeId == ConstantsCore.DataTypes.LabelString) ); var intPropertyAliases = new[] { Constants.Conventions.Media.Width, Constants.Conventions.Media.Height, Constants.Conventions.Member.FailedPasswordAttempts }; @@ -86,10 +86,10 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 var bigintPropertyTypes = labelPropertyTypes.Where(pt => bigintPropertyAliases.Contains(pt.Alias)).Select(pt => pt.Id).ToArray(); var dtPropertyTypes = labelPropertyTypes.Where(pt => dtPropertyAliases.Contains(pt.Alias)).Select(pt => pt.Id).ToArray(); - Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, Constants.DataTypes.LabelInt)).WhereIn(x => x.Id, intPropertyTypes)); - Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, Constants.DataTypes.LabelInt)).WhereIn(x => x.Id, intPropertyTypes)); - Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, Constants.DataTypes.LabelBigint)).WhereIn(x => x.Id, bigintPropertyTypes)); - Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, Constants.DataTypes.LabelDateTime)).WhereIn(x => x.Id, dtPropertyTypes)); + Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, ConstantsCore.DataTypes.LabelInt)).WhereIn(x => x.Id, intPropertyTypes)); + Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, ConstantsCore.DataTypes.LabelInt)).WhereIn(x => x.Id, intPropertyTypes)); + Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, ConstantsCore.DataTypes.LabelBigint)).WhereIn(x => x.Id, bigintPropertyTypes)); + Database.Execute(Sql().Update(u => u.Set(x => x.DataTypeId, ConstantsCore.DataTypes.LabelDateTime)).WhereIn(x => x.Id, dtPropertyTypes)); // update values for known property types // depending on the size of the site, that *may* take time diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RenameMediaVersionTable.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RenameMediaVersionTable.cs index b60923fcba..643550f2a3 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RenameMediaVersionTable.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/RenameMediaVersionTable.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 var temp2 = Database.Fetch($@"SELECT v.versionId, v.id FROM cmsContentVersion v JOIN umbracoNode n on v.contentId=n.id -WHERE n.nodeObjectType='{Constants.ObjectTypes.Media}'"); +WHERE n.nodeObjectType='{ConstantsCore.ObjectTypes.Media}'"); foreach (var t in temp2) Execute.Sql($"UPDATE {Constants.DatabaseSchema.Tables.MediaVersion} SET id={t.id} WHERE versionId='{t.versionId}'").Do(); diff --git a/src/Umbraco.Core/Models/DataTypeExtensions.cs b/src/Umbraco.Core/Models/DataTypeExtensions.cs index f460edbde7..84e9932ef2 100644 --- a/src/Umbraco.Core/Models/DataTypeExtensions.cs +++ b/src/Umbraco.Core/Models/DataTypeExtensions.cs @@ -35,39 +35,39 @@ namespace Umbraco.Core.Models throw new InvalidCastException($"Cannot cast dataType configuration, of type {configuration.GetType().Name}, to {typeof(T).Name}."); } - + private static readonly ISet IdsOfBuildInDataTypes = new HashSet() { - Constants.DataTypes.Guids.ContentPickerGuid, - Constants.DataTypes.Guids.MemberPickerGuid, - Constants.DataTypes.Guids.MediaPickerGuid, - Constants.DataTypes.Guids.MultipleMediaPickerGuid, - Constants.DataTypes.Guids.RelatedLinksGuid, - Constants.DataTypes.Guids.MemberGuid, - Constants.DataTypes.Guids.ImageCropperGuid, - Constants.DataTypes.Guids.TagsGuid, - Constants.DataTypes.Guids.ListViewContentGuid, - Constants.DataTypes.Guids.ListViewMediaGuid, - Constants.DataTypes.Guids.ListViewMembersGuid, - Constants.DataTypes.Guids.DatePickerWithTimeGuid, - Constants.DataTypes.Guids.ApprovedColorGuid, - Constants.DataTypes.Guids.DropdownMultipleGuid, - Constants.DataTypes.Guids.RadioboxGuid, - Constants.DataTypes.Guids.DatePickerGuid, - Constants.DataTypes.Guids.DropdownGuid, - Constants.DataTypes.Guids.CheckboxListGuid, - Constants.DataTypes.Guids.CheckboxGuid, - Constants.DataTypes.Guids.NumericGuid, - Constants.DataTypes.Guids.RichtextEditorGuid, - Constants.DataTypes.Guids.TextstringGuid, - Constants.DataTypes.Guids.TextareaGuid, - Constants.DataTypes.Guids.UploadGuid, - Constants.DataTypes.Guids.LabelStringGuid, - Constants.DataTypes.Guids.LabelDecimalGuid, - Constants.DataTypes.Guids.LabelDateTimeGuid, - Constants.DataTypes.Guids.LabelBigIntGuid, - Constants.DataTypes.Guids.LabelTimeGuid, - Constants.DataTypes.Guids.LabelDateTimeGuid, + ConstantsCore.DataTypes.Guids.ContentPickerGuid, + ConstantsCore.DataTypes.Guids.MemberPickerGuid, + ConstantsCore.DataTypes.Guids.MediaPickerGuid, + ConstantsCore.DataTypes.Guids.MultipleMediaPickerGuid, + ConstantsCore.DataTypes.Guids.RelatedLinksGuid, + ConstantsCore.DataTypes.Guids.MemberGuid, + ConstantsCore.DataTypes.Guids.ImageCropperGuid, + ConstantsCore.DataTypes.Guids.TagsGuid, + ConstantsCore.DataTypes.Guids.ListViewContentGuid, + ConstantsCore.DataTypes.Guids.ListViewMediaGuid, + ConstantsCore.DataTypes.Guids.ListViewMembersGuid, + ConstantsCore.DataTypes.Guids.DatePickerWithTimeGuid, + ConstantsCore.DataTypes.Guids.ApprovedColorGuid, + ConstantsCore.DataTypes.Guids.DropdownMultipleGuid, + ConstantsCore.DataTypes.Guids.RadioboxGuid, + ConstantsCore.DataTypes.Guids.DatePickerGuid, + ConstantsCore.DataTypes.Guids.DropdownGuid, + ConstantsCore.DataTypes.Guids.CheckboxListGuid, + ConstantsCore.DataTypes.Guids.CheckboxGuid, + ConstantsCore.DataTypes.Guids.NumericGuid, + ConstantsCore.DataTypes.Guids.RichtextEditorGuid, + ConstantsCore.DataTypes.Guids.TextstringGuid, + ConstantsCore.DataTypes.Guids.TextareaGuid, + ConstantsCore.DataTypes.Guids.UploadGuid, + ConstantsCore.DataTypes.Guids.LabelStringGuid, + ConstantsCore.DataTypes.Guids.LabelDecimalGuid, + ConstantsCore.DataTypes.Guids.LabelDateTimeGuid, + ConstantsCore.DataTypes.Guids.LabelBigIntGuid, + ConstantsCore.DataTypes.Guids.LabelTimeGuid, + ConstantsCore.DataTypes.Guids.LabelDateTimeGuid, }; /// diff --git a/src/Umbraco.Core/Models/EntityContainer.cs b/src/Umbraco.Core/Models/EntityContainer.cs index 70f6cbd878..54182a0aae 100644 --- a/src/Umbraco.Core/Models/EntityContainer.cs +++ b/src/Umbraco.Core/Models/EntityContainer.cs @@ -16,9 +16,9 @@ namespace Umbraco.Core.Models private static readonly Dictionary ObjectTypeMap = new Dictionary { - { Constants.ObjectTypes.DataType, Constants.ObjectTypes.DataTypeContainer }, - { Constants.ObjectTypes.DocumentType, Constants.ObjectTypes.DocumentTypeContainer }, - { Constants.ObjectTypes.MediaType, Constants.ObjectTypes.MediaTypeContainer } + { ConstantsCore.ObjectTypes.DataType, ConstantsCore.ObjectTypes.DataTypeContainer }, + { ConstantsCore.ObjectTypes.DocumentType, ConstantsCore.ObjectTypes.DocumentTypeContainer }, + { ConstantsCore.ObjectTypes.MediaType, ConstantsCore.ObjectTypes.MediaTypeContainer } }; /// diff --git a/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs b/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs index 57e1c9ee5c..b43f0bf81a 100644 --- a/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs +++ b/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs @@ -74,7 +74,7 @@ namespace Umbraco.Core.Models.Identity private static string GetPasswordHash(string storedPass) { - return storedPass.StartsWith(Constants.Security.EmptyPasswordPrefix) ? null : storedPass; + return storedPass.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix) ? null : storedPass; } } } diff --git a/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs b/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs index b1d0189c56..46f132e2ea 100644 --- a/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs +++ b/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs @@ -31,9 +31,9 @@ namespace Umbraco.Core.Models.Membership private static bool IsSystemUserGroup(this string groupAlias) { - return groupAlias == Constants.Security.AdminGroupAlias - || groupAlias == Constants.Security.SensitiveDataGroupAlias - || groupAlias == Constants.Security.TranslatorGroupAlias; + return groupAlias == ConstantsCore.Security.AdminGroupAlias + || groupAlias == ConstantsCore.Security.SensitiveDataGroupAlias + || groupAlias == ConstantsCore.Security.TranslatorGroupAlias; } } } diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs index b11e991118..e39d917517 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs @@ -102,16 +102,16 @@ namespace Umbraco.Core.Models.PublishedContent // TODO: this list somehow also exists in constants, see memberTypeRepository => remove duplicate! private static readonly Dictionary BuiltinMemberProperties = new Dictionary { - { "Email", Constants.DataTypes.Textbox }, - { "Username", Constants.DataTypes.Textbox }, - { "PasswordQuestion", Constants.DataTypes.Textbox }, - { "Comments", Constants.DataTypes.Textbox }, - { "IsApproved", Constants.DataTypes.Boolean }, - { "IsLockedOut", Constants.DataTypes.Boolean }, - { "LastLockoutDate", Constants.DataTypes.DateTime }, - { "CreateDate", Constants.DataTypes.DateTime }, - { "LastLoginDate", Constants.DataTypes.DateTime }, - { "LastPasswordChangeDate", Constants.DataTypes.DateTime }, + { "Email", ConstantsCore.DataTypes.Textbox }, + { "Username", ConstantsCore.DataTypes.Textbox }, + { "PasswordQuestion", ConstantsCore.DataTypes.Textbox }, + { "Comments", ConstantsCore.DataTypes.Textbox }, + { "IsApproved", ConstantsCore.DataTypes.Boolean }, + { "IsLockedOut", ConstantsCore.DataTypes.Boolean }, + { "LastLockoutDate", ConstantsCore.DataTypes.DateTime }, + { "CreateDate", ConstantsCore.DataTypes.DateTime }, + { "LastLoginDate", ConstantsCore.DataTypes.DateTime }, + { "LastPasswordChangeDate", ConstantsCore.DataTypes.DateTime }, }; #region Content type diff --git a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs index 5449318e7a..dd3b5d9aca 100644 --- a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs +++ b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs @@ -18,14 +18,14 @@ namespace Umbraco.Core.Models /// /// Root /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.SystemRoot)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.SystemRoot)] [FriendlyName("Root")] ROOT, /// /// Document /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Document, typeof(IContent))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Document, typeof(IContent))] [FriendlyName("Document")] [UmbracoUdiType(Constants.UdiEntityType.Document)] Document, @@ -33,7 +33,7 @@ namespace Umbraco.Core.Models /// /// Media /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Media, typeof(IMedia))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Media, typeof(IMedia))] [FriendlyName("Media")] [UmbracoUdiType(Constants.UdiEntityType.Media)] Media, @@ -41,7 +41,7 @@ namespace Umbraco.Core.Models /// /// Member Type /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.MemberType, typeof(IMemberType))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MemberType, typeof(IMemberType))] [FriendlyName("Member Type")] [UmbracoUdiType(Constants.UdiEntityType.MemberType)] MemberType, @@ -49,7 +49,7 @@ namespace Umbraco.Core.Models /// /// Template /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Template, typeof(ITemplate))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Template, typeof(ITemplate))] [FriendlyName("Template")] [UmbracoUdiType(Constants.UdiEntityType.Template)] Template, @@ -57,7 +57,7 @@ namespace Umbraco.Core.Models /// /// Member Group /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.MemberGroup)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MemberGroup)] [FriendlyName("Member Group")] [UmbracoUdiType(Constants.UdiEntityType.MemberGroup)] MemberGroup, @@ -65,7 +65,7 @@ namespace Umbraco.Core.Models /// /// "Media Type /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.MediaType, typeof(IMediaType))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MediaType, typeof(IMediaType))] [FriendlyName("Media Type")] [UmbracoUdiType(Constants.UdiEntityType.MediaType)] MediaType, @@ -73,7 +73,7 @@ namespace Umbraco.Core.Models /// /// Document Type /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentType, typeof(IContentType))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DocumentType, typeof(IContentType))] [FriendlyName("Document Type")] [UmbracoUdiType(Constants.UdiEntityType.DocumentType)] DocumentType, @@ -81,14 +81,14 @@ namespace Umbraco.Core.Models /// /// Recycle Bin /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.ContentRecycleBin)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.ContentRecycleBin)] [FriendlyName("Recycle Bin")] RecycleBin, /// /// Stylesheet /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Stylesheet)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Stylesheet)] [FriendlyName("Stylesheet")] [UmbracoUdiType(Constants.UdiEntityType.Stylesheet)] Stylesheet, @@ -96,7 +96,7 @@ namespace Umbraco.Core.Models /// /// Member /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Member, typeof(IMember))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Member, typeof(IMember))] [FriendlyName("Member")] [UmbracoUdiType(Constants.UdiEntityType.Member)] Member, @@ -104,7 +104,7 @@ namespace Umbraco.Core.Models /// /// Data Type /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.DataType, typeof(IDataType))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DataType, typeof(IDataType))] [FriendlyName("Data Type")] [UmbracoUdiType(Constants.UdiEntityType.DataType)] DataType, @@ -112,7 +112,7 @@ namespace Umbraco.Core.Models /// /// Document type container /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentTypeContainer)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DocumentTypeContainer)] [FriendlyName("Document Type Container")] [UmbracoUdiType(Constants.UdiEntityType.DocumentTypeContainer)] DocumentTypeContainer, @@ -120,7 +120,7 @@ namespace Umbraco.Core.Models /// /// Media type container /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.MediaTypeContainer)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MediaTypeContainer)] [FriendlyName("Media Type Container")] [UmbracoUdiType(Constants.UdiEntityType.MediaTypeContainer)] MediaTypeContainer, @@ -128,7 +128,7 @@ namespace Umbraco.Core.Models /// /// Media type container /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.DataTypeContainer)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DataTypeContainer)] [FriendlyName("Data Type Container")] [UmbracoUdiType(Constants.UdiEntityType.DataTypeContainer)] DataTypeContainer, @@ -136,7 +136,7 @@ namespace Umbraco.Core.Models /// /// Relation type /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.RelationType)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.RelationType)] [FriendlyName("Relation Type")] [UmbracoUdiType(Constants.UdiEntityType.RelationType)] RelationType, @@ -144,35 +144,35 @@ namespace Umbraco.Core.Models /// /// Forms Form /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsForm)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsForm)] [FriendlyName("Form")] FormsForm, /// /// Forms PreValue /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsPreValue)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsPreValue)] [FriendlyName("PreValue")] FormsPreValue, /// /// Forms DataSource /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsDataSource)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsDataSource)] [FriendlyName("DataSource")] FormsDataSource, /// /// Language /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.Language)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Language)] [FriendlyName("Language")] Language, /// /// Document Blueprint /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentBlueprint, typeof(IContent))] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DocumentBlueprint, typeof(IContent))] [FriendlyName("DocumentBlueprint")] [UmbracoUdiType(Constants.UdiEntityType.DocumentBlueprint)] DocumentBlueprint, @@ -180,7 +180,7 @@ namespace Umbraco.Core.Models /// /// Reserved Identifier /// - [UmbracoObjectType(Constants.ObjectTypes.Strings.IdReservation)] + [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.IdReservation)] [FriendlyName("Identifier Reservation")] IdReservation diff --git a/src/Umbraco.Core/Models/UserExtensions.cs b/src/Umbraco.Core/Models/UserExtensions.cs index e00ac4ba15..0b1ffad587 100644 --- a/src/Umbraco.Core/Models/UserExtensions.cs +++ b/src/Umbraco.Core/Models/UserExtensions.cs @@ -33,7 +33,7 @@ namespace Umbraco.Core.Models public static bool IsSuper(this IUser user) { if (user == null) throw new ArgumentNullException(nameof(user)); - return user.Id == Constants.Security.SuperUserId; + return user.Id == ConstantsCore.Security.SuperUserId; } /// @@ -43,7 +43,7 @@ namespace Umbraco.Core.Models public static bool IsAdmin(this IUser user) { if (user == null) throw new ArgumentNullException(nameof(user)); - return user.Groups != null && user.Groups.Any(x => x.Alias == Constants.Security.AdminGroupAlias); + return user.Groups != null && user.Groups.Any(x => x.Alias == ConstantsCore.Security.AdminGroupAlias); } /// @@ -56,7 +56,7 @@ namespace Umbraco.Core.Models /// internal static string[] GetUserAvatarUrls(this IUser user, IAppCache cache) { - // If FIPS is required, never check the Gravatar service as it only supports MD5 hashing. + // If FIPS is required, never check the Gravatar service as it only supports MD5 hashing. // Unfortunately, if the FIPS setting is enabled on Windows, using MD5 will throw an exception // and the website will not run. // Also, check if the user has explicitly removed all avatars including a Gravatar, this will be possible and the value will be "none" @@ -151,46 +151,46 @@ namespace Umbraco.Core.Models internal static bool HasContentRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RootString, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); } internal static bool HasContentBinAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinContentString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RecycleBinContentString, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); } internal static bool HasMediaRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RootString, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); } internal static bool HasMediaBinAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinMediaString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RecycleBinMediaString, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); } internal static bool HasPathAccess(this IUser user, IContent content, IEntityService entityService) { if (content == null) throw new ArgumentNullException(nameof(content)); - return ContentPermissionsHelper.HasPathAccess(content.Path, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(content.Path, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); } internal static bool HasPathAccess(this IUser user, IMedia media, IEntityService entityService) { if (media == null) throw new ArgumentNullException(nameof(media)); - return ContentPermissionsHelper.HasPathAccess(media.Path, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(media.Path, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); } internal static bool HasContentPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); } internal static bool HasMediaPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService) { if (entity == null) throw new ArgumentNullException(nameof(entity)); - return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); } /// @@ -200,7 +200,7 @@ namespace Umbraco.Core.Models public static bool HasAccessToSensitiveData(this IUser user) { if (user == null) throw new ArgumentNullException("user"); - return user.Groups != null && user.Groups.Any(x => x.Alias == Constants.Security.SensitiveDataGroupAlias); + return user.Groups != null && user.Groups.Any(x => x.Alias == ConstantsCore.Security.SensitiveDataGroupAlias); } // calc. start nodes, combining groups' and user's, and excluding what's in the bin @@ -290,14 +290,14 @@ namespace Umbraco.Core.Models private static string GetBinPath(UmbracoObjectTypes objectType) { - var binPath = Constants.System.Root + ","; + var binPath = ConstantsCore.System.Root + ","; switch (objectType) { case UmbracoObjectTypes.Document: - binPath += Constants.System.RecycleBinContent; + binPath += ConstantsCore.System.RecycleBinContent; break; case UmbracoObjectTypes.Media: - binPath += Constants.System.RecycleBinMedia; + binPath += ConstantsCore.System.RecycleBinMedia; break; default: throw new ArgumentOutOfRangeException(nameof(objectType)); @@ -314,7 +314,7 @@ namespace Umbraco.Core.Models ? entityService.GetAllPaths(objectType, asn).ToDictionary(x => x.Id, x => x.Path) : new Dictionary(); - paths[Constants.System.Root] = Constants.System.RootString; // entityService does not get that one + paths[ConstantsCore.System.Root] = ConstantsCore.System.RootString; // entityService does not get that one var binPath = GetBinPath(objectType); diff --git a/src/Umbraco.Core/NamedUdiRange.cs b/src/Umbraco.Core/NamedUdiRange.cs index f4c4066d61..48c3ad6fbd 100644 --- a/src/Umbraco.Core/NamedUdiRange.cs +++ b/src/Umbraco.Core/NamedUdiRange.cs @@ -10,7 +10,7 @@ /// /// A . /// An optional selector. - public NamedUdiRange(Udi udi, string selector = Constants.DeploySelector.This) + public NamedUdiRange(Udi udi, string selector = ConstantsCore.DeploySelector.This) : base(udi, selector) { } @@ -20,7 +20,7 @@ /// A . /// A name. /// An optional selector. - public NamedUdiRange(Udi udi, string name, string selector = Constants.DeploySelector.This) + public NamedUdiRange(Udi udi, string name, string selector = ConstantsCore.DeploySelector.This) : base(udi, selector) { Name = name; diff --git a/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs b/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs index 434e0393cd..f82f0a7498 100644 --- a/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs @@ -41,8 +41,8 @@ namespace Umbraco.Core.Persistence.Factories content.SortOrder = nodeDto.SortOrder; content.Trashed = nodeDto.Trashed; - content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? Constants.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; content.CreateDate = nodeDto.CreateDate; content.UpdateDate = contentVersionDto.VersionDate; @@ -97,8 +97,8 @@ namespace Umbraco.Core.Persistence.Factories content.SortOrder = nodeDto.SortOrder; content.Trashed = nodeDto.Trashed; - content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? Constants.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; content.CreateDate = nodeDto.CreateDate; content.UpdateDate = contentVersionDto.VersionDate; @@ -138,8 +138,8 @@ namespace Umbraco.Core.Persistence.Factories content.SortOrder = nodeDto.SortOrder; content.Trashed = nodeDto.Trashed; - content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? Constants.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; content.CreateDate = nodeDto.CreateDate; content.UpdateDate = contentVersionDto.VersionDate; @@ -191,7 +191,7 @@ namespace Umbraco.Core.Persistence.Factories /// public static MediaDto BuildDto(IMedia entity) { - var contentDto = BuildContentDto(entity, Constants.ObjectTypes.Media); + var contentDto = BuildContentDto(entity, ConstantsCore.ObjectTypes.Media); var dto = new MediaDto { @@ -208,7 +208,7 @@ namespace Umbraco.Core.Persistence.Factories /// public static MemberDto BuildDto(IMember entity) { - var contentDto = BuildContentDto(entity, Constants.ObjectTypes.Member); + var contentDto = BuildContentDto(entity, ConstantsCore.ObjectTypes.Member); var dto = new MemberDto { diff --git a/src/Umbraco.Core/Persistence/Factories/ContentTypeFactory.cs b/src/Umbraco.Core/Persistence/Factories/ContentTypeFactory.cs index 54cfee0ffa..2cac044adc 100644 --- a/src/Umbraco.Core/Persistence/Factories/ContentTypeFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/ContentTypeFactory.cs @@ -117,7 +117,7 @@ namespace Umbraco.Core.Persistence.Factories entity.UpdateDate = dto.NodeDto.CreateDate; entity.Path = dto.NodeDto.Path; entity.Level = dto.NodeDto.Level; - entity.CreatorId = dto.NodeDto.UserId ?? Constants.Security.UnknownUserId; + entity.CreatorId = dto.NodeDto.UserId ?? ConstantsCore.Security.UnknownUserId; entity.AllowedAsRoot = dto.AllowAtRoot; entity.IsContainer = dto.IsContainer; entity.IsElement = dto.IsElement; @@ -131,11 +131,11 @@ namespace Umbraco.Core.Persistence.Factories { Guid nodeObjectType; if (entity is IContentType) - nodeObjectType = Constants.ObjectTypes.DocumentType; + nodeObjectType = ConstantsCore.ObjectTypes.DocumentType; else if (entity is IMediaType) - nodeObjectType = Constants.ObjectTypes.MediaType; + nodeObjectType = ConstantsCore.ObjectTypes.MediaType; else if (entity is IMemberType) - nodeObjectType = Constants.ObjectTypes.MemberType; + nodeObjectType = ConstantsCore.ObjectTypes.MemberType; else throw new Exception("Invalid entity."); diff --git a/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs b/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs index f189d38d05..ea5482aaca 100644 --- a/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/DataTypeFactory.cs @@ -38,7 +38,7 @@ namespace Umbraco.Core.Persistence.Factories dataType.Path = dto.NodeDto.Path; dataType.SortOrder = dto.NodeDto.SortOrder; dataType.Trashed = dto.NodeDto.Trashed; - dataType.CreatorId = dto.NodeDto.UserId ?? Constants.Security.UnknownUserId; + dataType.CreatorId = dto.NodeDto.UserId ?? ConstantsCore.Security.UnknownUserId; dataType.SetLazyConfiguration(dto.Configuration); @@ -73,7 +73,7 @@ namespace Umbraco.Core.Persistence.Factories CreateDate = entity.CreateDate, NodeId = entity.Id, Level = Convert.ToInt16(entity.Level), - NodeObjectType = Constants.ObjectTypes.DataType, + NodeObjectType = ConstantsCore.ObjectTypes.DataType, ParentId = entity.ParentId, Path = entity.Path, SortOrder = entity.SortOrder, diff --git a/src/Umbraco.Core/Persistence/Factories/MemberGroupFactory.cs b/src/Umbraco.Core/Persistence/Factories/MemberGroupFactory.cs index cb73f3b3aa..56b6240073 100644 --- a/src/Umbraco.Core/Persistence/Factories/MemberGroupFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/MemberGroupFactory.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core.Persistence.Factories static MemberGroupFactory() { - _nodeObjectTypeId = Constants.ObjectTypes.MemberGroup; + _nodeObjectTypeId = ConstantsCore.ObjectTypes.MemberGroup; } #region Implementation of IEntityFactory diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs index 0788594e3a..5cea6a8a1b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs @@ -55,7 +55,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var dto = Database.First(sql); return dto == null ? null - : new AuditItem(dto.NodeId, Enum.Parse(dto.Header), dto.UserId ?? Constants.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters); + : new AuditItem(dto.NodeId, Enum.Parse(dto.Header), dto.UserId ?? ConstantsCore.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters); } protected override IEnumerable PerformGetAll(params int[] ids) @@ -71,7 +71,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var dtos = Database.Fetch(sql); - return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? Constants.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); + return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? ConstantsCore.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); } public IEnumerable Get(AuditType type, IQuery query) @@ -83,7 +83,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var dtos = Database.Fetch(sql); - return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? Constants.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); + return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? ConstantsCore.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); } protected override Sql GetBaseQuery(bool isCount) @@ -174,7 +174,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement totalRecords = page.TotalItems; var items = page.Items.Select( - dto => new AuditItem(dto.NodeId, Enum.ParseOrNull(dto.Header) ?? AuditType.Custom, dto.UserId ?? Constants.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters)).ToList(); + dto => new AuditItem(dto.NodeId, Enum.ParseOrNull(dto.Header) ?? AuditType.Custom, dto.UserId ?? ConstantsCore.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters)).ToList(); // map the DateStamp for (var i = 0; i < items.Count; i++) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs index 5e7c7a9b85..67a494b24c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs @@ -778,7 +778,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected virtual int GetReservedId(Guid uniqueId) { var template = SqlContext.Templates.Get("Umbraco.Core.VersionableRepository.GetReservedId", tsql => - tsql.Select(x => x.NodeId).From().Where(x => x.UniqueId == SqlTemplate.Arg("uniqueId") && x.NodeObjectType == Constants.ObjectTypes.IdReservation) + tsql.Select(x => x.NodeId).From().Where(x => x.UniqueId == SqlTemplate.Arg("uniqueId") && x.NodeObjectType == ConstantsCore.ObjectTypes.IdReservation) ); var id = Database.ExecuteScalar(template.Sql(new { uniqueId = uniqueId })); return id ?? 0; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs index 70945ae713..aa50baa2a2 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeCommonRepository.cs @@ -84,11 +84,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { // create content type IContentTypeComposition contentType; - if (contentTypeDto.NodeDto.NodeObjectType == Constants.ObjectTypes.MediaType) + if (contentTypeDto.NodeDto.NodeObjectType == ConstantsCore.ObjectTypes.MediaType) contentType = ContentTypeFactory.BuildMediaTypeEntity(contentTypeDto); - else if (contentTypeDto.NodeDto.NodeObjectType == Constants.ObjectTypes.DocumentType) + else if (contentTypeDto.NodeDto.NodeObjectType == ConstantsCore.ObjectTypes.DocumentType) contentType = ContentTypeFactory.BuildContentTypeEntity(contentTypeDto); - else if (contentTypeDto.NodeDto.NodeObjectType == Constants.ObjectTypes.MemberType) + else if (contentTypeDto.NodeDto.NodeObjectType == ConstantsCore.ObjectTypes.MemberType) contentType = ContentTypeFactory.BuildMemberTypeEntity(contentTypeDto); else throw new PanicException($"The node object type {contentTypeDto.NodeDto.NodeObjectType} is not supported"); contentTypes.Add(contentType.Id, contentType); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs index 359b967dab..ba90ad6f26 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs @@ -185,7 +185,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return l; } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DocumentType; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.DocumentType; /// /// Deletes a content type diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index c22d1f1200..a654fb60a3 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -39,7 +39,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public IEnumerable> Move(TEntity moving, EntityContainer container) { - var parentId = Constants.System.Root; + var parentId = ConstantsCore.System.Root; if (container != null) { // check path @@ -64,7 +64,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement // move to parent (or -1), update path, save moving.ParentId = parentId; var movingPath = moving.Path + ","; // save before changing - moving.Path = (container == null ? Constants.System.RootString : container.Path) + "," + moving.Id; + moving.Path = (container == null ? ConstantsCore.System.RootString : container.Path) + "," + moving.Id; moving.Level = container == null ? 1 : container.Level + 1; Save(moving); @@ -266,7 +266,7 @@ AND umbracoNode.id <> @id", .SelectAll() .From() .InnerJoin().On(left => left.NodeId, right => right.NodeId) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Document) .Where(x => x.ContentTypeId == entity.Id); var contentDtos = Database.Fetch(sql); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeContainerRepository.cs index 752b641bc3..1eaddfc427 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeContainerRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeContainerRepository.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement class DataTypeContainerRepository : EntityContainerRepository, IDataTypeContainerRepository { public DataTypeContainerRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) - : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DataTypeContainer) + : base(scopeAccessor, cache, logger, ConstantsCore.ObjectTypes.DataTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs index 4ec259b24d..7b715d650a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs @@ -99,7 +99,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return Array.Empty(); } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DataType; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.DataType; #endregion @@ -314,7 +314,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return SimilarNodeName.GetUniqueName(names, id, nodeName); } - + [TableName(Constants.DatabaseSchema.Tables.ContentType)] private class ContentTypeReferenceDto : ContentTypeDto { diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs index d137d7ac76..64737d0749 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs @@ -24,6 +24,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected override bool EnsureUniqueNaming => false; // duplicates are allowed - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DocumentBlueprint; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.DocumentBlueprint; } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs index 2649b9993f..7985c04243 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Repository Base - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.Document; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Document; protected override IContent PerformGet(int id) { @@ -289,7 +289,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement .InnerJoin() .On((c, d) => c.Id == d.Id) .Where(x => x.NodeId == SqlTemplate.Arg("nodeId") && !x.Current && x.VersionDate < SqlTemplate.Arg("versionDate")) - .Where( x => !x.Published) + .Where( x => !x.Published) ); var versionDtos = Database.Fetch(template.Sql(new { nodeId, versionDate })); foreach (var versionDto in versionDtos) @@ -560,7 +560,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement entity.VersionId = documentVersionDto.Id = contentVersionDto.Id; // get the new id documentVersionDto.Published = false; // non-published version - Database.Insert(documentVersionDto); + Database.Insert(documentVersionDto); } // replace the property data (rather than updating) @@ -863,7 +863,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Recycle Bin - public override int RecycleBinId => Constants.System.RecycleBinContent; + public override int RecycleBinId => ConstantsCore.System.RecycleBinContent; #endregion @@ -1367,7 +1367,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement yield return dto; } - + } private class ContentVariation diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs index d50981e036..ba66575041 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement class DocumentTypeContainerRepository : EntityContainerRepository, IDocumentTypeContainerRepository { public DocumentTypeContainerRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) - : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DocumentTypeContainer) + : base(scopeAccessor, cache, logger, ConstantsCore.ObjectTypes.DocumentTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs index 09fe949df1..8f5518a0ee 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs @@ -22,7 +22,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public EntityContainerRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger, Guid containerObjectType) : base(scopeAccessor, cache, logger) { - var allowedContainers = new[] { Constants.ObjectTypes.DocumentTypeContainer, Constants.ObjectTypes.MediaTypeContainer, Constants.ObjectTypes.DataTypeContainer }; + var allowedContainers = new[] { ConstantsCore.ObjectTypes.DocumentTypeContainer, ConstantsCore.ObjectTypes.MediaTypeContainer, ConstantsCore.ObjectTypes.DataTypeContainer }; _containerObjectType = containerObjectType; if (allowedContainers.Contains(_containerObjectType) == false) throw new InvalidOperationException("No container type exists with ID: " + _containerObjectType); @@ -93,7 +93,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var entity = new EntityContainer(nodeDto.NodeId, nodeDto.UniqueId, nodeDto.ParentId, nodeDto.Path, nodeDto.Level, nodeDto.SortOrder, containedObjectType, - nodeDto.Text, nodeDto.UserId ?? Constants.Security.UnknownUserId); + nodeDto.Text, nodeDto.UserId ?? ConstantsCore.Security.UnknownUserId); // reset dirty initial properties (U4-1946) entity.ResetDirtyProperties(false); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs index 09c427e230..5e14d52f42 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs @@ -39,9 +39,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public IEnumerable GetPagedResultsByQuery(IQuery query, Guid objectType, long pageIndex, int pageSize, out long totalRecords, IQuery filter, Ordering ordering) { - var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == Constants.ObjectTypes.Media; - var isMember = objectType == Constants.ObjectTypes.Member; + var isContent = objectType == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == ConstantsCore.ObjectTypes.Media; + var isMember = objectType == ConstantsCore.ObjectTypes.Member; var sql = GetBaseWhere(isContent, isMedia, isMember, false, x => { @@ -133,9 +133,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public IEntitySlim Get(Guid key, Guid objectTypeId) { - var isContent = objectTypeId == Constants.ObjectTypes.Document || objectTypeId == Constants.ObjectTypes.DocumentBlueprint; - var isMedia = objectTypeId == Constants.ObjectTypes.Media; - var isMember = objectTypeId == Constants.ObjectTypes.Member; + var isContent = objectTypeId == ConstantsCore.ObjectTypes.Document || objectTypeId == ConstantsCore.ObjectTypes.DocumentBlueprint; + var isMedia = objectTypeId == ConstantsCore.ObjectTypes.Media; + var isMember = objectTypeId == ConstantsCore.ObjectTypes.Member; var sql = GetFullSqlForEntityType(isContent, isMedia, isMember, objectTypeId, key); return GetEntity(sql, isContent, isMedia, isMember); @@ -150,9 +150,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public IEntitySlim Get(int id, Guid objectTypeId) { - var isContent = objectTypeId == Constants.ObjectTypes.Document || objectTypeId == Constants.ObjectTypes.DocumentBlueprint; - var isMedia = objectTypeId == Constants.ObjectTypes.Media; - var isMember = objectTypeId == Constants.ObjectTypes.Member; + var isContent = objectTypeId == ConstantsCore.ObjectTypes.Document || objectTypeId == ConstantsCore.ObjectTypes.DocumentBlueprint; + var isMedia = objectTypeId == ConstantsCore.ObjectTypes.Media; + var isMember = objectTypeId == ConstantsCore.ObjectTypes.Member; var sql = GetFullSqlForEntityType(isContent, isMedia, isMember, objectTypeId, id); return GetEntity(sql, isContent, isMedia, isMember); @@ -195,9 +195,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement private IEnumerable PerformGetAll(Guid objectType, Action> filter = null) { - var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == Constants.ObjectTypes.Media; - var isMember = objectType == Constants.ObjectTypes.Member; + var isContent = objectType == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == ConstantsCore.ObjectTypes.Media; + var isMember = objectType == ConstantsCore.ObjectTypes.Member; var sql = GetFullSqlForEntityType(isContent, isMedia, isMember, objectType, filter); return GetEntities(sql, isContent, isMedia, isMember); @@ -237,9 +237,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public IEnumerable GetByQuery(IQuery query, Guid objectType) { - var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == Constants.ObjectTypes.Media; - var isMember = objectType == Constants.ObjectTypes.Member; + var isContent = objectType == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == ConstantsCore.ObjectTypes.Media; + var isMember = objectType == ConstantsCore.ObjectTypes.Member; var sql = GetBaseWhere(isContent, isMedia, isMember, false, null, objectType); @@ -607,7 +607,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { entity.Trashed = dto.Trashed; entity.CreateDate = dto.CreateDate; - entity.CreatorId = dto.UserId ?? Constants.Security.UnknownUserId; + entity.CreatorId = dto.UserId ?? ConstantsCore.Security.UnknownUserId; entity.Id = dto.NodeId; entity.Key = dto.UniqueId; entity.Level = dto.Level; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs index 19706f0c03..14fc2abab1 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs @@ -39,7 +39,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Repository Base - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.Media; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Media; protected override IMedia PerformGet(int id) { @@ -358,7 +358,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Recycle Bin - public override int RecycleBinId => Constants.System.RecycleBinMedia; + public override int RecycleBinId => ConstantsCore.System.RecycleBinMedia; #endregion @@ -541,6 +541,6 @@ namespace Umbraco.Core.Persistence.Repositories.Implement media.ResetDirtyProperties(false); return media; } - + } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs index 68b33e989d..5b9a17af61 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement class MediaTypeContainerRepository : EntityContainerRepository, IMediaTypeContainerRepository { public MediaTypeContainerRepository(IScopeAccessor scopeAccessor, AppCaches cache, ILogger logger) - : base(scopeAccessor, cache, logger, Constants.ObjectTypes.MediaTypeContainer) + : base(scopeAccessor, cache, logger, ConstantsCore.ObjectTypes.MediaTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs index 512011b52c..374b0462a5 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return l; } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.MediaType; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.MediaType; protected override void PersistNewItem(IMediaType entity) { diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs index c138550de5..82b99f6a8e 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs @@ -87,7 +87,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return list; } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.MemberGroup; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.MemberGroup; protected override void PersistNewItem(IMemberGroup entity) { @@ -185,7 +185,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public int[] GetMemberIds(string[] usernames) { - var memberObjectType = Constants.ObjectTypes.Member; + var memberObjectType = ConstantsCore.ObjectTypes.Member; var memberSql = Sql() .Select("umbracoNode.id") diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs index 0f7984a1bd..bbafcaac24 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs @@ -39,7 +39,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Repository Base - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.Member; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Member; protected override IMember PerformGet(int id) { @@ -308,7 +308,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement if (entity.RawPasswordValue.IsNullOrWhiteSpace()) { var aspHasher = new PasswordHasher(); - dto.Password = Constants.Security.EmptyPasswordPrefix + aspHasher.HashPassword(Guid.NewGuid().ToString("N")); + dto.Password = ConstantsCore.Security.EmptyPasswordPrefix + aspHasher.HashPassword(Guid.NewGuid().ToString("N")); entity.RawPasswordValue = dto.Password; } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberTypeRepository.cs index ee651819bf..c92e093a72 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberTypeRepository.cs @@ -127,7 +127,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return l; } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.MemberType; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.MemberType; protected override void PersistNewItem(IMemberType entity) { @@ -138,7 +138,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement //set a default icon if one is not specified if (entity.Icon.IsNullOrWhiteSpace()) { - entity.Icon = Constants.Icons.Member; + entity.Icon = ConstantsCore.Icons.Member; } //By Convention we add 9 standard PropertyTypes to an Umbraco MemberType diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs index 87564b9ac9..bdac18c4da 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs @@ -517,11 +517,11 @@ WHERE r.tagId IS NULL"; switch (type) { case TaggableObjectTypes.Content: - return Constants.ObjectTypes.Document; + return ConstantsCore.ObjectTypes.Document; case TaggableObjectTypes.Media: - return Constants.ObjectTypes.Media; + return ConstantsCore.ObjectTypes.Media; case TaggableObjectTypes.Member: - return Constants.ObjectTypes.Member; + return ConstantsCore.ObjectTypes.Member; default: throw new ArgumentOutOfRangeException(nameof(type)); } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs index b348317989..47a219e1b7 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs @@ -133,7 +133,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return list; } - protected override Guid NodeObjectTypeId => Constants.ObjectTypes.Template; + protected override Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Template; protected override void PersistNewItem(ITemplate entity) { diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs index 13422f43b1..25ecd1b3c8 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs @@ -52,7 +52,7 @@ namespace Umbraco.Core.Persistence /// /// Used by core runtime. public UmbracoDatabaseFactory(ILogger logger, Lazy mappers) - : this(Constants.System.UmbracoConnectionName, logger, mappers) + : this(ConstantsCore.System.UmbracoConnectionName, logger, mappers) { } /// @@ -135,7 +135,7 @@ namespace Umbraco.Core.Persistence { // replace NPoco database type by a more efficient one - var setting = ConfigurationManager.AppSettings[Constants.AppSettings.Debug.DatabaseFactoryServerVersion]; + var setting = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Debug.DatabaseFactoryServerVersion]; var fromSettings = false; if (setting.IsNullOrWhiteSpace() || !setting.StartsWith("SqlServer.") diff --git a/src/Umbraco.Core/PropertyEditors/DataEditor.cs b/src/Umbraco.Core/PropertyEditors/DataEditor.cs index dbb2fc467e..5d7489c535 100644 --- a/src/Umbraco.Core/PropertyEditors/DataEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataEditor.cs @@ -29,7 +29,7 @@ namespace Umbraco.Core.PropertyEditors // defaults Type = type; - Icon = Constants.Icons.PropertyEditor; + Icon = ConstantsCore.Icons.PropertyEditor; Group = Constants.PropertyEditors.Groups.Common; // assign properties based on the attribute, if it is found diff --git a/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs b/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs index 821f06513e..ce2c302af8 100644 --- a/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs +++ b/src/Umbraco.Core/PropertyEditors/DataEditorAttribute.cs @@ -115,7 +115,7 @@ namespace Umbraco.Core.PropertyEditors /// Gets or sets an optional icon. /// /// The icon can be used for example when presenting datatypes based upon the editor. - public string Icon { get; set; } = Constants.Icons.PropertyEditor; + public string Icon { get; set; } = ConstantsCore.Icons.PropertyEditor; /// /// Gets or sets an optional group. diff --git a/src/Umbraco.Core/Runtime/CoreInitialComposer.cs b/src/Umbraco.Core/Runtime/CoreInitialComposer.cs index 1f004846d0..9156eb9b97 100644 --- a/src/Umbraco.Core/Runtime/CoreInitialComposer.cs +++ b/src/Umbraco.Core/Runtime/CoreInitialComposer.cs @@ -81,7 +81,7 @@ namespace Umbraco.Core.Runtime // TODO: this is a hack, use proper configuration! // also: we still register the full IServerMessenger because // even on 1 single server we can have 2 concurrent app domains - var singleServer = "true".InvariantEquals(ConfigurationManager.AppSettings[Constants.AppSettings.DisableElectionForSingleServer]); + var singleServer = "true".InvariantEquals(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.DisableElectionForSingleServer]); return singleServer ? (IServerRegistrar) new SingleServerRegistrar(f.GetInstance()) : new DatabaseServerRegistrar( diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index 7c3e835a77..5bde2c2e60 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -28,7 +28,7 @@ namespace Umbraco.Core.Security } //Otherwise convert to a UmbracoBackOfficeIdentity if it's auth'd and has the back office session - if (user.Identity is ClaimsIdentity claimsIdentity && claimsIdentity.IsAuthenticated && claimsIdentity.HasClaim(x => x.Type == Constants.Security.SessionIdClaimType)) + if (user.Identity is ClaimsIdentity claimsIdentity && claimsIdentity.IsAuthenticated && claimsIdentity.HasClaim(x => x.Type == ConstantsCore.Security.SessionIdClaimType)) { try { diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs index 085a7b7a5b..d183ca0edb 100644 --- a/src/Umbraco.Core/Security/BackOfficeUserStore.cs +++ b/src/Umbraco.Core/Security/BackOfficeUserStore.cs @@ -85,7 +85,7 @@ namespace Umbraco.Core.Security // prefix will help us determine if the password hasn't actually been specified yet. //this will hash the guid with a salt so should be nicely random var aspHasher = new PasswordHasher(); - var emptyPasswordValue = Constants.Security.EmptyPasswordPrefix + + var emptyPasswordValue = ConstantsCore.Security.EmptyPasswordPrefix + aspHasher.HashPassword(Guid.NewGuid().ToString("N")); var userEntity = new User(user.Name, user.Email, user.UserName, emptyPasswordValue) diff --git a/src/Umbraco.Core/Security/ContentPermissionsHelper.cs b/src/Umbraco.Core/Security/ContentPermissionsHelper.cs index 1a329fcdcb..9b57ebf7e2 100644 --- a/src/Umbraco.Core/Security/ContentPermissionsHelper.cs +++ b/src/Umbraco.Core/Security/ContentPermissionsHelper.cs @@ -99,9 +99,9 @@ namespace Umbraco.Core.Security bool? hasPathAccess = null; entity = null; - if (nodeId == Constants.System.Root) + if (nodeId == ConstantsCore.System.Root) hasPathAccess = user.HasContentRootAccess(entityService); - else if (nodeId == Constants.System.RecycleBinContent) + else if (nodeId == ConstantsCore.System.RecycleBinContent) hasPathAccess = user.HasContentBinAccess(entityService); if (hasPathAccess.HasValue) @@ -151,9 +151,9 @@ namespace Umbraco.Core.Security bool? hasPathAccess = null; contentItem = null; - if (nodeId == Constants.System.Root) + if (nodeId == ConstantsCore.System.Root) hasPathAccess = user.HasContentRootAccess(entityService); - else if (nodeId == Constants.System.RecycleBinContent) + else if (nodeId == ConstantsCore.System.RecycleBinContent) hasPathAccess = user.HasContentBinAccess(entityService); if (hasPathAccess.HasValue) @@ -202,7 +202,7 @@ namespace Umbraco.Core.Security return false; // check for root access - if (startNodeIds.Contains(Constants.System.Root)) + if (startNodeIds.Contains(ConstantsCore.System.Root)) return true; var formattedPath = string.Concat(",", path, ","); @@ -227,7 +227,7 @@ namespace Umbraco.Core.Security return false; // check for root access - if (startNodeIds.Contains(Constants.System.Root)) + if (startNodeIds.Contains(ConstantsCore.System.Root)) { hasPathAccess = true; return true; diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index 633e12bcc1..28920d0e78 100644 --- a/src/Umbraco.Core/Security/MembershipProviderBase.cs +++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs @@ -332,7 +332,7 @@ namespace Umbraco.Core.Security //we need to lookup the member since this could be a brand new member without a password set var rawPassword = GetRawPassword(username); rawPasswordValue = rawPassword.Success ? rawPassword.Result : string.Empty; - if (rawPassword.Success == false || rawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix) == false) + if (rawPassword.Success == false || rawPasswordValue.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix) == false) { //If the old password is empty and AllowManuallyChangingPassword is false, than this provider cannot just arbitrarily change the password throw new NotSupportedException("This provider does not support manually changing the password"); @@ -354,7 +354,7 @@ namespace Umbraco.Core.Security // * during installation to set the admin password var installing = Current.RuntimeState.Level == RuntimeLevel.Install; if (AllowManuallyChangingPassword == false - && (rawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix) + && (rawPasswordValue.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix) || (installing && oldPassword == "default"))) { return PerformChangePassword(username, oldPassword, newPassword); diff --git a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs index 367e6f5c5a..6c99ff262b 100644 --- a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs +++ b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs @@ -88,11 +88,11 @@ namespace Umbraco.Core.Security /// public static MembershipProvider GetUsersMembershipProvider() { - if (Membership.Providers[Constants.Security.UserMembershipProviderName] == null) + if (Membership.Providers[ConstantsCore.Security.UserMembershipProviderName] == null) { - throw new InvalidOperationException("No membership provider found with name " + Constants.Security.UserMembershipProviderName); + throw new InvalidOperationException("No membership provider found with name " + ConstantsCore.Security.UserMembershipProviderName); } - return Membership.Providers[Constants.Security.UserMembershipProviderName]; + return Membership.Providers[ConstantsCore.Security.UserMembershipProviderName]; } /// diff --git a/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs b/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs index e9693747cf..4872f09dd3 100644 --- a/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs +++ b/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs @@ -45,7 +45,7 @@ namespace Umbraco.Core.Security public UmbracoBackOfficeIdentity(int userId, string username, string realName, IEnumerable startContentNodes, IEnumerable startMediaNodes, string culture, string sessionId, string securityStamp, IEnumerable allowedApps, IEnumerable roles) - : base(Enumerable.Empty(), Constants.Security.BackOfficeAuthenticationType) //this ctor is used to ensure the IsAuthenticated property is true + : base(Enumerable.Empty(), ConstantsCore.Security.BackOfficeAuthenticationType) //this ctor is used to ensure the IsAuthenticated property is true { if (allowedApps == null) throw new ArgumentNullException(nameof(allowedApps)); if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(username)); @@ -76,7 +76,7 @@ namespace Umbraco.Core.Security int userId, string username, string realName, IEnumerable startContentNodes, IEnumerable startMediaNodes, string culture, string sessionId, string securityStamp, IEnumerable allowedApps, IEnumerable roles) - : base(childIdentity.Claims, Constants.Security.BackOfficeAuthenticationType) + : base(childIdentity.Claims, ConstantsCore.Security.BackOfficeAuthenticationType) { if (string.IsNullOrWhiteSpace(username)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(username)); if (string.IsNullOrWhiteSpace(realName)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(realName)); @@ -92,7 +92,7 @@ namespace Umbraco.Core.Security /// /// private UmbracoBackOfficeIdentity(ClaimsIdentity identity) - : base(identity.Claims, Constants.Security.BackOfficeAuthenticationType) + : base(identity.Claims, ConstantsCore.Security.BackOfficeAuthenticationType) { Actor = identity; @@ -107,7 +107,7 @@ namespace Umbraco.Core.Security } } - public const string Issuer = Constants.Security.BackOfficeAuthenticationType; + public const string Issuer = ConstantsCore.Security.BackOfficeAuthenticationType; /// /// Returns the required claim types for a back office identity @@ -120,10 +120,10 @@ namespace Umbraco.Core.Security ClaimTypes.NameIdentifier, //id ClaimTypes.Name, //username ClaimTypes.GivenName, - Constants.Security.StartContentNodeIdClaimType, - Constants.Security.StartMediaNodeIdClaimType, + ConstantsCore.Security.StartContentNodeIdClaimType, + ConstantsCore.Security.StartMediaNodeIdClaimType, ClaimTypes.Locality, - Constants.Security.SessionIdClaimType, + ConstantsCore.Security.SessionIdClaimType, Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType }; @@ -144,27 +144,27 @@ namespace Umbraco.Core.Security if (HasClaim(x => x.Type == ClaimTypes.GivenName) == false) AddClaim(new Claim(ClaimTypes.GivenName, realName, ClaimValueTypes.String, Issuer, Issuer, this)); - if (HasClaim(x => x.Type == Constants.Security.StartContentNodeIdClaimType) == false && startContentNodes != null) + if (HasClaim(x => x.Type == ConstantsCore.Security.StartContentNodeIdClaimType) == false && startContentNodes != null) { foreach (var startContentNode in startContentNodes) { - AddClaim(new Claim(Constants.Security.StartContentNodeIdClaimType, startContentNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); + AddClaim(new Claim(ConstantsCore.Security.StartContentNodeIdClaimType, startContentNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); } } - if (HasClaim(x => x.Type == Constants.Security.StartMediaNodeIdClaimType) == false && startMediaNodes != null) + if (HasClaim(x => x.Type == ConstantsCore.Security.StartMediaNodeIdClaimType) == false && startMediaNodes != null) { foreach (var startMediaNode in startMediaNodes) { - AddClaim(new Claim(Constants.Security.StartMediaNodeIdClaimType, startMediaNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); + AddClaim(new Claim(ConstantsCore.Security.StartMediaNodeIdClaimType, startMediaNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); } } if (HasClaim(x => x.Type == ClaimTypes.Locality) == false) AddClaim(new Claim(ClaimTypes.Locality, culture, ClaimValueTypes.String, Issuer, Issuer, this)); - if (HasClaim(x => x.Type == Constants.Security.SessionIdClaimType) == false && SessionId.IsNullOrWhiteSpace() == false) - AddClaim(new Claim(Constants.Security.SessionIdClaimType, sessionId, ClaimValueTypes.String, Issuer, Issuer, this)); + if (HasClaim(x => x.Type == ConstantsCore.Security.SessionIdClaimType) == false && SessionId.IsNullOrWhiteSpace() == false) + AddClaim(new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, ClaimValueTypes.String, Issuer, Issuer, this)); //The security stamp claim is also required... this is because this claim type is hard coded // by the SecurityStampValidator, see: https://katanaproject.codeplex.com/workitem/444 @@ -172,11 +172,11 @@ namespace Umbraco.Core.Security AddClaim(new Claim(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType, securityStamp, ClaimValueTypes.String, Issuer, Issuer, this)); //Add each app as a separate claim - if (HasClaim(x => x.Type == Constants.Security.AllowedApplicationsClaimType) == false && allowedApps != null) + if (HasClaim(x => x.Type == ConstantsCore.Security.AllowedApplicationsClaimType) == false && allowedApps != null) { foreach (var application in allowedApps) { - AddClaim(new Claim(Constants.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this)); + AddClaim(new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this)); } } @@ -192,7 +192,7 @@ namespace Umbraco.Core.Security } } - + /// /// /// Gets the type of authenticated identity. @@ -202,14 +202,14 @@ namespace Umbraco.Core.Security /// public override string AuthenticationType => Issuer; - private int[] _startContentNodes; - public int[] StartContentNodes => _startContentNodes ?? (_startContentNodes = FindAll(x => x.Type == Constants.Security.StartContentNodeIdClaimType).Select(app => int.TryParse(app.Value, out var i) ? i : default).Where(x => x != default).ToArray()); + private int[] _startContentNodes; + public int[] StartContentNodes => _startContentNodes ?? (_startContentNodes = FindAll(x => x.Type == ConstantsCore.Security.StartContentNodeIdClaimType).Select(app => int.TryParse(app.Value, out var i) ? i : default).Where(x => x != default).ToArray()); private int[] _startMediaNodes; - public int[] StartMediaNodes => _startMediaNodes ?? (_startMediaNodes = FindAll(x => x.Type == Constants.Security.StartMediaNodeIdClaimType).Select(app => int.TryParse(app.Value, out var i) ? i : default).Where(x => x != default).ToArray()); + public int[] StartMediaNodes => _startMediaNodes ?? (_startMediaNodes = FindAll(x => x.Type == ConstantsCore.Security.StartMediaNodeIdClaimType).Select(app => int.TryParse(app.Value, out var i) ? i : default).Where(x => x != default).ToArray()); private string[] _allowedApplications; - public string[] AllowedApplications => _allowedApplications ?? (_allowedApplications = FindAll(x => x.Type == Constants.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToArray()); + public string[] AllowedApplications => _allowedApplications ?? (_allowedApplications = FindAll(x => x.Type == ConstantsCore.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToArray()); public int Id => int.Parse(this.FindFirstValue(ClaimTypes.NameIdentifier)); @@ -221,19 +221,19 @@ namespace Umbraco.Core.Security public string SessionId { - get => this.FindFirstValue(Constants.Security.SessionIdClaimType); + get => this.FindFirstValue(ConstantsCore.Security.SessionIdClaimType); set { - var existing = FindFirst(Constants.Security.SessionIdClaimType); + var existing = FindFirst(ConstantsCore.Security.SessionIdClaimType); if (existing != null) TryRemoveClaim(existing); - AddClaim(new Claim(Constants.Security.SessionIdClaimType, value, ClaimValueTypes.String, Issuer, Issuer, this)); + AddClaim(new Claim(ConstantsCore.Security.SessionIdClaimType, value, ClaimValueTypes.String, Issuer, Issuer, this)); } } public string SecurityStamp => this.FindFirstValue(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType); public string[] Roles => this.FindAll(x => x.Type == DefaultRoleClaimType).Select(role => role.Value).ToArray(); - + } } diff --git a/src/Umbraco.Core/Services/ContentServiceExtensions.cs b/src/Umbraco.Core/Services/ContentServiceExtensions.cs index dfe02ba690..ef8398a0e4 100644 --- a/src/Umbraco.Core/Services/ContentServiceExtensions.cs +++ b/src/Umbraco.Core/Services/ContentServiceExtensions.cs @@ -71,7 +71,7 @@ namespace Umbraco.Core.Services /// /// /// - public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { var guidUdi = parentId as GuidUdi; if (guidUdi == null) @@ -97,7 +97,7 @@ namespace Umbraco.Core.Services /// public static bool RecycleBinSmells(this IContentService contentService) { - return contentService.CountChildren(Constants.System.RecycleBinContent) > 0; + return contentService.CountChildren(ConstantsCore.System.RecycleBinContent) > 0; } /// @@ -107,7 +107,7 @@ namespace Umbraco.Core.Services /// public static bool RecycleBinSmells(this IMediaService mediaService) { - return mediaService.CountChildren(Constants.System.RecycleBinMedia) > 0; + return mediaService.CountChildren(ConstantsCore.System.RecycleBinMedia) > 0; } } } diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index 6f9ca58821..ee01987be5 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -33,27 +33,27 @@ namespace Umbraco.Core.Services /// /// Saves a blueprint. /// - void SaveBlueprint(IContent content, int userId = Constants.Security.SuperUserId); + void SaveBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a blueprint. /// - void DeleteBlueprint(IContent content, int userId = Constants.Security.SuperUserId); + void DeleteBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates a new content item from a blueprint. /// - IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = Constants.Security.SuperUserId); + IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes blueprints for a content type. /// - void DeleteBlueprintsOfType(int contentTypeId, int userId = Constants.Security.SuperUserId); + void DeleteBlueprintsOfType(int contentTypeId, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes blueprints for content types. /// - void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId); + void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = ConstantsCore.Security.SuperUserId); #endregion @@ -238,13 +238,13 @@ namespace Umbraco.Core.Services /// /// Saves a document. /// - OperationResult Save(IContent content, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + OperationResult Save(IContent content, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Saves documents. /// // TODO: why only 1 result not 1 per content?! - OperationResult Save(IEnumerable contents, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + OperationResult Save(IEnumerable contents, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Deletes a document. @@ -253,7 +253,7 @@ namespace Umbraco.Core.Services /// This method will also delete associated media files, child content and possibly associated domains. /// This method entirely clears the content from the database. /// - OperationResult Delete(IContent content, int userId = Constants.Security.SuperUserId); + OperationResult Delete(IContent content, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes all documents of a given document type. @@ -262,7 +262,7 @@ namespace Umbraco.Core.Services /// All non-deleted descendants of the deleted documents are moved to the recycle bin. /// This operation is potentially dangerous and expensive. /// - void DeleteOfType(int documentTypeId, int userId = Constants.Security.SuperUserId); + void DeleteOfType(int documentTypeId, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes all documents of given document types. @@ -271,17 +271,17 @@ namespace Umbraco.Core.Services /// All non-deleted descendants of the deleted documents are moved to the recycle bin. /// This operation is potentially dangerous and expensive. /// - void DeleteOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId); + void DeleteOfTypes(IEnumerable contentTypeIds, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes versions of a document prior to a given date. /// - void DeleteVersions(int id, DateTime date, int userId = Constants.Security.SuperUserId); + void DeleteVersions(int id, DateTime date, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a version of a document. /// - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.Security.SuperUserId); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = ConstantsCore.Security.SuperUserId); #endregion @@ -290,7 +290,7 @@ namespace Umbraco.Core.Services /// /// Moves a document under a new parent. /// - void Move(IContent content, int parentId, int userId = Constants.Security.SuperUserId); + void Move(IContent content, int parentId, int userId = ConstantsCore.Security.SuperUserId); /// /// Copies a document. @@ -298,7 +298,7 @@ namespace Umbraco.Core.Services /// /// Recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = Constants.Security.SuperUserId); + IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = ConstantsCore.Security.SuperUserId); /// /// Copies a document. @@ -306,12 +306,12 @@ namespace Umbraco.Core.Services /// /// Optionally recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = Constants.Security.SuperUserId); + IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = ConstantsCore.Security.SuperUserId); /// /// Moves a document to the recycle bin. /// - OperationResult MoveToRecycleBin(IContent content, int userId = Constants.Security.SuperUserId); + OperationResult MoveToRecycleBin(IContent content, int userId = ConstantsCore.Security.SuperUserId); /// /// Empties the recycle bin. @@ -323,18 +323,18 @@ namespace Umbraco.Core.Services /// /// Empties the Recycle Bin by deleting all that resides in the bin /// - /// Optional Id of the User emptying the Recycle Bin - OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId); + /// Optional Id of the User emptying the Recycle Bin + OperationResult EmptyRecycleBin(int userId = ConstantsCore.Security.SuperUserId); /// /// Sorts documents. /// - OperationResult Sort(IEnumerable items, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + OperationResult Sort(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Sorts documents. /// - OperationResult Sort(IEnumerable ids, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + OperationResult Sort(IEnumerable ids, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); #endregion @@ -354,7 +354,7 @@ namespace Umbraco.Core.Services /// The culture to publish. /// The identifier of the user performing the action. /// A value indicating whether to raise events. - PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Saves and publishes a document. @@ -368,7 +368,7 @@ namespace Umbraco.Core.Services /// The cultures to publish. /// The identifier of the user performing the action. /// A value indicating whether to raise events. - PublishResult SaveAndPublish(IContent content, string[] cultures, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, string[] cultures, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Saves and publishes a document branch. @@ -384,7 +384,7 @@ namespace Umbraco.Core.Services /// only those documents that are already published, are republished. When true, all documents are /// published. The root of the branch is always published, regardless of . /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = Constants.Security.SuperUserId); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = ConstantsCore.Security.SuperUserId); /// /// Saves and publishes a document branch. @@ -398,7 +398,7 @@ namespace Umbraco.Core.Services /// only those documents that are already published, are republished. When true, all documents are /// published. The root of the branch is always published, regardless of . /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.Security.SuperUserId); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = ConstantsCore.Security.SuperUserId); ///// ///// Saves and publishes a document branch. @@ -423,7 +423,7 @@ namespace Umbraco.Core.Services //IEnumerable SaveAndPublishBranch(IContent content, bool force, // Func> shouldPublish, // Func, bool> publishCultures, - // int userId = Constants.Security.SuperUserId); + // int userId = ConstantsCore.Security.SuperUserId); /// /// Unpublishes a document. @@ -435,7 +435,7 @@ namespace Umbraco.Core.Services /// If the content type is variant, then culture can be either '*' or an actual culture, but neither null nor /// empty. If the content type is invariant, then culture can be either '*' or null or empty. /// - PublishResult Unpublish(IContent content, string culture = "*", int userId = Constants.Security.SuperUserId); + PublishResult Unpublish(IContent content, string culture = "*", int userId = ConstantsCore.Security.SuperUserId); /// /// Gets a value indicating whether a document is path-publishable. @@ -452,7 +452,7 @@ namespace Umbraco.Core.Services /// /// Saves a document and raises the "sent to publication" events. /// - bool SendToPublication(IContent content, int userId = Constants.Security.SuperUserId); + bool SendToPublication(IContent content, int userId = ConstantsCore.Security.SuperUserId); /// /// Publishes and unpublishes scheduled documents. @@ -487,27 +487,27 @@ namespace Umbraco.Core.Services /// /// Creates a document. /// - IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = Constants.Security.SuperUserId); + IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates a document. /// - IContent Create(string name, int parentId, string documentTypeAlias, int userId = Constants.Security.SuperUserId); + IContent Create(string name, int parentId, string documentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates a document. /// - IContent Create(string name, IContent parent, string documentTypeAlias, int userId = Constants.Security.SuperUserId); + IContent Create(string name, IContent parent, string documentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId); + IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = Constants.Security.SuperUserId); + IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); #endregion @@ -523,9 +523,9 @@ namespace Umbraco.Core.Services /// /// When no culture is specified, all cultures are rolled back. /// - OperationResult Rollback(int id, int versionId, string culture = "*", int userId = Constants.Security.SuperUserId); + OperationResult Rollback(int id, int versionId, string culture = "*", int userId = ConstantsCore.Security.SuperUserId); #endregion - + } } diff --git a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs index 51e5d756eb..e51d099d1c 100644 --- a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs +++ b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs @@ -48,11 +48,11 @@ namespace Umbraco.Core.Services IEnumerable GetChildren(int id); bool HasChildren(int id); - void Save(TItem item, int userId = Constants.Security.SuperUserId); - void Save(IEnumerable items, int userId = Constants.Security.SuperUserId); + void Save(TItem item, int userId = ConstantsCore.Security.SuperUserId); + void Save(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId); - void Delete(TItem item, int userId = Constants.Security.SuperUserId); - void Delete(IEnumerable item, int userId = Constants.Security.SuperUserId); + void Delete(TItem item, int userId = ConstantsCore.Security.SuperUserId); + void Delete(IEnumerable item, int userId = ConstantsCore.Security.SuperUserId); Attempt ValidateComposition(TItem compo); @@ -64,15 +64,15 @@ namespace Umbraco.Core.Services /// bool HasContainerInPath(string contentPath); - Attempt> CreateContainer(int parentContainerId, string name, int userId = Constants.Security.SuperUserId); - Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId); + Attempt> CreateContainer(int parentContainerId, string name, int userId = ConstantsCore.Security.SuperUserId); + Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId); EntityContainer GetContainer(int containerId); EntityContainer GetContainer(Guid containerId); IEnumerable GetContainers(int[] containerIds); IEnumerable GetContainers(TItem contentType); IEnumerable GetContainers(string folderName, int level); - Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId); - Attempt> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId); + Attempt DeleteContainer(int containerId, int userId = ConstantsCore.Security.SuperUserId); + Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId); Attempt> Move(TItem moving, int containerId); Attempt> Copy(TItem copying, int containerId); diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs index 3ebfa95bfb..97f3a9fcb7 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -16,16 +16,16 @@ namespace Umbraco.Core.Services /// /// IReadOnlyDictionary> GetReferences(int id); - - Attempt> CreateContainer(int parentId, string name, int userId = Constants.Security.SuperUserId); - Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId); + + Attempt> CreateContainer(int parentId, string name, int userId = ConstantsCore.Security.SuperUserId); + Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId); EntityContainer GetContainer(int containerId); EntityContainer GetContainer(Guid containerId); IEnumerable GetContainers(string folderName, int level); IEnumerable GetContainers(IDataType dataType); IEnumerable GetContainers(int[] containerIds); - Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId); - Attempt> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId); + Attempt DeleteContainer(int containerId, int userId = ConstantsCore.Security.SuperUserId); + Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets a by its Name @@ -60,14 +60,14 @@ namespace Umbraco.Core.Services /// /// to save /// Id of the user issuing the save - void Save(IDataType dataType, int userId = Constants.Security.SuperUserId); + void Save(IDataType dataType, int userId = ConstantsCore.Security.SuperUserId); /// /// Saves a collection of /// /// to save /// Id of the user issuing the save - void Save(IEnumerable dataTypeDefinitions, int userId = Constants.Security.SuperUserId); + void Save(IEnumerable dataTypeDefinitions, int userId = ConstantsCore.Security.SuperUserId); /// /// Saves a collection of @@ -86,7 +86,7 @@ namespace Umbraco.Core.Services /// /// to delete /// Id of the user issuing the deletion - void Delete(IDataType dataType, int userId = Constants.Security.SuperUserId); + void Delete(IDataType dataType, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets a by its control Id diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 5fe52559ee..2bfb354020 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -18,12 +18,12 @@ namespace Umbraco.Core.Services IPartialView GetPartialView(string path); IPartialView GetPartialViewMacro(string path); IEnumerable GetPartialViewMacros(params string[] names); - Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId); - Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId); - bool DeletePartialView(string path, int userId = Constants.Security.SuperUserId); - bool DeletePartialViewMacro(string path, int userId = Constants.Security.SuperUserId); - Attempt SavePartialView(IPartialView partialView, int userId = Constants.Security.SuperUserId); - Attempt SavePartialViewMacro(IPartialView partialView, int userId = Constants.Security.SuperUserId); + Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId); + Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId); + bool DeletePartialView(string path, int userId = ConstantsCore.Security.SuperUserId); + bool DeletePartialViewMacro(string path, int userId = ConstantsCore.Security.SuperUserId); + Attempt SavePartialView(IPartialView partialView, int userId = ConstantsCore.Security.SuperUserId); + Attempt SavePartialViewMacro(IPartialView partialView, int userId = ConstantsCore.Security.SuperUserId); bool ValidatePartialView(PartialView partialView); bool ValidatePartialViewMacro(PartialView partialView); @@ -45,14 +45,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the stylesheet - void SaveStylesheet(Stylesheet stylesheet, int userId = Constants.Security.SuperUserId); + void SaveStylesheet(Stylesheet stylesheet, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a stylesheet by its name /// /// Name incl. extension of the Stylesheet to delete /// Optional id of the user deleting the stylesheet - void DeleteStylesheet(string path, int userId = Constants.Security.SuperUserId); + void DeleteStylesheet(string path, int userId = ConstantsCore.Security.SuperUserId); /// /// Validates a @@ -79,14 +79,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the script - void SaveScript(Script script, int userId = Constants.Security.SuperUserId); + void SaveScript(Script script, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a script by its name /// /// Name incl. extension of the Script to delete /// Optional id of the user deleting the script - void DeleteScript(string path, int userId = Constants.Security.SuperUserId); + void DeleteScript(string path, int userId = ConstantsCore.Security.SuperUserId); /// /// Validates a @@ -187,7 +187,7 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the template - void SaveTemplate(ITemplate template, int userId = Constants.Security.SuperUserId); + void SaveTemplate(ITemplate template, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates a template for a content type @@ -198,16 +198,16 @@ namespace Umbraco.Core.Services /// /// The template created /// - Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = Constants.Security.SuperUserId); + Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = ConstantsCore.Security.SuperUserId); - ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = Constants.Security.SuperUserId); + ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a template by its alias /// /// Alias of the to delete /// Optional id of the user deleting the template - void DeleteTemplate(string alias, int userId = Constants.Security.SuperUserId); + void DeleteTemplate(string alias, int userId = ConstantsCore.Security.SuperUserId); /// /// Validates a @@ -221,7 +221,7 @@ namespace Umbraco.Core.Services /// /// List of to save /// Optional id of the user - void SaveTemplate(IEnumerable templates, int userId = Constants.Security.SuperUserId); + void SaveTemplate(IEnumerable templates, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets the content of a template as a stream. diff --git a/src/Umbraco.Core/Services/ILocalizationService.cs b/src/Umbraco.Core/Services/ILocalizationService.cs index 54022d37bb..ecd4433045 100644 --- a/src/Umbraco.Core/Services/ILocalizationService.cs +++ b/src/Umbraco.Core/Services/ILocalizationService.cs @@ -86,7 +86,7 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the dictionary item - void Save(IDictionaryItem dictionaryItem, int userId = Constants.Security.SuperUserId); + void Save(IDictionaryItem dictionaryItem, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a object and its related translations @@ -94,7 +94,7 @@ namespace Umbraco.Core.Services /// /// to delete /// Optional id of the user deleting the dictionary item - void Delete(IDictionaryItem dictionaryItem, int userId = Constants.Security.SuperUserId); + void Delete(IDictionaryItem dictionaryItem, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets a by its id @@ -102,7 +102,7 @@ namespace Umbraco.Core.Services /// Id of the /// ILanguage GetLanguageById(int id); - + /// /// Gets a by its iso code /// @@ -153,14 +153,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the language - void Save(ILanguage language, int userId = Constants.Security.SuperUserId); + void Save(ILanguage language, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes a by removing it and its usages from the db /// /// to delete /// Optional id of the user deleting the language - void Delete(ILanguage language, int userId = Constants.Security.SuperUserId); + void Delete(ILanguage language, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets the full dictionary key map. diff --git a/src/Umbraco.Core/Services/IMacroService.cs b/src/Umbraco.Core/Services/IMacroService.cs index 597c986f37..7ccd107861 100644 --- a/src/Umbraco.Core/Services/IMacroService.cs +++ b/src/Umbraco.Core/Services/IMacroService.cs @@ -39,14 +39,14 @@ namespace Umbraco.Core.Services /// /// to delete /// Optional id of the user deleting the macro - void Delete(IMacro macro, int userId = Constants.Security.SuperUserId); + void Delete(IMacro macro, int userId = ConstantsCore.Security.SuperUserId); /// /// Saves an /// /// to save /// Optional id of the user saving the macro - void Save(IMacro macro, int userId = Constants.Security.SuperUserId); + void Save(IMacro macro, int userId = ConstantsCore.Security.SuperUserId); ///// ///// Gets a list all available plugins diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index 3fecb20035..0ba6e79aa1 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -37,7 +37,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId); + IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates an object using the alias of the @@ -53,7 +53,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId); + IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates an object using the alias of the @@ -69,7 +69,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.Security.SuperUserId); + IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets an object by Id @@ -150,14 +150,14 @@ namespace Umbraco.Core.Services /// Id of the Media's new Parent /// Id of the User moving the Media /// True if moving succeeded, otherwise False - Attempt Move(IMedia media, int parentId, int userId = Constants.Security.SuperUserId); + Attempt Move(IMedia media, int parentId, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes an object by moving it to the Recycle Bin /// /// The to delete /// Id of the User deleting the Media - Attempt MoveToRecycleBin(IMedia media, int userId = Constants.Security.SuperUserId); + Attempt MoveToRecycleBin(IMedia media, int userId = ConstantsCore.Security.SuperUserId); /// /// Empties the Recycle Bin by deleting all that resides in the bin @@ -169,8 +169,8 @@ namespace Umbraco.Core.Services /// /// Empties the Recycle Bin by deleting all that resides in the bin /// - /// Optional Id of the User emptying the Recycle Bin - OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId); + /// Optional Id of the User emptying the Recycle Bin + OperationResult EmptyRecycleBin(int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes all media of specified type. All children of deleted media is moved to Recycle Bin. @@ -178,7 +178,7 @@ namespace Umbraco.Core.Services /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional Id of the user deleting Media - void DeleteMediaOfType(int mediaTypeId, int userId = Constants.Security.SuperUserId); + void DeleteMediaOfType(int mediaTypeId, int userId = ConstantsCore.Security.SuperUserId); /// /// Deletes all media of the specified types. All Descendants of deleted media that is not of these types is moved to Recycle Bin. @@ -186,8 +186,8 @@ namespace Umbraco.Core.Services /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Ids of the s /// Optional Id of the user issuing the delete operation - void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = Constants.Security.SuperUserId); - + void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = ConstantsCore.Security.SuperUserId); + /// /// Permanently deletes an object /// @@ -197,7 +197,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - Attempt Delete(IMedia media, int userId = Constants.Security.SuperUserId); + Attempt Delete(IMedia media, int userId = ConstantsCore.Security.SuperUserId); /// /// Saves a single object @@ -205,7 +205,7 @@ namespace Umbraco.Core.Services /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - Attempt Save(IMedia media, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + Attempt Save(IMedia media, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Saves a collection of objects @@ -213,7 +213,7 @@ namespace Umbraco.Core.Services /// Collection of to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - Attempt Save(IEnumerable medias, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + Attempt Save(IEnumerable medias, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Gets an object by its 'UniqueId' @@ -256,7 +256,7 @@ namespace Umbraco.Core.Services /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Content object - void DeleteVersions(int id, DateTime versionDate, int userId = Constants.Security.SuperUserId); + void DeleteVersions(int id, DateTime versionDate, int userId = ConstantsCore.Security.SuperUserId); /// /// Permanently deletes specific version(s) from an object. @@ -265,7 +265,7 @@ namespace Umbraco.Core.Services /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Content object - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.Security.SuperUserId); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets an object from the path stored in the 'umbracoFile' property. @@ -310,7 +310,7 @@ namespace Umbraco.Core.Services /// /// /// True if sorting succeeded, otherwise False - bool Sort(IEnumerable items, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); /// /// Creates an object using the alias of the @@ -325,7 +325,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.Security.SuperUserId); + IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Creates an object using the alias of the @@ -340,7 +340,7 @@ namespace Umbraco.Core.Services /// Alias of the /// Optional id of the user creating the media item /// - IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId); + IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId); /// /// Gets the content of a media as a stream. diff --git a/src/Umbraco.Core/Services/IPackagingService.cs b/src/Umbraco.Core/Services/IPackagingService.cs index b38b5a426b..9d00632f8d 100644 --- a/src/Umbraco.Core/Services/IPackagingService.cs +++ b/src/Umbraco.Core/Services/IPackagingService.cs @@ -27,7 +27,7 @@ namespace Umbraco.Core.Services /// /// /// - IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.Security.SuperUserId); + IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = ConstantsCore.Security.SuperUserId); /// /// Installs the data, entities, objects contained in an umbraco package file (zip) @@ -35,7 +35,7 @@ namespace Umbraco.Core.Services /// /// /// - InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.Security.SuperUserId); + InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = ConstantsCore.Security.SuperUserId); /// /// Uninstalls all versions of the package by name @@ -43,7 +43,7 @@ namespace Umbraco.Core.Services /// /// /// - UninstallationSummary UninstallPackage(string packageName, int userId = Constants.Security.SuperUserId); + UninstallationSummary UninstallPackage(string packageName, int userId = ConstantsCore.Security.SuperUserId); #endregion @@ -75,7 +75,7 @@ namespace Umbraco.Core.Services /// If the package is an upgrade, the original/current PackageDefinition is returned /// PackageInstallType GetPackageInstallType(string packageName, SemVersion packageVersion, out PackageDefinition alreadyInstalled); - void DeleteInstalledPackage(int packageId, int userId = Constants.Security.SuperUserId); + void DeleteInstalledPackage(int packageId, int userId = ConstantsCore.Security.SuperUserId); /// /// Persists a package definition to storage @@ -89,7 +89,7 @@ namespace Umbraco.Core.Services IEnumerable GetAllCreatedPackages(); PackageDefinition GetCreatedPackageById(int id); - void DeleteCreatedPackage(int id, int userId = Constants.Security.SuperUserId); + void DeleteCreatedPackage(int id, int userId = ConstantsCore.Security.SuperUserId); /// /// Persists a package definition to storage diff --git a/src/Umbraco.Core/Services/IdkMap.cs b/src/Umbraco.Core/Services/IdkMap.cs index f352def49e..d3366e1f5e 100644 --- a/src/Umbraco.Core/Services/IdkMap.cs +++ b/src/Umbraco.Core/Services/IdkMap.cs @@ -80,7 +80,7 @@ namespace Umbraco.Core.Services using (var scope = _scopeProvider.CreateScope()) { // populate content and media items - var types = new[] { Constants.ObjectTypes.Document, Constants.ObjectTypes.Media }; + var types = new[] { ConstantsCore.ObjectTypes.Document, ConstantsCore.ObjectTypes.Media }; var values = scope.Database.Query("SELECT id, uniqueId, nodeObjectType FROM umbracoNode WHERE nodeObjectType IN @types", new { types }); foreach (var value in values) { @@ -174,7 +174,7 @@ namespace Umbraco.Core.Services else { val = scope.Database.ExecuteScalar("SELECT id FROM umbracoNode WHERE uniqueId=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)", - new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservation }); + new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = ConstantsCore.ObjectTypes.IdReservation }); } scope.Complete(); } @@ -262,7 +262,7 @@ namespace Umbraco.Core.Services else { val = scope.Database.ExecuteScalar("SELECT uniqueId FROM umbracoNode WHERE id=@id AND (nodeObjectType=@type OR nodeObjectType=@reservation)", - new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservation }); + new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = ConstantsCore.ObjectTypes.IdReservation }); } scope.Complete(); } diff --git a/src/Umbraco.Core/Services/Implement/AuditService.cs b/src/Umbraco.Core/Services/Implement/AuditService.cs index 5eb08f2dea..79a5a239d6 100644 --- a/src/Umbraco.Core/Services/Implement/AuditService.cs +++ b/src/Umbraco.Core/Services/Implement/AuditService.cs @@ -105,7 +105,7 @@ namespace Umbraco.Core.Services.Implement if (pageIndex < 0) throw new ArgumentOutOfRangeException(nameof(pageIndex)); if (pageSize <= 0) throw new ArgumentOutOfRangeException(nameof(pageSize)); - if (entityId == Constants.System.Root || entityId <= 0) + if (entityId == ConstantsCore.System.Root || entityId <= 0) { totalRecords = 0; return Enumerable.Empty(); @@ -159,7 +159,7 @@ namespace Umbraco.Core.Services.Implement /// public IAuditEntry Write(int performingUserId, string perfomingDetails, string performingIp, DateTime eventDateUtc, int affectedUserId, string affectedDetails, string eventType, string eventDetails) { - if (performingUserId < 0 && performingUserId != Constants.Security.SuperUserId) throw new ArgumentOutOfRangeException(nameof(performingUserId)); + if (performingUserId < 0 && performingUserId != ConstantsCore.Security.SuperUserId) throw new ArgumentOutOfRangeException(nameof(performingUserId)); if (string.IsNullOrWhiteSpace(perfomingDetails)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(perfomingDetails)); if (string.IsNullOrWhiteSpace(eventType)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(eventType)); if (string.IsNullOrWhiteSpace(eventDetails)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(eventDetails)); diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 720713e9ad..37768d661e 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -30,7 +30,7 @@ namespace Umbraco.Core.Services.Implement private IQuery _queryNotTrashed; //TODO: The non-lazy object should be injected private readonly Lazy _propertyValidationService = new Lazy(() => new PropertyValidationService()); - + #region Constructors @@ -163,7 +163,7 @@ namespace Umbraco.Core.Services.Implement /// Alias of the /// Optional id of the user creating the content /// - public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // TODO: what about culture? @@ -183,7 +183,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent Create(string name, int parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public IContent Create(string name, int parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // TODO: what about culture? @@ -216,7 +216,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // TODO: what about culture? @@ -247,7 +247,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // TODO: what about culture? @@ -281,7 +281,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the content type. /// The optional id of the user creating the content. /// The content object. - public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = Constants.Security.SuperUserId) + public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // TODO: what about culture? @@ -534,7 +534,7 @@ namespace Umbraco.Core.Services.Implement //null check otherwise we get exceptions if (content.Path.IsNullOrWhiteSpace()) return Enumerable.Empty(); - var rootId = Constants.System.RootString; + var rootId = ConstantsCore.System.RootString; var ids = content.Path.Split(',') .Where(x => x != rootId && x != content.Id.ToString(CultureInfo.InvariantCulture)).Select(int.Parse).ToArray(); if (ids.Any() == false) @@ -593,9 +593,9 @@ namespace Umbraco.Core.Services.Implement scope.ReadLock(Constants.Locks.ContentTree); //if the id is System Root, then just get all - if (id != Constants.System.Root) + if (id != ConstantsCore.System.Root) { - var contentPath = _entityRepository.GetAllPaths(Constants.ObjectTypes.Document, id).ToArray(); + var contentPath = _entityRepository.GetAllPaths(ConstantsCore.ObjectTypes.Document, id).ToArray(); if (contentPath.Length == 0) { totalChildren = 0; @@ -640,7 +640,7 @@ namespace Umbraco.Core.Services.Implement /// Parent object public IContent GetParent(IContent content) { - if (content.ParentId == Constants.System.Root || content.ParentId == Constants.System.RecycleBinContent) + if (content.ParentId == ConstantsCore.System.Root || content.ParentId == ConstantsCore.System.RecycleBinContent) return null; return GetById(content.ParentId); @@ -655,7 +655,7 @@ namespace Umbraco.Core.Services.Implement using (var scope = ScopeProvider.CreateScope(autoComplete: true)) { scope.ReadLock(Constants.Locks.ContentTree); - var query = Query().Where(x => x.ParentId == Constants.System.Root); + var query = Query().Where(x => x.ParentId == ConstantsCore.System.Root); return _documentRepository.Get(query); } } @@ -706,7 +706,7 @@ namespace Umbraco.Core.Services.Implement ordering = Ordering.By("Path"); scope.ReadLock(Constants.Locks.ContentTree); - var query = Query().Where(x => x.Path.StartsWith(Constants.System.RecycleBinContentPathPrefix)); + var query = Query().Where(x => x.Path.StartsWith(ConstantsCore.System.RecycleBinContentPathPrefix)); return _documentRepository.GetPage(query, pageIndex, pageSize, out totalRecords, filter, ordering); } } @@ -729,7 +729,7 @@ namespace Umbraco.Core.Services.Implement public bool IsPathPublishable(IContent content) { // fast - if (content.ParentId == Constants.System.Root) return true; // root content is always publishable + if (content.ParentId == ConstantsCore.System.Root) return true; // root content is always publishable if (content.Trashed) return false; // trashed content is never publishable // not trashed and has a parent: publishable if the parent is path-published @@ -751,7 +751,7 @@ namespace Umbraco.Core.Services.Implement #region Save, Publish, Unpublish /// - public OperationResult Save(IContent content, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Save(IContent content, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var publishedState = content.PublishedState; if (publishedState != PublishedState.Published && publishedState != PublishedState.Unpublished) @@ -814,7 +814,7 @@ namespace Umbraco.Core.Services.Implement } /// - public OperationResult Save(IEnumerable contents, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Save(IEnumerable contents, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); var contentsA = contents.ToArray(); @@ -845,7 +845,7 @@ namespace Umbraco.Core.Services.Implement scope.Events.Dispatch(Saved, this, saveEventArgs.ToContentSavedEventArgs(), nameof(Saved)); } scope.Events.Dispatch(TreeChanged, this, treeChanges.ToEventArgs()); - Audit(AuditType.Save, userId == -1 ? 0 : userId, Constants.System.Root, "Saved multiple content"); + Audit(AuditType.Save, userId == -1 ? 0 : userId, ConstantsCore.System.Root, "Saved multiple content"); scope.Complete(); } @@ -854,7 +854,7 @@ namespace Umbraco.Core.Services.Implement } /// - public PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); @@ -953,7 +953,7 @@ namespace Umbraco.Core.Services.Implement } /// - public PublishResult Unpublish(IContent content, string culture = "*", int userId = Constants.Security.SuperUserId) + public PublishResult Unpublish(IContent content, string culture = "*", int userId = ConstantsCore.Security.SuperUserId) { if (content == null) throw new ArgumentNullException(nameof(content)); @@ -1050,7 +1050,7 @@ namespace Umbraco.Core.Services.Implement /// The document is *always* saved, even when publishing fails. /// internal PublishResult CommitDocumentChanges(IContent content, - int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { using (var scope = ScopeProvider.CreateScope()) { @@ -1084,12 +1084,12 @@ namespace Umbraco.Core.Services.Implement /// /// /// Business logic cases such: as unpublishing a mandatory culture, or unpublishing the last culture, checking for pending scheduled publishing, etc... is dealt with in this method. - /// There is quite a lot of cases to take into account along with logic that needs to deal with scheduled saving/publishing, branch saving/publishing, etc... + /// There is quite a lot of cases to take into account along with logic that needs to deal with scheduled saving/publishing, branch saving/publishing, etc... /// /// private PublishResult CommitDocumentChangesInternal(IScope scope, IContent content, ContentSavingEventArgs saveEventArgs, IReadOnlyCollection allLangs, - int userId = Constants.Security.SuperUserId, + int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true, bool branchOne = false, bool branchRoot = false) { if (scope == null) throw new ArgumentNullException(nameof(scope)); @@ -1243,7 +1243,7 @@ namespace Umbraco.Core.Services.Implement if (culturesUnpublishing != null) { // This will mean that that we unpublished a mandatory culture or we unpublished the last culture. - + var langs = string.Join(", ", allLangs .Where(x => culturesUnpublishing.InvariantContains(x.IsoCode)) .Select(x => x.CultureName)); @@ -1266,7 +1266,7 @@ namespace Umbraco.Core.Services.Implement Audit(AuditType.Unpublish, userId, content.Id, "Unpublished (last language unpublished)"); return new PublishResult(PublishResultType.SuccessUnpublishLastCulture, evtMsgs, content); } - + } Audit(AuditType.Unpublish, userId, content.Id); @@ -1286,7 +1286,7 @@ namespace Umbraco.Core.Services.Implement changeType = TreeChangeTypes.RefreshBranch; // whole branch else if (isNew == false && previouslyPublished) changeType = TreeChangeTypes.RefreshNode; // single node - + // invalidate the node/branch if (!branchOne) // for branches, handled by SaveAndPublishBranch @@ -1533,7 +1533,7 @@ namespace Umbraco.Core.Services.Implement } /// - public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = Constants.Security.SuperUserId) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = ConstantsCore.Security.SuperUserId) { // note: EditedValue and PublishedValue are objects here, so it is important to .Equals() // and not to == them, else we would be comparing references, and that is a bad thing @@ -1575,7 +1575,7 @@ namespace Umbraco.Core.Services.Implement } /// - public IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.Security.SuperUserId) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = ConstantsCore.Security.SuperUserId) { // note: EditedValue and PublishedValue are objects here, so it is important to .Equals() // and not to == them, else we would be comparing references, and that is a bad thing @@ -1614,7 +1614,7 @@ namespace Umbraco.Core.Services.Implement internal IEnumerable SaveAndPublishBranch(IContent document, bool force, Func> shouldPublish, Func, IReadOnlyCollection, bool> publishCultures, - int userId = Constants.Security.SuperUserId) + int userId = ConstantsCore.Security.SuperUserId) { if (shouldPublish == null) throw new ArgumentNullException(nameof(shouldPublish)); if (publishCultures == null) throw new ArgumentNullException(nameof(publishCultures)); @@ -1800,7 +1800,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Content object - public void DeleteVersions(int id, DateTime versionDate, int userId = Constants.Security.SuperUserId) + public void DeleteVersions(int id, DateTime versionDate, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -1816,7 +1816,7 @@ namespace Umbraco.Core.Services.Implement deleteRevisionsEventArgs.CanCancel = false; scope.Events.Dispatch(DeletedVersions, this, deleteRevisionsEventArgs); - Audit(AuditType.Delete, userId, Constants.System.Root, "Delete (by version date)"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, "Delete (by version date)"); scope.Complete(); } @@ -1830,7 +1830,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Content object - public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.Security.SuperUserId) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -1852,7 +1852,7 @@ namespace Umbraco.Core.Services.Implement _documentRepository.DeleteVersion(versionId); scope.Events.Dispatch(DeletedVersions, this, new DeleteRevisionsEventArgs(id, false,/* specificVersion:*/ versionId)); - Audit(AuditType.Delete, userId, Constants.System.Root, "Delete (by version)"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, "Delete (by version)"); scope.Complete(); } @@ -1873,7 +1873,7 @@ namespace Umbraco.Core.Services.Implement scope.WriteLock(Constants.Locks.ContentTree); var originalPath = content.Path; - var moveEventInfo = new MoveEventInfo(content, originalPath, Constants.System.RecycleBinContent); + var moveEventInfo = new MoveEventInfo(content, originalPath, ConstantsCore.System.RecycleBinContent); var moveEventArgs = new MoveEventArgs(evtMsgs, moveEventInfo); if (scope.Events.DispatchCancelable(Trashing, this, moveEventArgs, nameof(Trashing))) { @@ -1887,7 +1887,7 @@ namespace Umbraco.Core.Services.Implement //if (content.HasPublishedVersion) //{ } - PerformMoveLocked(content, Constants.System.RecycleBinContent, null, userId, moves, true); + PerformMoveLocked(content, ConstantsCore.System.RecycleBinContent, null, userId, moves, true); scope.Events.Dispatch(TreeChanged, this, new TreeChange(content, TreeChangeTypes.RefreshBranch).ToEventArgs()); var moveInfo = moves @@ -1916,10 +1916,10 @@ namespace Umbraco.Core.Services.Implement /// The to move /// Id of the Content's new Parent /// Optional Id of the User moving the Content - public void Move(IContent content, int parentId, int userId = Constants.Security.SuperUserId) + public void Move(IContent content, int parentId, int userId = ConstantsCore.Security.SuperUserId) { // if moving to the recycle bin then use the proper method - if (parentId == Constants.System.RecycleBinContent) + if (parentId == ConstantsCore.System.RecycleBinContent) { MoveToRecycleBin(content, userId); return; @@ -1931,8 +1931,8 @@ namespace Umbraco.Core.Services.Implement { scope.WriteLock(Constants.Locks.ContentTree); - var parent = parentId == Constants.System.Root ? null : GetById(parentId); - if (parentId != Constants.System.Root && (parent == null || parent.Trashed)) + var parent = parentId == ConstantsCore.System.Root ? null : GetById(parentId); + if (parentId != ConstantsCore.System.Root && (parent == null || parent.Trashed)) throw new InvalidOperationException("Parent does not exist or is trashed."); // causes rollback var moveEventInfo = new MoveEventInfo(content, content.Path, parentId); @@ -2004,7 +2004,7 @@ namespace Umbraco.Core.Services.Implement // if uow is not immediate, content.Path will be updated only when the UOW commits, // and because we want it now, we have to calculate it by ourselves //paths[content.Id] = content.Path; - paths[content.Id] = (parent == null ? (parentId == Constants.System.RecycleBinContent ? "-1,-20" : Constants.System.RootString) : parent.Path) + "," + content.Id; + paths[content.Id] = (parent == null ? (parentId == ConstantsCore.System.RecycleBinContent ? "-1,-20" : ConstantsCore.System.RootString) : parent.Path) + "," + content.Id; const int pageSize = 500; var total = long.MaxValue; @@ -2036,14 +2036,14 @@ namespace Umbraco.Core.Services.Implement /// [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.Security.SuperUserId); + public OperationResult EmptyRecycleBin() => EmptyRecycleBin(ConstantsCore.Security.SuperUserId); /// /// Empties the Recycle Bin by deleting all that resides in the bin /// - public OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId) + public OperationResult EmptyRecycleBin(int userId = ConstantsCore.Security.SuperUserId) { - var nodeObjectType = Constants.ObjectTypes.Document; + var nodeObjectType = ConstantsCore.ObjectTypes.Document; var deleted = new List(); var evtMsgs = EventMessagesFactory.Get(); @@ -2064,7 +2064,7 @@ namespace Umbraco.Core.Services.Implement } // emptying the recycle bin means deleting whatever is in there - do it properly! - var query = Query().Where(x => x.ParentId == Constants.System.RecycleBinContent); + var query = Query().Where(x => x.ParentId == ConstantsCore.System.RecycleBinContent); var contents = _documentRepository.Get(query).ToArray(); foreach (var content in contents) { @@ -2076,7 +2076,7 @@ namespace Umbraco.Core.Services.Implement recycleBinEventArgs.RecycleBinEmptiedSuccessfully = true; // oh my?! scope.Events.Dispatch(EmptiedRecycleBin, this, recycleBinEventArgs); scope.Events.Dispatch(TreeChanged, this, deleted.Select(x => new TreeChange(x, TreeChangeTypes.Remove)).ToEventArgs()); - Audit(AuditType.Delete, userId, Constants.System.RecycleBinContent, "Recycle bin emptied"); + Audit(AuditType.Delete, userId, ConstantsCore.System.RecycleBinContent, "Recycle bin emptied"); scope.Complete(); } @@ -2097,7 +2097,7 @@ namespace Umbraco.Core.Services.Implement /// Boolean indicating whether the copy should be related to the original /// Optional Id of the User copying the Content /// The newly created object - public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = Constants.Security.SuperUserId) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = ConstantsCore.Security.SuperUserId) { return Copy(content, parentId, relateToOriginal, true, userId); } @@ -2112,7 +2112,7 @@ namespace Umbraco.Core.Services.Implement /// A value indicating whether to recursively copy children. /// Optional Id of the User copying the Content /// The newly created object - public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = Constants.Security.SuperUserId) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = ConstantsCore.Security.SuperUserId) { var copy = content.DeepCloneWithResetIdentities(); copy.ParentId = parentId; @@ -2215,7 +2215,7 @@ namespace Umbraco.Core.Services.Implement /// The to send to publication /// Optional Id of the User issuing the send to publication /// True if sending publication was successful otherwise false - public bool SendToPublication(IContent content, int userId = Constants.Security.SuperUserId) + public bool SendToPublication(IContent content, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -2269,7 +2269,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// Result indicating what action was taken when handling the command. - public OperationResult Sort(IEnumerable items, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Sort(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); @@ -2298,7 +2298,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// Result indicating what action was taken when handling the command. - public OperationResult Sort(IEnumerable ids, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Sort(IEnumerable ids, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); @@ -2623,7 +2623,7 @@ namespace Umbraco.Core.Services.Implement // there will be nothing to publish/unpublish. return new PublishResult(PublishResultType.FailedPublishNothingToPublish, evtMsgs, content); } - + // missing mandatory culture = cannot be published var mandatoryCultures = allLangs.Where(x => x.IsMandatory).Select(x => x.IsoCode); @@ -2675,7 +2675,7 @@ namespace Umbraco.Core.Services.Implement // check if the content can be path-published // root content can be published // else check ancestors - we know we are not trashed - var pathIsOk = content.ParentId == Constants.System.Root || IsPathPublished(GetParent(content)); + var pathIsOk = content.ParentId == ConstantsCore.System.Root || IsPathPublished(GetParent(content)); if (!pathIsOk) { Logger.Info("Document {ContentName} (id={ContentId}) cannot be published: {Reason}", content.Name, content.Id, "parent is not published"); @@ -2802,7 +2802,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional Id of the user issuing the delete operation - public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId) + public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = ConstantsCore.Security.SuperUserId) { // TODO: This currently this is called from the ContentTypeService but that needs to change, // if we are deleting a content type, we should just delete the data and do this operation slightly differently. @@ -2849,7 +2849,7 @@ namespace Umbraco.Core.Services.Implement foreach (var child in children) { // see MoveToRecycleBin - PerformMoveLocked(child, Constants.System.RecycleBinContent, null, userId, moves, true); + PerformMoveLocked(child, ConstantsCore.System.RecycleBinContent, null, userId, moves, true); changes.Add(new TreeChange(content, TreeChangeTypes.RefreshBranch)); } @@ -2866,7 +2866,7 @@ namespace Umbraco.Core.Services.Implement scope.Events.Dispatch(Trashed, this, new MoveEventArgs(false, moveInfos), nameof(Trashed)); scope.Events.Dispatch(TreeChanged, this, changes.ToEventArgs()); - Audit(AuditType.Delete, userId, Constants.System.Root, $"Delete content of type {string.Join(",", contentTypeIdsA)}"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, $"Delete content of type {string.Join(",", contentTypeIdsA)}"); scope.Complete(); } @@ -2878,7 +2878,7 @@ namespace Umbraco.Core.Services.Implement /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional id of the user deleting the media - public void DeleteOfType(int contentTypeId, int userId = Constants.Security.SuperUserId) + public void DeleteOfType(int contentTypeId, int userId = ConstantsCore.Security.SuperUserId) { DeleteOfTypes(new[] { contentTypeId }, userId); } @@ -2936,7 +2936,7 @@ namespace Umbraco.Core.Services.Implement } } - public void SaveBlueprint(IContent content, int userId = Constants.Security.SuperUserId) + public void SaveBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId) { //always ensure the blueprint is at the root if (content.ParentId != -1) @@ -2962,7 +2962,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprint(IContent content, int userId = Constants.Security.SuperUserId) + public void DeleteBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -2975,7 +2975,7 @@ namespace Umbraco.Core.Services.Implement private static readonly string[] ArrayOfOneNullString = { null }; - public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = Constants.Security.SuperUserId) + public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = ConstantsCore.Security.SuperUserId) { if (blueprint == null) throw new ArgumentNullException(nameof(blueprint)); @@ -3036,7 +3036,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId) + public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -3063,7 +3063,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfType(int contentTypeId, int userId = Constants.Security.SuperUserId) + public void DeleteBlueprintsOfType(int contentTypeId, int userId = ConstantsCore.Security.SuperUserId) { DeleteBlueprintsOfTypes(new[] { contentTypeId }, userId); } @@ -3072,7 +3072,7 @@ namespace Umbraco.Core.Services.Implement #region Rollback - public OperationResult Rollback(int id, int versionId, string culture = "*", int userId = Constants.Security.SuperUserId) + public OperationResult Rollback(int id, int versionId, string culture = "*", int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); @@ -3134,6 +3134,6 @@ namespace Umbraco.Core.Services.Implement #endregion - + } } diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeService.cs index 206f11e5b0..98907cc081 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeService.cs @@ -29,7 +29,7 @@ namespace Umbraco.Core.Services.Implement private IContentService ContentService { get; } - protected override Guid ContainedObjectType => Constants.ObjectTypes.DocumentType; + protected override Guid ContainedObjectType => ConstantsCore.ObjectTypes.DocumentType; protected override void DeleteItemsOfTypes(IEnumerable typeIds) { diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs index 705a876d83..abb107f8ea 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs @@ -376,7 +376,7 @@ namespace Umbraco.Core.Services.Implement #region Save - public void Save(TItem item, int userId = Constants.Security.SuperUserId) + public void Save(TItem item, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -419,7 +419,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Save(IEnumerable items, int userId = Constants.Security.SuperUserId) + public void Save(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId) { var itemsA = items.ToArray(); @@ -465,7 +465,7 @@ namespace Umbraco.Core.Services.Implement #region Delete - public void Delete(TItem item, int userId = Constants.Security.SuperUserId) + public void Delete(TItem item, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -519,7 +519,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Delete(IEnumerable items, int userId = Constants.Security.SuperUserId) + public void Delete(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId) { var itemsA = items.ToArray(); @@ -740,7 +740,7 @@ namespace Umbraco.Core.Services.Implement protected Guid ContainerObjectType => EntityContainer.GetContainerObjectType(ContainedObjectType); - public Attempt> CreateContainer(int parentId, string name, int userId = Constants.Security.SuperUserId) + public Attempt> CreateContainer(int parentId, string name, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -780,7 +780,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId) + public Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); @@ -874,7 +874,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId) + public Attempt DeleteContainer(int containerId, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -911,7 +911,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId) + public Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) diff --git a/src/Umbraco.Core/Services/Implement/DataTypeService.cs b/src/Umbraco.Core/Services/Implement/DataTypeService.cs index 5a93fb91b1..26b87de7eb 100644 --- a/src/Umbraco.Core/Services/Implement/DataTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/DataTypeService.cs @@ -38,14 +38,14 @@ namespace Umbraco.Core.Services.Implement #region Containers - public Attempt> CreateContainer(int parentId, string name, int userId = Constants.Security.SuperUserId) + public Attempt> CreateContainer(int parentId, string name, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) { try { - var container = new EntityContainer(Constants.ObjectTypes.DataType) + var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = name, ParentId = parentId, @@ -119,13 +119,13 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId) + public Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); - if (container.ContainedObjectType != Constants.ObjectTypes.DataType) + if (container.ContainedObjectType != ConstantsCore.ObjectTypes.DataType) { - var ex = new InvalidOperationException("Not a " + Constants.ObjectTypes.DataType + " container."); + var ex = new InvalidOperationException("Not a " + ConstantsCore.ObjectTypes.DataType + " container."); return OperationResult.Attempt.Fail(evtMsgs, ex); } @@ -153,7 +153,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Succeed(evtMsgs); } - public Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId) + public Attempt DeleteContainer(int containerId, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -186,7 +186,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Succeed(evtMsgs); } - public Attempt> RenameContainer(int id, string name, int userId = Constants.Security.SuperUserId) + public Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -331,7 +331,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issuing the save - public void Save(IDataType dataType, int userId = Constants.Security.SuperUserId) + public void Save(IDataType dataType, int userId = ConstantsCore.Security.SuperUserId) { dataType.CreatorId = userId; @@ -368,7 +368,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issuing the save - public void Save(IEnumerable dataTypeDefinitions, int userId = Constants.Security.SuperUserId) + public void Save(IEnumerable dataTypeDefinitions, int userId = ConstantsCore.Security.SuperUserId) { Save(dataTypeDefinitions, userId, true); } @@ -418,7 +418,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional Id of the user issuing the deletion - public void Delete(IDataType dataType, int userId = Constants.Security.SuperUserId) + public void Delete(IDataType dataType, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/EntityService.cs b/src/Umbraco.Core/Services/Implement/EntityService.cs index 04e2624592..8eed5402f7 100644 --- a/src/Umbraco.Core/Services/Implement/EntityService.cs +++ b/src/Umbraco.Core/Services/Implement/EntityService.cs @@ -318,7 +318,7 @@ namespace Umbraco.Core.Services.Implement var objectTypeGuid = objectType.GetGuid(); var query = Query(); - if (id != Constants.System.Root) + if (id != ConstantsCore.System.Root) { // lookup the path so we can use it in the prefix query below var paths = _entityRepository.GetAllPaths(objectTypeGuid, id).ToArray(); @@ -350,7 +350,7 @@ namespace Umbraco.Core.Services.Implement var objectTypeGuid = objectType.GetGuid(); var query = Query(); - if (idsA.All(x => x != Constants.System.Root)) + if (idsA.All(x => x != ConstantsCore.System.Root)) { var paths = _entityRepository.GetAllPaths(objectTypeGuid, idsA).ToArray(); if (paths.Length == 0) @@ -362,7 +362,7 @@ namespace Umbraco.Core.Services.Implement foreach (var id in idsA) { // if the id is root then don't add any clauses - if (id == Constants.System.Root) continue; + if (id == ConstantsCore.System.Root) continue; var entityPath = paths.FirstOrDefault(x => x.Id == id); if (entityPath == null) continue; @@ -488,7 +488,7 @@ namespace Umbraco.Core.Services.Implement var sql = scope.SqlContext.Sql() .Select() .From() - .Where(x => x.UniqueId == key && x.NodeObjectType == Constants.ObjectTypes.IdReservation); + .Where(x => x.UniqueId == key && x.NodeObjectType == ConstantsCore.ObjectTypes.IdReservation); node = scope.Database.SingleOrDefault(sql); if (node != null) @@ -498,7 +498,7 @@ namespace Umbraco.Core.Services.Implement { UniqueId = key, Text = "RESERVED.ID", - NodeObjectType = Constants.ObjectTypes.IdReservation, + NodeObjectType = ConstantsCore.ObjectTypes.IdReservation, CreateDate = DateTime.Now, UserId = null, diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 26a24e9b98..0e1e051b36 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -74,7 +74,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveStylesheet(Stylesheet stylesheet, int userId = Constants.Security.SuperUserId) + public void SaveStylesheet(Stylesheet stylesheet, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -100,7 +100,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Stylesheet to delete /// - public void DeleteStylesheet(string path, int userId = Constants.Security.SuperUserId) + public void DeleteStylesheet(string path, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -217,7 +217,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveScript(Script script, int userId = Constants.Security.SuperUserId) + public void SaveScript(Script script, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -242,7 +242,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Script to delete /// - public void DeleteScript(string path, int userId = Constants.Security.SuperUserId) + public void DeleteScript(string path, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -338,7 +338,7 @@ namespace Umbraco.Core.Services.Implement /// /// The template created /// - public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = Constants.Security.SuperUserId) + public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = ConstantsCore.Security.SuperUserId) { var template = new Template(contentTypeName, //NOTE: We are NOT passing in the content type alias here, we want to use it's name since we don't @@ -371,7 +371,7 @@ namespace Umbraco.Core.Services.Implement template.Content = content; } - + using (var scope = ScopeProvider.CreateScope()) @@ -403,14 +403,14 @@ namespace Umbraco.Core.Services.Implement /// /// /// - public ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = Constants.Security.SuperUserId) + public ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = ConstantsCore.Security.SuperUserId) { // file might already be on disk, if so grab the content to avoid overwriting var template = new Template(name, alias) { Content = GetViewContent(alias) ?? content }; - + if (masterTemplate != null) { template.SetMasterTemplate(masterTemplate); @@ -537,7 +537,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveTemplate(ITemplate template, int userId = Constants.Security.SuperUserId) + public void SaveTemplate(ITemplate template, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -561,7 +561,7 @@ namespace Umbraco.Core.Services.Implement /// /// List of to save /// Optional id of the user - public void SaveTemplate(IEnumerable templates, int userId = Constants.Security.SuperUserId) + public void SaveTemplate(IEnumerable templates, int userId = ConstantsCore.Security.SuperUserId) { var templatesA = templates.ToArray(); using (var scope = ScopeProvider.CreateScope()) @@ -587,7 +587,7 @@ namespace Umbraco.Core.Services.Implement /// /// Alias of the to delete /// - public void DeleteTemplate(string alias, int userId = Constants.Security.SuperUserId) + public void DeleteTemplate(string alias, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -652,7 +652,7 @@ namespace Umbraco.Core.Services.Implement return _templateRepository.GetFileSize(filepath); } } - + private string GetViewContent(string fileName) { if (fileName.IsNullOrWhiteSpace()) @@ -731,17 +731,17 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId) + public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) { return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId); } - public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId) + public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) { return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId); } - private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = Constants.Security.SuperUserId) + private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) { string partialViewHeader; switch (partialViewType) @@ -805,19 +805,19 @@ namespace Umbraco.Core.Services.Implement } return Attempt.Succeed(partialView); - } + } - public bool DeletePartialView(string path, int userId = Constants.Security.SuperUserId) + public bool DeletePartialView(string path, int userId = ConstantsCore.Security.SuperUserId) { return DeletePartialViewMacro(path, PartialViewType.PartialView, userId); } - public bool DeletePartialViewMacro(string path, int userId = Constants.Security.SuperUserId) + public bool DeletePartialViewMacro(string path, int userId = ConstantsCore.Security.SuperUserId) { return DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId); } - private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = Constants.Security.SuperUserId) + private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -847,17 +847,17 @@ namespace Umbraco.Core.Services.Implement return true; } - public Attempt SavePartialView(IPartialView partialView, int userId = Constants.Security.SuperUserId) + public Attempt SavePartialView(IPartialView partialView, int userId = ConstantsCore.Security.SuperUserId) { return SavePartialView(partialView, PartialViewType.PartialView, userId); } - public Attempt SavePartialViewMacro(IPartialView partialView, int userId = Constants.Security.SuperUserId) + public Attempt SavePartialViewMacro(IPartialView partialView, int userId = ConstantsCore.Security.SuperUserId) { return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId); } - private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = Constants.Security.SuperUserId) + private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -1056,7 +1056,7 @@ namespace Umbraco.Core.Services.Implement } #endregion - + private void Audit(AuditType type, int userId, int objectId, string entityType) { _auditRepository.Save(new AuditItem(objectId, type, userId, entityType)); diff --git a/src/Umbraco.Core/Services/Implement/LocalizationService.cs b/src/Umbraco.Core/Services/Implement/LocalizationService.cs index 251261cfc8..25fe95dd70 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizationService.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizationService.cs @@ -227,7 +227,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional id of the user saving the dictionary item - public void Save(IDictionaryItem dictionaryItem, int userId = Constants.Security.SuperUserId) + public void Save(IDictionaryItem dictionaryItem, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -256,7 +256,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the dictionary item - public void Delete(IDictionaryItem dictionaryItem, int userId = Constants.Security.SuperUserId) + public void Delete(IDictionaryItem dictionaryItem, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -356,7 +356,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional id of the user saving the language - public void Save(ILanguage language, int userId = Constants.Security.SuperUserId) + public void Save(ILanguage language, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -409,7 +409,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the language - public void Delete(ILanguage language, int userId = Constants.Security.SuperUserId) + public void Delete(ILanguage language, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MacroService.cs b/src/Umbraco.Core/Services/Implement/MacroService.cs index a6631aae4c..40234a13e4 100644 --- a/src/Umbraco.Core/Services/Implement/MacroService.cs +++ b/src/Umbraco.Core/Services/Implement/MacroService.cs @@ -81,7 +81,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the macro - public void Delete(IMacro macro, int userId = Constants.Security.SuperUserId) + public void Delete(IMacro macro, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -106,7 +106,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Optional Id of the user deleting the macro - public void Save(IMacro macro, int userId = Constants.Security.SuperUserId) + public void Save(IMacro macro, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs index e9fdedbf33..5bac40cec5 100644 --- a/src/Umbraco.Core/Services/Implement/MediaService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaService.cs @@ -113,7 +113,7 @@ namespace Umbraco.Core.Services.Implement /// Alias of the /// Optional id of the user creating the media item /// - public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { var parent = GetById(parentId); return CreateMedia(name, parent, mediaTypeAlias, userId); @@ -131,7 +131,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { var mediaType = GetMediaType(mediaTypeAlias); if (mediaType == null) @@ -165,7 +165,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { // not locking since not saving anything @@ -199,7 +199,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -232,7 +232,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -264,7 +264,7 @@ namespace Umbraco.Core.Services.Implement /// The alias of the media type. /// The optional id of the user creating the media. /// The media object. - public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.Security.SuperUserId) + public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = ConstantsCore.Security.SuperUserId) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -477,7 +477,7 @@ namespace Umbraco.Core.Services.Implement //null check otherwise we get exceptions if (media.Path.IsNullOrWhiteSpace()) return Enumerable.Empty(); - var rootId = Constants.System.RootString; + var rootId = ConstantsCore.System.RootString; var ids = media.Path.Split(',') .Where(x => x != rootId && x != media.Id.ToString(CultureInfo.InvariantCulture)) .Select(int.Parse) @@ -523,9 +523,9 @@ namespace Umbraco.Core.Services.Implement scope.ReadLock(Constants.Locks.MediaTree); //if the id is System Root, then just get all - if (id != Constants.System.Root) + if (id != ConstantsCore.System.Root) { - var mediaPath = _entityRepository.GetAllPaths(Constants.ObjectTypes.Media, id).ToArray(); + var mediaPath = _entityRepository.GetAllPaths(ConstantsCore.ObjectTypes.Media, id).ToArray(); if (mediaPath.Length == 0) { totalChildren = 0; @@ -570,7 +570,7 @@ namespace Umbraco.Core.Services.Implement /// Parent object public IMedia GetParent(IMedia media) { - if (media.ParentId == Constants.System.Root || media.ParentId == Constants.System.RecycleBinMedia) + if (media.ParentId == ConstantsCore.System.Root || media.ParentId == ConstantsCore.System.RecycleBinMedia) return null; return GetById(media.ParentId); @@ -585,7 +585,7 @@ namespace Umbraco.Core.Services.Implement using (var scope = ScopeProvider.CreateScope(autoComplete: true)) { scope.ReadLock(Constants.Locks.MediaTree); - var query = Query().Where(x => x.ParentId == Constants.System.Root); + var query = Query().Where(x => x.ParentId == ConstantsCore.System.Root); return _mediaRepository.Get(query); } } @@ -600,7 +600,7 @@ namespace Umbraco.Core.Services.Implement ordering = Ordering.By("Path"); scope.ReadLock(Constants.Locks.MediaTree); - var query = Query().Where(x => x.Path.StartsWith(Constants.System.RecycleBinMediaPathPrefix)); + var query = Query().Where(x => x.Path.StartsWith(ConstantsCore.System.RecycleBinMediaPathPrefix)); return _mediaRepository.GetPage(query, pageIndex, pageSize, out totalRecords, filter, ordering); } } @@ -643,7 +643,7 @@ namespace Umbraco.Core.Services.Implement /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - public Attempt Save(IMedia media, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public Attempt Save(IMedia media, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); @@ -691,7 +691,7 @@ namespace Umbraco.Core.Services.Implement /// Collection of to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - public Attempt Save(IEnumerable medias, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public Attempt Save(IEnumerable medias, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); var mediasA = medias.ToArray(); @@ -721,7 +721,7 @@ namespace Umbraco.Core.Services.Implement scope.Events.Dispatch(Saved, this, saveEventArgs); } scope.Events.Dispatch(TreeChanged, this, treeChanges.ToEventArgs()); - Audit(AuditType.Save, userId == -1 ? 0 : userId, Constants.System.Root, "Bulk save media"); + Audit(AuditType.Save, userId == -1 ? 0 : userId, ConstantsCore.System.Root, "Bulk save media"); scope.Complete(); } @@ -738,7 +738,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public Attempt Delete(IMedia media, int userId = Constants.Security.SuperUserId) + public Attempt Delete(IMedia media, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); @@ -799,7 +799,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the object to delete versions from /// Latest version date /// Optional Id of the User deleting versions of a Media object - public void DeleteVersions(int id, DateTime versionDate, int userId = Constants.Security.SuperUserId) + public void DeleteVersions(int id, DateTime versionDate, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -817,13 +817,13 @@ namespace Umbraco.Core.Services.Implement //repository.DeleteVersions(id, versionDate); //uow.Events.Dispatch(DeletedVersions, this, new DeleteRevisionsEventArgs(id, false, dateToRetain: versionDate)); - //Audit(uow, AuditType.Delete, "Delete Media by version date, userId, Constants.System.Root); + //Audit(uow, AuditType.Delete, "Delete Media by version date, userId, ConstantsCore.System.Root); //uow.Complete(); } } - private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = Constants.Security.SuperUserId) + private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = ConstantsCore.Security.SuperUserId) { var args = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate); if (scope.Events.DispatchCancelable(DeletingVersions, this, args)) @@ -835,7 +835,7 @@ namespace Umbraco.Core.Services.Implement args.CanCancel = false; scope.Events.Dispatch(DeletedVersions, this, args); - Audit(AuditType.Delete, userId, Constants.System.Root, "Delete Media by version date"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, "Delete Media by version date"); } /// @@ -846,7 +846,7 @@ namespace Umbraco.Core.Services.Implement /// Id of the version to delete /// Boolean indicating whether to delete versions prior to the versionId /// Optional Id of the User deleting versions of a Media object - public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.Security.SuperUserId) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = ConstantsCore.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -871,7 +871,7 @@ namespace Umbraco.Core.Services.Implement args.CanCancel = false; scope.Events.Dispatch(DeletedVersions, this, args); - Audit(AuditType.Delete, userId, Constants.System.Root, "Delete Media by version"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, "Delete Media by version"); scope.Complete(); } @@ -886,7 +886,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public Attempt MoveToRecycleBin(IMedia media, int userId = Constants.Security.SuperUserId) + public Attempt MoveToRecycleBin(IMedia media, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); var moves = new List>(); @@ -900,7 +900,7 @@ namespace Umbraco.Core.Services.Implement var originalPath = media.Path; - var moveEventInfo = new MoveEventInfo(media, originalPath, Constants.System.RecycleBinMedia); + var moveEventInfo = new MoveEventInfo(media, originalPath, ConstantsCore.System.RecycleBinMedia); var moveEventArgs = new MoveEventArgs(true, evtMsgs, moveEventInfo); if (scope.Events.DispatchCancelable(Trashing, this, moveEventArgs, nameof(Trashing))) { @@ -908,7 +908,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Cancel(evtMsgs); } - PerformMoveLocked(media, Constants.System.RecycleBinMedia, null, userId, moves, true); + PerformMoveLocked(media, ConstantsCore.System.RecycleBinMedia, null, userId, moves, true); scope.Events.Dispatch(TreeChanged, this, new TreeChange(media, TreeChangeTypes.RefreshBranch).ToEventArgs()); var moveInfo = moves.Select(x => new MoveEventInfo(x.Item1, x.Item2, x.Item1.ParentId)) @@ -930,12 +930,12 @@ namespace Umbraco.Core.Services.Implement /// The to move /// Id of the Media's new Parent /// Id of the User moving the Media - public Attempt Move(IMedia media, int parentId, int userId = Constants.Security.SuperUserId) + public Attempt Move(IMedia media, int parentId, int userId = ConstantsCore.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); // if moving to the recycle bin then use the proper method - if (parentId == Constants.System.RecycleBinMedia) + if (parentId == ConstantsCore.System.RecycleBinMedia) { MoveToRecycleBin(media, userId); return OperationResult.Attempt.Succeed(evtMsgs); @@ -947,8 +947,8 @@ namespace Umbraco.Core.Services.Implement { scope.WriteLock(Constants.Locks.MediaTree); - var parent = parentId == Constants.System.Root ? null : GetById(parentId); - if (parentId != Constants.System.Root && (parent == null || parent.Trashed)) + var parent = parentId == ConstantsCore.System.Root ? null : GetById(parentId); + if (parentId != ConstantsCore.System.Root && (parent == null || parent.Trashed)) throw new InvalidOperationException("Parent does not exist or is trashed."); // causes rollback var moveEventInfo = new MoveEventInfo(media, media.Path, parentId); @@ -1004,7 +1004,7 @@ namespace Umbraco.Core.Services.Implement // if uow is not immediate, content.Path will be updated only when the UOW commits, // and because we want it now, we have to calculate it by ourselves //paths[media.Id] = media.Path; - paths[media.Id] = (parent == null ? (parentId == Constants.System.RecycleBinMedia ? "-1,-21" : Constants.System.RootString) : parent.Path) + "," + media.Id; + paths[media.Id] = (parent == null ? (parentId == ConstantsCore.System.RecycleBinMedia ? "-1,-21" : ConstantsCore.System.RootString) : parent.Path) + "," + media.Id; const int pageSize = 500; var page = 0; @@ -1035,15 +1035,15 @@ namespace Umbraco.Core.Services.Implement /// [EditorBrowsable(EditorBrowsableState.Never)] [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")] - public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.Security.SuperUserId); + public OperationResult EmptyRecycleBin() => EmptyRecycleBin(ConstantsCore.Security.SuperUserId); /// /// Empties the Recycle Bin by deleting all that resides in the bin /// /// Optional Id of the User emptying the Recycle Bin - public OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId) + public OperationResult EmptyRecycleBin(int userId = ConstantsCore.Security.SuperUserId) { - var nodeObjectType = Constants.ObjectTypes.Media; + var nodeObjectType = ConstantsCore.ObjectTypes.Media; var deleted = new List(); var evtMsgs = EventMessagesFactory.Get(); // TODO: and then? @@ -1064,7 +1064,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Cancel(evtMsgs); } // emptying the recycle bin means deleting whatever is in there - do it properly! - var query = Query().Where(x => x.ParentId == Constants.System.RecycleBinMedia); + var query = Query().Where(x => x.ParentId == ConstantsCore.System.RecycleBinMedia); var medias = _mediaRepository.Get(query).ToArray(); foreach (var media in medias) { @@ -1074,7 +1074,7 @@ namespace Umbraco.Core.Services.Implement args.CanCancel = false; scope.Events.Dispatch(EmptiedRecycleBin, this, args); scope.Events.Dispatch(TreeChanged, this, deleted.Select(x => new TreeChange(x, TreeChangeTypes.Remove)).ToEventArgs()); - Audit(AuditType.Delete, userId, Constants.System.RecycleBinMedia, "Empty Media recycle bin"); + Audit(AuditType.Delete, userId, ConstantsCore.System.RecycleBinMedia, "Empty Media recycle bin"); scope.Complete(); } @@ -1093,7 +1093,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable items, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) { var itemsA = items.ToArray(); if (itemsA.Length == 0) return true; @@ -1268,7 +1268,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional id of the user deleting the media - public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = Constants.Security.SuperUserId) + public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = ConstantsCore.Security.SuperUserId) { // TODO: This currently this is called from the ContentTypeService but that needs to change, // if we are deleting a content type, we should just delete the data and do this operation slightly differently. @@ -1305,7 +1305,7 @@ namespace Umbraco.Core.Services.Implement foreach (var child in children.Where(x => mediaTypeIdsA.Contains(x.ContentTypeId) == false)) { // see MoveToRecycleBin - PerformMoveLocked(child, Constants.System.RecycleBinMedia, null, userId, moves, true); + PerformMoveLocked(child, ConstantsCore.System.RecycleBinMedia, null, userId, moves, true); changes.Add(new TreeChange(media, TreeChangeTypes.RefreshBranch)); } @@ -1321,7 +1321,7 @@ namespace Umbraco.Core.Services.Implement scope.Events.Dispatch(Trashed, this, new MoveEventArgs(false, moveInfos), nameof(Trashed)); scope.Events.Dispatch(TreeChanged, this, changes.ToEventArgs()); - Audit(AuditType.Delete, userId, Constants.System.Root, $"Delete Media of types {string.Join(",", mediaTypeIdsA)}"); + Audit(AuditType.Delete, userId, ConstantsCore.System.Root, $"Delete Media of types {string.Join(",", mediaTypeIdsA)}"); scope.Complete(); } @@ -1333,7 +1333,7 @@ namespace Umbraco.Core.Services.Implement /// This needs extra care and attention as its potentially a dangerous and extensive operation /// Id of the /// Optional id of the user deleting the media - public void DeleteMediaOfType(int mediaTypeId, int userId = Constants.Security.SuperUserId) + public void DeleteMediaOfType(int mediaTypeId, int userId = ConstantsCore.Security.SuperUserId) { DeleteMediaOfTypes(new[] { mediaTypeId }, userId); } diff --git a/src/Umbraco.Core/Services/Implement/MediaTypeService.cs b/src/Umbraco.Core/Services/Implement/MediaTypeService.cs index 8cb69a655d..9f61cc637f 100644 --- a/src/Umbraco.Core/Services/Implement/MediaTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaTypeService.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Services.Implement private IMediaService MediaService { get; } - protected override Guid ContainedObjectType => Constants.ObjectTypes.MediaType; + protected override Guid ContainedObjectType => ConstantsCore.ObjectTypes.MediaType; protected override void DeleteItemsOfTypes(IEnumerable typeIds) { diff --git a/src/Umbraco.Core/Services/Implement/MemberTypeService.cs b/src/Umbraco.Core/Services/Implement/MemberTypeService.cs index 05f32dc99c..1b78b26c82 100644 --- a/src/Umbraco.Core/Services/Implement/MemberTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/MemberTypeService.cs @@ -28,7 +28,7 @@ namespace Umbraco.Core.Services.Implement private IMemberService MemberService { get; } - protected override Guid ContainedObjectType => Constants.ObjectTypes.MemberType; + protected override Guid ContainedObjectType => ConstantsCore.ObjectTypes.MemberType; protected override void DeleteItemsOfTypes(IEnumerable typeIds) { diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index 2b21945ba8..6792a0b3d1 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -84,13 +84,13 @@ namespace Umbraco.Core.Services.Implement var prevVersionDictionary = new Dictionary(); // see notes above - var id = Constants.Security.SuperUserId; + var id = ConstantsCore.Security.SuperUserId; const int pagesz = 400; // load batches of 400 users do { // users are returned ordered by id, notifications are returned ordered by user id var users = ((UserService)_userService).GetNextUsers(id, pagesz).Where(x => x.IsApproved).ToList(); - var notifications = GetUsersNotifications(users.Select(x => x.Id), action, Enumerable.Empty(), Constants.ObjectTypes.Document).ToList(); + var notifications = GetUsersNotifications(users.Select(x => x.Id), action, Enumerable.Empty(), ConstantsCore.ObjectTypes.Document).ToList(); if (notifications.Count == 0) break; var i = 0; @@ -335,7 +335,7 @@ namespace Umbraco.Core.Services.Implement } summary.Append(""); } - + } else if (content.ContentType.VariesByCulture()) { @@ -462,7 +462,7 @@ namespace Umbraco.Core.Services.Implement oldString = oldString.Replace("”", "”"); oldString = oldString.Replace(""", "\""); } - + // manage notifications // ideally, would need to use IBackgroundTasks - but they are not part of Core! diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index b4dcc70a96..519e2d1686 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -45,7 +45,7 @@ namespace Umbraco.Core.Services.Implement public async Task FetchPackageFileAsync(Guid packageId, Version umbracoVersion, int userId) { //includeHidden = true because we don't care if it's hidden we want to get the file regardless - var url = $"{Constants.PackageRepository.RestApiBaseUrl}/{packageId}?version={umbracoVersion.ToString(3)}&includeHidden=true&asFile=true"; + var url = $"{ConstantsCore.PackageRepository.RestApiBaseUrl}/{packageId}?version={umbracoVersion.ToString(3)}&includeHidden=true&asFile=true"; byte[] bytes; try { @@ -78,7 +78,7 @@ namespace Umbraco.Core.Services.Implement } } - _auditService.Add(AuditType.PackagerInstall, userId, -1, "Package", $"Package {packageId} fetched from {Constants.PackageRepository.DefaultRepositoryId}"); + _auditService.Add(AuditType.PackagerInstall, userId, -1, "Package", $"Package {packageId} fetched from {ConstantsCore.PackageRepository.DefaultRepositoryId}"); return null; } @@ -88,7 +88,7 @@ namespace Umbraco.Core.Services.Implement public CompiledPackage GetCompiledPackageInfo(FileInfo packageFile) => _packageInstallation.ReadPackage(packageFile); - public IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.Security.SuperUserId) + public IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = ConstantsCore.Security.SuperUserId) { if (packageDefinition == null) throw new ArgumentNullException(nameof(packageDefinition)); if (packageDefinition.Id == default) throw new ArgumentException("The package definition has not been persisted"); @@ -106,7 +106,7 @@ namespace Umbraco.Core.Services.Implement return files; } - public InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.Security.SuperUserId) + public InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = ConstantsCore.Security.SuperUserId) { if (packageDefinition == null) throw new ArgumentNullException(nameof(packageDefinition)); if (packageDefinition.Id == default) throw new ArgumentException("The package definition has not been persisted"); @@ -129,7 +129,7 @@ namespace Umbraco.Core.Services.Implement return summary; } - public UninstallationSummary UninstallPackage(string packageName, int userId = Constants.Security.SuperUserId) + public UninstallationSummary UninstallPackage(string packageName, int userId = ConstantsCore.Security.SuperUserId) { //this is ordered by descending version var allPackageVersions = GetInstalledPackageByName(packageName)?.ToList(); @@ -175,7 +175,7 @@ namespace Umbraco.Core.Services.Implement #region Created/Installed Package Repositories - public void DeleteCreatedPackage(int id, int userId = Constants.Security.SuperUserId) + public void DeleteCreatedPackage(int id, int userId = ConstantsCore.Security.SuperUserId) { var package = GetCreatedPackageById(id); if (package == null) return; @@ -208,7 +208,7 @@ namespace Umbraco.Core.Services.Implement if (packageName == null) throw new ArgumentNullException(nameof(packageName)); if (packageVersion == null) throw new ArgumentNullException(nameof(packageVersion)); - //get the latest version installed + //get the latest version installed alreadyInstalled = GetInstalledPackageByName(packageName)?.OrderByDescending(x => SemVersion.Parse(x.Version)).FirstOrDefault(); if (alreadyInstalled == null) return PackageInstallType.NewInstall; @@ -224,7 +224,7 @@ namespace Umbraco.Core.Services.Implement public bool SaveInstalledPackage(PackageDefinition definition) => _installedPackages.SavePackage(definition); - public void DeleteInstalledPackage(int packageId, int userId = Constants.Security.SuperUserId) + public void DeleteInstalledPackage(int packageId, int userId = ConstantsCore.Security.SuperUserId) { var package = GetInstalledPackageById(packageId); if (package == null) return; diff --git a/src/Umbraco.Core/UdiGetterExtensions.cs b/src/Umbraco.Core/UdiGetterExtensions.cs index 5a5ccf5574..09dd293245 100644 --- a/src/Umbraco.Core/UdiGetterExtensions.cs +++ b/src/Umbraco.Core/UdiGetterExtensions.cs @@ -102,11 +102,11 @@ namespace Umbraco.Core if (entity == null) throw new ArgumentNullException("entity"); string entityType; - if (entity.ContainedObjectType == Constants.ObjectTypes.DataType) + if (entity.ContainedObjectType == ConstantsCore.ObjectTypes.DataType) entityType = Constants.UdiEntityType.DataTypeContainer; - else if (entity.ContainedObjectType == Constants.ObjectTypes.DocumentType) + else if (entity.ContainedObjectType == ConstantsCore.ObjectTypes.DocumentType) entityType = Constants.UdiEntityType.DocumentTypeContainer; - else if (entity.ContainedObjectType == Constants.ObjectTypes.MediaType) + else if (entity.ContainedObjectType == ConstantsCore.ObjectTypes.MediaType) entityType = Constants.UdiEntityType.MediaTypeContainer; else throw new NotSupportedException(string.Format("Contained object type {0} is not supported.", entity.ContainedObjectType)); @@ -206,7 +206,7 @@ namespace Umbraco.Core return new StringUdi(entityType, entity.Path.TrimStart('/')).EnsureClosed(); } - + /// /// Gets the entity identifier of the entity. /// diff --git a/src/Umbraco.Core/UdiRange.cs b/src/Umbraco.Core/UdiRange.cs index b70cf43d18..0493f1c880 100644 --- a/src/Umbraco.Core/UdiRange.cs +++ b/src/Umbraco.Core/UdiRange.cs @@ -19,19 +19,19 @@ namespace Umbraco.Core /// /// A . /// An optional selector. - public UdiRange(Udi udi, string selector = Constants.DeploySelector.This) + public UdiRange(Udi udi, string selector = ConstantsCore.DeploySelector.This) { Udi = udi; switch (selector) { - case Constants.DeploySelector.This: + case ConstantsCore.DeploySelector.This: Selector = selector; _uriValue = udi.UriValue; break; - case Constants.DeploySelector.ChildrenOfThis: - case Constants.DeploySelector.DescendantsOfThis: - case Constants.DeploySelector.ThisAndChildren: - case Constants.DeploySelector.ThisAndDescendants: + case ConstantsCore.DeploySelector.ChildrenOfThis: + case ConstantsCore.DeploySelector.DescendantsOfThis: + case ConstantsCore.DeploySelector.ThisAndChildren: + case ConstantsCore.DeploySelector.ThisAndDescendants: Selector = selector; _uriValue = new Uri(Udi + "?" + selector); break; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 9785a51840..58010bdf30 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -177,22 +177,8 @@ - - - - - - - - - - - - - - diff --git a/src/Umbraco.Examine/ContentValueSetValidator.cs b/src/Umbraco.Examine/ContentValueSetValidator.cs index 9555566c53..fa37a19ebb 100644 --- a/src/Umbraco.Examine/ContentValueSetValidator.cs +++ b/src/Umbraco.Examine/ContentValueSetValidator.cs @@ -40,7 +40,7 @@ namespace Umbraco.Examine public bool ValidateRecycleBin(string path, string category) { - var recycleBinId = category == IndexTypes.Content ? Constants.System.RecycleBinContent : Constants.System.RecycleBinMedia; + var recycleBinId = category == IndexTypes.Content ? ConstantsCore.System.RecycleBinContent : ConstantsCore.System.RecycleBinMedia; //check for recycle bin if (PublishedValuesOnly) diff --git a/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfo.cs b/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfo.cs index 28a3be51bf..eb28696082 100644 --- a/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfo.cs +++ b/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfo.cs @@ -14,7 +14,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Umbraco.Infrastructure")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7b88b85c7d5ca2fbc4d07d5a8eca4de41967f335")] [assembly: System.Reflection.AssemblyProductAttribute("Umbraco.Infrastructure")] [assembly: System.Reflection.AssemblyTitleAttribute("Umbraco.Infrastructure")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfoInputs.cache b/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfoInputs.cache index afe98a73c0..d8f8ee50b0 100644 --- a/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfoInputs.cache +++ b/src/Umbraco.Infrastructure/obj/Debug/netstandard2.0/Umbraco.Infrastructure.AssemblyInfoInputs.cache @@ -1 +1 @@ -f8bcbd3d0af73360173272997970e70be70da2d6 +a0aec7f73a91976a27b35551640fb5437d434107 diff --git a/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs b/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs index 1d9de265e9..fcaad0fafa 100644 --- a/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs +++ b/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs @@ -19,7 +19,7 @@ namespace Umbraco.ModelsBuilder.Embedded.BackOffice /// correct CSRF security is adhered to for angular and it also ensures that this controller is not subseptipal to /// global WebApi formatters being changed since this is always forced to only return Angular JSON Specific formats. /// - [UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Settings)] public class ModelsBuilderDashboardController : UmbracoAuthorizedJsonController { private readonly IModelsBuilderConfig _config; diff --git a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs index d6dc1f8c73..d2217df403 100644 --- a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs @@ -30,7 +30,7 @@ namespace Umbraco.Tests.Benchmarks var l = new Lazy(() => f); var factory = new UmbracoDatabaseFactory( "server=.\\SQLExpress;database=YOURDB;user id=YOURUSER;password=YOURPASS", - Constants.DatabaseProviders.SqlServer, + ConstantsCore.DatabaseProviders.SqlServer, logger, new Lazy(() => new MapperCollection(Enumerable.Empty()))); return factory.CreateDatabase(); @@ -40,7 +40,7 @@ namespace Umbraco.Tests.Benchmarks { var f = new UmbracoDatabaseFactory( cstr, - Constants.DatabaseProviders.SqlCe, + ConstantsCore.DatabaseProviders.SqlCe, logger, new Lazy(() => new MapperCollection(Enumerable.Empty()))); return f.CreateDatabase(); diff --git a/src/Umbraco.Tests/CoreThings/UdiTests.cs b/src/Umbraco.Tests/CoreThings/UdiTests.cs index 100b39c548..96c67d4069 100644 --- a/src/Umbraco.Tests/CoreThings/UdiTests.cs +++ b/src/Umbraco.Tests/CoreThings/UdiTests.cs @@ -225,7 +225,7 @@ namespace Umbraco.Tests.CoreThings Assert.AreEqual(Guid.Empty, ((GuidUdi)guidUdi).Guid); // can create a range - var range = new UdiRange(stringUdi, Constants.DeploySelector.ChildrenOfThis); + var range = new UdiRange(stringUdi, ConstantsCore.DeploySelector.ChildrenOfThis); // cannot create invalid ranges Assert.Throws(() => new UdiRange(guidUdi, "x")); @@ -249,14 +249,14 @@ namespace Umbraco.Tests.CoreThings Assert.AreEqual(Constants.UdiEntityType.AnyGuid, dudi.EntityType); Assert.AreEqual(guid, ((GuidUdi)dudi).Guid); - var range = new UdiRange(udi, Constants.DeploySelector.ChildrenOfThis); + var range = new UdiRange(udi, ConstantsCore.DeploySelector.ChildrenOfThis); json = JsonConvert.SerializeObject(range, settings); Assert.AreEqual(string.Format("\"umb://any-guid/{0:N}?children\"", guid), json); var drange = JsonConvert.DeserializeObject(json, settings); Assert.AreEqual(udi, drange.Udi); Assert.AreEqual(string.Format("umb://any-guid/{0:N}", guid), drange.Udi.UriValue.ToString()); - Assert.AreEqual(Constants.DeploySelector.ChildrenOfThis, drange.Selector); + Assert.AreEqual(ConstantsCore.DeploySelector.ChildrenOfThis, drange.Selector); } [Test] diff --git a/src/Umbraco.Tests/Integration/ContentEventsTests.cs b/src/Umbraco.Tests/Integration/ContentEventsTests.cs index 7f103e13e4..ac46601cdf 100644 --- a/src/Umbraco.Tests/Integration/ContentEventsTests.cs +++ b/src/Umbraco.Tests/Integration/ContentEventsTests.cs @@ -1087,7 +1087,7 @@ namespace Umbraco.Tests.Integration [Test] public void EmptyRecycleBinContent() { - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var content = CreateContent(); Assert.IsNotNull(content); @@ -1095,7 +1095,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.MoveToRecycleBin(content); ResetEvents(); - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); Assert.AreEqual(2, _msgCount); Assert.AreEqual(2, _events.Count); @@ -1109,7 +1109,7 @@ namespace Umbraco.Tests.Integration [Test] public void EmptyRecycleBinContents() { - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var content1 = CreateContent(); Assert.IsNotNull(content1); @@ -1120,7 +1120,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.MoveToRecycleBin(content2); ResetEvents(); - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); Assert.AreEqual(3, _msgCount); Assert.AreEqual(4, _events.Count); @@ -1136,7 +1136,7 @@ namespace Umbraco.Tests.Integration [Test] public void EmptyRecycleBinBranch() { - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var content1 = CreateBranch(); Assert.IsNotNull(content1); @@ -1151,7 +1151,7 @@ namespace Umbraco.Tests.Integration var content4C = Children(content1C[2]).ToArray(); var content5C = Children(content1C[3]).ToArray(); - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); Assert.AreEqual(14, _msgCount); Assert.AreEqual(14, _events.Count); @@ -2020,7 +2020,7 @@ namespace Umbraco.Tests.Integration Assert.IsNotNull(content); ResetEvents(); - var copy = ServiceContext.ContentService.Copy(content, Constants.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, ConstantsCore.System.Root, false); Assert.AreEqual(2, _msgCount); Assert.AreEqual(2, _events.Count); @@ -2039,7 +2039,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.SaveAndPublish(content); ResetEvents(); - var copy = ServiceContext.ContentService.Copy(content, Constants.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, ConstantsCore.System.Root, false); Assert.AreEqual(2, _msgCount); Assert.AreEqual(2, _events.Count); @@ -2061,7 +2061,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.Move(content, content2.Id); ResetEvents(); - var copy = ServiceContext.ContentService.Copy(content, Constants.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, ConstantsCore.System.Root, false); Assert.AreEqual(2, _msgCount); Assert.AreEqual(2, _events.Count); @@ -2080,7 +2080,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.SaveAndPublish(content); ResetEvents(); - var copy = ServiceContext.ContentService.Copy(content, Constants.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, ConstantsCore.System.Root, false); var copyC = Children(copy).ToArray(); var copy2C = Children(copyC[0]).ToArray(); diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs index 999d7f040d..ee8785bc86 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/PublishedMediaCache.cs @@ -249,7 +249,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache try { - return eMgr.TryGetIndex(Constants.UmbracoIndexes.InternalIndexName, out var index) ? index.GetSearcher() : null; + return eMgr.TryGetIndex(ConstantsCore.UmbracoIndexes.InternalIndexName, out var index) ? index.GetSearcher() : null; } catch (FileNotFoundException) { @@ -649,7 +649,7 @@ namespace Umbraco.Tests.LegacyXmlPublishedCache private static void InitializeCacheConfig() { - var value = ConfigurationManager.AppSettings[Constants.AppSettings.PublishedMediaCacheSeconds]; + var value = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.PublishedMediaCacheSeconds]; int seconds; if (int.TryParse(value, out seconds) == false) seconds = PublishedMediaCacheTimespanSeconds; diff --git a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs index 447104b7cd..8ba327b0a6 100644 --- a/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Tests/LegacyXmlPublishedCache/XmlStore.cs @@ -454,7 +454,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = Constants.ObjectTypes.Media, + nodeObjectType = ConstantsCore.ObjectTypes.Media, id = mediaId }); xmlDto = xmlDtos.FirstOrDefault(); @@ -486,7 +486,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = Constants.ObjectTypes.Member, + nodeObjectType = ConstantsCore.ObjectTypes.Member, id = memberId }); xmlDto = xmlDtos.FirstOrDefault(); @@ -519,7 +519,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = Constants.ObjectTypes.Document, + nodeObjectType = ConstantsCore.ObjectTypes.Document, id = contentId }); xmlDto = xmlDtos.FirstOrDefault(); @@ -542,7 +542,7 @@ AND (umbracoNode.id=@id)"; // just here to replicate what uQuery was doing and show it can be done // but really - should not be used - return LoadMoreXmlFromDatabase(Constants.ObjectTypes.Media); + return LoadMoreXmlFromDatabase(ConstantsCore.ObjectTypes.Media); } public XmlDocument GetMemberXml() @@ -551,7 +551,7 @@ AND (umbracoNode.id=@id)"; // just here to replicate what uQuery was doing and show it can be done // but really - should not be used - return LoadMoreXmlFromDatabase(Constants.ObjectTypes.Member); + return LoadMoreXmlFromDatabase(ConstantsCore.ObjectTypes.Member); } public XmlDocument GetPreviewXml(int contentId, bool includeSubs) @@ -574,7 +574,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = Constants.ObjectTypes.Document, + nodeObjectType = ConstantsCore.ObjectTypes.Document, path = content.Path, }); @@ -929,7 +929,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; // get xml var xmlDtos = scope.Database.Query(ReadTreeCmsContentXmlSql, - new { nodeObjectType = Constants.ObjectTypes.Document }); + new { nodeObjectType = ConstantsCore.ObjectTypes.Document }); foreach (var xmlDto in xmlDtos) { @@ -961,11 +961,11 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; using (var scope = _scopeProvider.CreateScope()) { - if (nodeObjectType == Constants.ObjectTypes.Document) + if (nodeObjectType == ConstantsCore.ObjectTypes.Document) scope.ReadLock(Constants.Locks.ContentTree); - else if (nodeObjectType == Constants.ObjectTypes.Media) + else if (nodeObjectType == ConstantsCore.ObjectTypes.Media) scope.ReadLock(Constants.Locks.MediaTree); - else if (nodeObjectType == Constants.ObjectTypes.Member) + else if (nodeObjectType == ConstantsCore.ObjectTypes.Member) scope.ReadLock(Constants.Locks.MemberTree); var xmlDtos = scope.Database.Query(ReadMoreCmsContentXmlSql, @@ -1095,7 +1095,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; var xmlDtos = scope.Database.Query(ReadBranchCmsContentXmlSql, new { - nodeObjectType = Constants.ObjectTypes.Document, + nodeObjectType = ConstantsCore.ObjectTypes.Document, path = content.Path + ",%", id = content.Id }); @@ -1273,7 +1273,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; { scope.ReadLock(Constants.Locks.ContentTree); var xmlDtos = scope.Database.Query(ReadCmsContentXmlForContentTypesSql, - new { nodeObjectType = Constants.ObjectTypes.Document, /*@ids =*/ ids }); + new { nodeObjectType = ConstantsCore.ObjectTypes.Document, /*@ids =*/ ids }); foreach (var xmlDto in xmlDtos) { @@ -1699,7 +1699,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; private void RebuildContentXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var contentObjectType = Constants.ObjectTypes.Document; + var contentObjectType = ConstantsCore.ObjectTypes.Document; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1770,7 +1770,7 @@ WHERE cmsContentXml.nodeId IN ( private void RebuildPreviewXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var contentObjectType = Constants.ObjectTypes.Document; + var contentObjectType = ConstantsCore.ObjectTypes.Document; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1845,7 +1845,7 @@ WHERE cmsPreviewXml.nodeId IN ( public void RebuildMediaXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var mediaObjectType = Constants.ObjectTypes.Media; + var mediaObjectType = ConstantsCore.ObjectTypes.Media; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1914,7 +1914,7 @@ WHERE cmsContentXml.nodeId IN ( public void RebuildMemberXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var memberObjectType = Constants.ObjectTypes.Member; + var memberObjectType = ConstantsCore.ObjectTypes.Member; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1986,7 +1986,7 @@ WHERE cmsContentXml.nodeId IN ( // every content item should have a corresponding row in cmsPreviewXml // and that row should have the key="..." attribute - var contentObjectType = Constants.ObjectTypes.Document; + var contentObjectType = ConstantsCore.ObjectTypes.Document; var db = scope.Database; var count = db.ExecuteScalar($@"SELECT COUNT(*) @@ -2027,7 +2027,7 @@ AND cmsPreviewXml.nodeId IS NULL OR cmsPreviewXml.xml NOT LIKE '% key=""' // and that row should have the key="..." attribute // TODO: where's the trashed test here? - var mediaObjectType = Constants.ObjectTypes.Media; + var mediaObjectType = ConstantsCore.ObjectTypes.Media; var db = scope.Database; var count = db.ExecuteScalar($@"SELECT COUNT(*) @@ -2057,7 +2057,7 @@ AND cmsContentXml.nodeId IS NULL OR cmsContentXml.xml NOT LIKE '% key=""' { // every member item should have a corresponding row in cmsContentXml - var memberObjectType = Constants.ObjectTypes.Member; + var memberObjectType = ConstantsCore.ObjectTypes.Member; var db = scope.Database; var count = db.ExecuteScalar(@"SELECT COUNT(*) diff --git a/src/Umbraco.Tests/Models/ContentXmlTest.cs b/src/Umbraco.Tests/Models/ContentXmlTest.cs index fbef2cc103..b5c55523eb 100644 --- a/src/Umbraco.Tests/Models/ContentXmlTest.cs +++ b/src/Umbraco.Tests/Models/ContentXmlTest.cs @@ -25,7 +25,7 @@ namespace Umbraco.Tests.Models ServiceContext.ContentTypeService.Save(contentType); var content = MockedContent.CreateTextpageContent(contentType, "Root Home", -1); - ServiceContext.ContentService.Save(content, Constants.Security.SuperUserId); + ServiceContext.ContentService.Save(content, ConstantsCore.Security.SuperUserId); var nodeName = content.ContentType.Alias.ToSafeAlias(); var urlName = content.GetUrlSegment(new[]{new DefaultUrlSegmentProvider() }); diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 6a4054d5ae..6f7e496cbd 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -74,7 +74,7 @@ namespace Umbraco.Tests.Models.Mapping // v8 is changing this, so the test would report a creator // temp. fixing by assigning super here // - content.CreatorId = Constants.Security.SuperUserId; + content.CreatorId = ConstantsCore.Security.SuperUserId; } [Test] @@ -282,7 +282,7 @@ namespace Umbraco.Tests.Models.Mapping if (ownerId != 0) { Assert.IsNotNull(result.Owner); - Assert.AreEqual(Constants.Security.SuperUserId, result.Owner.UserId); + Assert.AreEqual(ConstantsCore.Security.SuperUserId, result.Owner.UserId); Assert.AreEqual("Administrator", result.Owner.Name); } else @@ -310,7 +310,7 @@ namespace Umbraco.Tests.Models.Mapping if (ownerId != 0) { Assert.IsNotNull(result.Owner); - Assert.AreEqual(Constants.Security.SuperUserId, result.Owner.UserId); + Assert.AreEqual(ConstantsCore.Security.SuperUserId, result.Owner.UserId); Assert.AreEqual("Administrator", result.Owner.Name); } else diff --git a/src/Umbraco.Tests/Models/MediaXmlTest.cs b/src/Umbraco.Tests/Models/MediaXmlTest.cs index 3ae9414dc1..481f43ad09 100644 --- a/src/Umbraco.Tests/Models/MediaXmlTest.cs +++ b/src/Umbraco.Tests/Models/MediaXmlTest.cs @@ -39,7 +39,7 @@ namespace Umbraco.Tests.Models var media = MockedMedia.CreateMediaImage(mediaType, -1); media.WriterId = -1; // else it's zero and that's not a user and it breaks the tests - ServiceContext.MediaService.Save(media, Constants.Security.SuperUserId); + ServiceContext.MediaService.Save(media, ConstantsCore.Security.SuperUserId); // so we have to force-reset these values because the property editor has cleared them media.SetValue(Constants.Conventions.Media.Width, "200"); diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index fb451b1d5c..7965162a28 100644 --- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs +++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs @@ -56,7 +56,7 @@ namespace Umbraco.Tests.Persistence File.Delete(filePath); // get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; // by default the conn string is: Datasource=|DataDirectory|UmbracoNPocoTests.sdf;Flush Interval=1; // replace the SDF file with our own and create the sql ce database diff --git a/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs index 9745caa8c9..bce662406d 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentTypeRepositorySqlClausesTest.cs @@ -16,7 +16,7 @@ namespace Umbraco.Tests.Persistence.Querying [Test] public void Can_Verify_Base_Clause() { - var nodeObjectType = Constants.ObjectTypes.DocumentType; + var nodeObjectType = ConstantsCore.ObjectTypes.DocumentType; var expected = Sql(); expected.Select("*") @@ -52,7 +52,7 @@ namespace Umbraco.Tests.Persistence.Querying [Test] public void Can_Verify_Base_Where_Clause() { - var nodeObjectType = Constants.ObjectTypes.DocumentType; + var nodeObjectType = ConstantsCore.ObjectTypes.DocumentType; var expected = Sql(); expected.SelectAll() diff --git a/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs b/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs index fcf64641c8..f65f05601b 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs @@ -28,11 +28,11 @@ // using (var scope = ScopeProvider.CreateScope()) // { // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55554, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55554", SortOrder = 1, UniqueId = new Guid("87D1EAB6-AB27-4852-B3DF-DE8DBA4A1AA0"), Text = "Template 1", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Template 2", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Content Type 1", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55554, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55554", SortOrder = 1, UniqueId = new Guid("87D1EAB6-AB27-4852-B3DF-DE8DBA4A1AA0"), Text = "Template 1", NodeObjectType = ConstantsCore.ObjectTypes.Template, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Template 2", NodeObjectType = ConstantsCore.ObjectTypes.Template, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Content Type 1", NodeObjectType = ConstantsCore.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Content Type 2", NodeObjectType = ConstantsCore.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Content Type 2", NodeObjectType = ConstantsCore.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsTemplate")))); @@ -93,9 +93,9 @@ // using (var scope = ScopeProvider.CreateScope()) // { // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Media Type 1", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Media Type 1", NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Media Type 2", NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Media Type 2", NodeObjectType = ConstantsCore.ObjectTypes.MediaType, CreateDate = DateTime.Now }); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsContentType")))); @@ -145,8 +145,8 @@ // using (var scope = ScopeProvider.CreateScope()) // { // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Test Data Type", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); -// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("129241F0-D24E-4FC3-92D1-BC2D48B7C431"), Text = "Test Content Type", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Test Data Type", NodeObjectType = ConstantsCore.ObjectTypes.DataType, CreateDate = DateTime.Now }); +// scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("129241F0-D24E-4FC3-92D1-BC2D48B7C431"), Text = "Test Content Type", NodeObjectType = ConstantsCore.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); // scope.Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 55555, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" }); diff --git a/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs index 53bc6e5c68..6abb355a2a 100644 --- a/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs @@ -15,7 +15,7 @@ namespace Umbraco.Tests.Persistence.Querying [Test] public void Can_Verify_Base_Clause() { - var NodeObjectTypeId = Constants.ObjectTypes.DataType; + var NodeObjectTypeId = ConstantsCore.ObjectTypes.DataType; var expected = new Sql(); expected.Select("*") diff --git a/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs index 8ff0dd2a0d..9f1c984372 100644 --- a/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/MediaRepositorySqlClausesTest.cs @@ -15,7 +15,7 @@ namespace Umbraco.Tests.Persistence.Querying [Test] public void Can_Verify_Base_Clause() { - var nodeObjectTypeId = Constants.ObjectTypes.Media; + var nodeObjectTypeId = ConstantsCore.ObjectTypes.Media; var expected = new Sql(); expected.Select("*") diff --git a/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs index bcb62ec770..5d5e839f52 100644 --- a/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs +++ b/src/Umbraco.Tests/Persistence/Querying/MediaTypeRepositorySqlClausesTest.cs @@ -15,7 +15,7 @@ namespace Umbraco.Tests.Persistence.Querying [Test] public void Can_Verify_Base_Clause() { - var NodeObjectTypeId = Constants.ObjectTypes.MediaType; + var NodeObjectTypeId = ConstantsCore.ObjectTypes.MediaType; var expected = new Sql(); expected.Select("*") diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs index f953b9cce6..59694c9424 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -106,13 +106,13 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.DocumentTypeContainer); var repository = CreateRepository((IScopeAccessor) provider); - var container1 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "blah1" }; + var container1 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah1" }; containerRepository.Save(container1); - var container2 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "blah2", ParentId = container1.Id }; + var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah2", ParentId = container1.Id }; containerRepository.Save(container2); @@ -152,8 +152,8 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); - var container = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "blah" }; + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.DocumentTypeContainer); + var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah" }; containerRepository.Save(container); Assert.That(container.Id, Is.GreaterThan(0)); @@ -171,13 +171,13 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.DocumentTypeContainer); - container1 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "container1" }; + container1 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container1" }; containerRepository.Save(container1); - container2 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "container2" }; + container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container2" }; containerRepository.Save(container2); - container3 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "container3" }; + container3 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container3" }; containerRepository.Save(container3); Assert.That(container1.Id, Is.GreaterThan(0)); @@ -201,8 +201,8 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); - var container = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "blah" }; + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.DocumentTypeContainer); + var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah" }; containerRepository.Save(container); @@ -221,9 +221,9 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.MediaTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.MediaTypeContainer); var repository = CreateRepository((IScopeAccessor) provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); @@ -242,9 +242,9 @@ namespace Umbraco.Tests.Persistence.Repositories var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) { - var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.MediaTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, ConstantsCore.ObjectTypes.MediaTypeContainer); var repository = CreateMediaTypeRepository((IScopeAccessor) provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); @@ -653,7 +653,7 @@ namespace Umbraco.Tests.Persistence.Repositories int count = scope.Database.ExecuteScalar( "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType", - new {NodeObjectType = Constants.ObjectTypes.DocumentType}); + new {NodeObjectType = ConstantsCore.ObjectTypes.DocumentType}); // Assert Assert.That(contentTypes.Any(), Is.True); @@ -676,7 +676,7 @@ namespace Umbraco.Tests.Persistence.Repositories int count = scope.Database.ExecuteScalar( "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType", - new { NodeObjectType = Constants.ObjectTypes.DocumentType }); + new { NodeObjectType = ConstantsCore.ObjectTypes.DocumentType }); // Assert Assert.That(contentTypes.Any(), Is.True); diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index ca8ee29ee3..aa9daf3d65 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -25,7 +25,7 @@ namespace Umbraco.Tests.Persistence.Repositories private EntityContainerRepository CreateContainerRepository(IScopeAccessor scopeAccessor) { - return new EntityContainerRepository(scopeAccessor, AppCaches.Disabled, Logger, Constants.ObjectTypes.DataTypeContainer); + return new EntityContainerRepository(scopeAccessor, AppCaches.Disabled, Logger, ConstantsCore.ObjectTypes.DataTypeContainer); } [Test] @@ -100,10 +100,10 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(accessor); var repository = CreateRepository(); - var container1 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah1" }; + var container1 = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah1" }; containerRepository.Save(container1); - var container2 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id }; + var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id }; containerRepository.Save(container2); var dataType = (IDataType) new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService), container2.Id) @@ -142,7 +142,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (provider.CreateScope()) { var containerRepository = CreateContainerRepository(accessor); - var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; containerRepository.Save(container); Assert.That(container.Id, Is.GreaterThan(0)); @@ -161,7 +161,7 @@ namespace Umbraco.Tests.Persistence.Repositories using (provider.CreateScope()) { var containerRepository = CreateContainerRepository(accessor); - var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; containerRepository.Save(container); // Act @@ -182,7 +182,7 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(accessor); var repository = CreateRepository(); - var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; containerRepository.Save(container); var dataTypeDefinition = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService), container.Id) { Name = "test" }; @@ -202,7 +202,7 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(accessor); var repository = CreateRepository(); - var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; containerRepository.Save(container); IDataType dataType = new DataType(new RadioButtonsPropertyEditor(Logger, ServiceContext.TextService), container.Id) { Name = "test" }; @@ -254,7 +254,7 @@ namespace Umbraco.Tests.Persistence.Repositories { var repository = CreateRepository(); // Act - var dataTypeDefinition = repository.Get(Constants.DataTypes.DropDownSingle); + var dataTypeDefinition = repository.Get(ConstantsCore.DataTypes.DropDownSingle); // Assert Assert.That(dataTypeDefinition, Is.Not.Null); diff --git a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs index bb3286daed..757f1b74e0 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs @@ -29,7 +29,7 @@ namespace Umbraco.Tests.Persistence.Repositories private EntityContainerRepository CreateContainerRepository(IScopeProvider provider) { - return new EntityContainerRepository((IScopeAccessor) provider, AppCaches.Disabled, Logger, Constants.ObjectTypes.MediaTypeContainer); + return new EntityContainerRepository((IScopeAccessor) provider, AppCaches.Disabled, Logger, ConstantsCore.ObjectTypes.MediaTypeContainer); } @@ -42,18 +42,18 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container1 = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah1" }; + var container1 = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah1" }; containerRepository.Save(container1); - - var container2 = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah2", ParentId = container1.Id }; + + var container2 = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah2", ParentId = container1.Id }; containerRepository.Save(container2); - + var contentType = (IMediaType)MockedContentTypes.CreateVideoMediaType(); contentType.ParentId = container2.Id; repository.Save(contentType); - + //create a var contentType2 = (IMediaType)new MediaType(contentType, "hello") @@ -62,10 +62,10 @@ namespace Umbraco.Tests.Persistence.Repositories }; contentType.ParentId = contentType.Id; repository.Save(contentType2); - + var result = repository.Move(contentType, container1).ToArray(); - + Assert.AreEqual(2, result.Length); @@ -88,9 +88,9 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); - + Assert.That(container.Id, Is.GreaterThan(0)); var found = containerRepository.Get(container.Id); @@ -106,14 +106,14 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); - + Assert.That(container.Id, Is.GreaterThan(0)); // Act containerRepository.Delete(container); - + var found = containerRepository.Get(container.Id); Assert.IsNull(found); @@ -129,14 +129,14 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); - + var contentType = MockedContentTypes.CreateVideoMediaType(); contentType.ParentId = container.Id; repository.Save(contentType); - + Assert.AreEqual(container.Id, contentType.ParentId); } @@ -151,18 +151,18 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); - + IMediaType contentType = MockedContentTypes.CreateVideoMediaType(); contentType.ParentId = container.Id; repository.Save(contentType); - + // Act containerRepository.Delete(container); - + var found = containerRepository.Get(container.Id); Assert.IsNull(found); @@ -185,7 +185,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var contentType = MockedContentTypes.CreateVideoMediaType(); repository.Save(contentType); - + var fetched = repository.Get(contentType.Id); @@ -212,7 +212,7 @@ namespace Umbraco.Tests.Persistence.Repositories var videoMediaType = MockedContentTypes.CreateVideoMediaType(); repository.Save(videoMediaType); - + // Act var mediaType = repository.Get(NodeDto.NodeIdSeed); @@ -227,7 +227,7 @@ namespace Umbraco.Tests.Persistence.Repositories DataTypeId = -88 }); repository.Save(mediaType); - + var dirty = ((MediaType) mediaType).IsDirty(); @@ -251,11 +251,11 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var mediaType = MockedContentTypes.CreateVideoMediaType(); repository.Save(mediaType); - + var contentType2 = repository.Get(mediaType.Id); repository.Delete(contentType2); - + var exists = repository.Exists(mediaType.Id); @@ -318,7 +318,7 @@ namespace Umbraco.Tests.Persistence.Repositories int count = scope.Database.ExecuteScalar( "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType", - new { NodeObjectType = Constants.ObjectTypes.MediaType }); + new { NodeObjectType = ConstantsCore.ObjectTypes.MediaType }); // Assert Assert.That(mediaTypes.Any(), Is.True); @@ -344,7 +344,7 @@ namespace Umbraco.Tests.Persistence.Repositories int count = scope.Database.ExecuteScalar( "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType", - new { NodeObjectType = Constants.ObjectTypes.MediaType }); + new { NodeObjectType = ConstantsCore.ObjectTypes.MediaType }); // Assert Assert.That(mediaTypes.Any(), Is.True); @@ -380,13 +380,13 @@ namespace Umbraco.Tests.Persistence.Repositories var mediaType = MockedContentTypes.CreateVideoMediaType(); repository.Save(mediaType); - + // Act var mediaTypeV2 = repository.Get(NodeDto.NodeIdSeed); mediaTypeV2.PropertyGroups["Media"].PropertyTypes.Remove("title"); repository.Save(mediaTypeV2); - + var mediaTypeV3 = repository.Get(NodeDto.NodeIdSeed); @@ -408,7 +408,7 @@ namespace Umbraco.Tests.Persistence.Repositories var mediaType = MockedContentTypes.CreateVideoMediaType(); repository.Save(mediaType); - + // Act var contentType = repository.Get(NodeDto.NodeIdSeed); diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs index 17b16ad7ab..45b7c7ee62 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs @@ -366,6 +366,6 @@ namespace Umbraco.Tests.Persistence.Repositories return sql; } - private Guid NodeObjectTypeId => Constants.ObjectTypes.Member; + private Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Member; } } diff --git a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs index 12fa1bb9bb..64b5b53ce7 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs @@ -31,14 +31,14 @@ namespace Umbraco.Tests.Persistence.Repositories { CreateDate = DateTime.Now, Level = 1, - NodeObjectType = Constants.ObjectTypes.ContentItem, + NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,123", SortOrder = 1, Text = "hello", Trashed = false, UniqueId = Guid.NewGuid(), - UserId = Constants.Security.SuperUserId + UserId = ConstantsCore.Security.SuperUserId }; var result = scope.Database.Insert(node); var entity = Mock.Of(e => e.Id == node.NodeId); @@ -66,11 +66,11 @@ namespace Umbraco.Tests.Persistence.Repositories scope.Database.Insert(userDto); var userNew = Mock.Of(e => e.Id == userDto.Id); - var userAdmin = Mock.Of(e => e.Id == Constants.Security.SuperUserId); + var userAdmin = Mock.Of(e => e.Id == ConstantsCore.Security.SuperUserId); for (var i = 0; i < 10; i++) { - var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; var result = scope.Database.Insert(node); var entity = Mock.Of(e => e.Id == node.NodeId); var notification = repo.CreateNotification((i%2 == 0) ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture)); @@ -91,10 +91,10 @@ namespace Umbraco.Tests.Persistence.Repositories var repo = new NotificationsRepository((IScopeAccessor) provider); - var node1 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node1 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; scope.Database.Insert(node1); var entity1 = Mock.Of(e => e.Id == node1.NodeId); - var node2 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node2 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; scope.Database.Insert(node2); var entity2 = Mock.Of(e => e.Id == node2.NodeId); @@ -121,10 +121,10 @@ namespace Umbraco.Tests.Persistence.Repositories var repo = new NotificationsRepository((IScopeAccessor) provider); - var node1 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node1 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; scope.Database.Insert(node1); var entity1 = Mock.Of(e => e.Id == node1.NodeId); - var node2 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node2 = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; scope.Database.Insert(node2); var entity2 = Mock.Of(e => e.Id == node2.NodeId); @@ -155,11 +155,11 @@ namespace Umbraco.Tests.Persistence.Repositories scope.Database.Insert(userDto); var userNew = Mock.Of(e => e.Id == userDto.Id); - var userAdmin = Mock.Of(e => e.Id == Constants.Security.SuperUserId); + var userAdmin = Mock.Of(e => e.Id == ConstantsCore.Security.SuperUserId); for (var i = 0; i < 10; i++) { - var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; + var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = ConstantsCore.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = -1 }; var result = scope.Database.Insert(node); var entity = Mock.Of(e => e.Id == node.NodeId); var notification = repo.CreateNotification((i%2 == 0) ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture)); diff --git a/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs index cea7f44b71..b6c82b2d97 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs @@ -49,7 +49,7 @@ namespace Umbraco.Tests.Persistence.Repositories var relationType = repositoryType.Get(1); var relation = new Relation(NodeDto.NodeIdSeed + 2, NodeDto.NodeIdSeed + 3, relationType); repository.Save(relation); - + // Assert Assert.That(relation, Is.Not.Null); @@ -71,7 +71,7 @@ namespace Umbraco.Tests.Persistence.Repositories var relation = repository.Get(1); relation.Comment = "This relation has been updated"; repository.Save(relation); - + var relationUpdated = repository.Get(1); @@ -95,7 +95,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var relation = repository.Get(2); repository.Delete(relation); - + var exists = repository.Exists(2); @@ -260,8 +260,8 @@ namespace Umbraco.Tests.Persistence.Repositories public void CreateTestData() { - var relateContent = new RelationType(Constants.ObjectTypes.Document, new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; - var relateContentType = new RelationType(Constants.ObjectTypes.DocumentType, new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; + var relateContent = new RelationType(ConstantsCore.ObjectTypes.Document, new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; + var relateContentType = new RelationType(ConstantsCore.ObjectTypes.DocumentType, new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) @@ -270,7 +270,7 @@ namespace Umbraco.Tests.Persistence.Repositories var relationRepository = new RelationRepository((IScopeAccessor) provider, Mock.Of(), relationTypeRepository); relationTypeRepository.Save(relateContent); - relationTypeRepository.Save(relateContentType); + relationTypeRepository.Save(relateContentType); //Create and Save ContentType "umbTextpage" -> (NodeDto.NodeIdSeed) ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage"); diff --git a/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs index e52e2dfcdf..9e6db3f297 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs @@ -42,8 +42,8 @@ namespace Umbraco.Tests.Persistence.Repositories var repository = CreateRepository(provider); // Act - var relateMemberToContent = new RelationType(Constants.ObjectTypes.Member, - Constants.ObjectTypes.Document, + var relateMemberToContent = new RelationType(ConstantsCore.ObjectTypes.Member, + ConstantsCore.ObjectTypes.Document, "relateMemberToContent") { IsBidirectional = true, Name = "Relate Member to Content" }; repository.Save(relateMemberToContent); @@ -206,7 +206,7 @@ namespace Umbraco.Tests.Persistence.Repositories var repository = CreateRepository(provider); // Act - var childObjType = Constants.ObjectTypes.DocumentType; + var childObjType = ConstantsCore.ObjectTypes.DocumentType; var query = scope.SqlContext.Query().Where(x => x.ChildObjectType == childObjType); var result = repository.Get(query); @@ -226,8 +226,8 @@ namespace Umbraco.Tests.Persistence.Repositories public void CreateTestData() { - var relateContent = new RelationType(Constants.ObjectTypes.Document, new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; - var relateContentType = new RelationType(Constants.ObjectTypes.DocumentType, new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; + var relateContent = new RelationType(ConstantsCore.ObjectTypes.Document, new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; + var relateContentType = new RelationType(ConstantsCore.ObjectTypes.DocumentType, new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = TestObjects.GetScopeProvider(Logger); using (var scope = ScopeProvider.CreateScope()) diff --git a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs index 3e5919d7f3..1fe137bcc8 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs @@ -362,7 +362,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var result = repository.GetPagedResultsByQuery(query, 0, 10, out var totalRecs, user => user.Id, Direction.Ascending, - excludeUserGroups: new[] { Constants.Security.TranslatorGroupAlias }, + excludeUserGroups: new[] { ConstantsCore.Security.TranslatorGroupAlias }, filter: provider.SqlContext.Query().Where(x => x.Id > -1)); // Assert @@ -394,8 +394,8 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var result = repository.GetPagedResultsByQuery(null, 0, 10, out var totalRecs, user => user.Id, Direction.Ascending, - includeUserGroups: new[] { Constants.Security.AdminGroupAlias, Constants.Security.SensitiveDataGroupAlias }, - excludeUserGroups: new[] { Constants.Security.TranslatorGroupAlias }, + includeUserGroups: new[] { ConstantsCore.Security.AdminGroupAlias, ConstantsCore.Security.SensitiveDataGroupAlias }, + excludeUserGroups: new[] { ConstantsCore.Security.TranslatorGroupAlias }, filter: provider.SqlContext.Query().Where(x => x.Id == -1)); // Assert diff --git a/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs b/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs index 1d87bb35e7..2fe71e7681 100644 --- a/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs +++ b/src/Umbraco.Tests/Persistence/SyntaxProvider/SqlCeSyntaxProviderTests.cs @@ -26,7 +26,7 @@ namespace Umbraco.Tests.Persistence.SyntaxProvider [Test] public void Can_Generate_Delete_SubQuery_Statement() { - var mediaObjectType = Constants.ObjectTypes.Media; + var mediaObjectType = ConstantsCore.ObjectTypes.Media; var subQuery = Sql() .Select("DISTINCT cmsContentXml.nodeId") .From() diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs index 2aa01916fb..b900550de3 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs @@ -22,10 +22,10 @@ namespace Umbraco.Tests.Routing var properties = new[] { - new PublishedPropertyType("umbracoUrlAlias", Constants.DataTypes.Textbox, false, ContentVariation.Nothing, + new PublishedPropertyType("umbracoUrlAlias", ConstantsCore.DataTypes.Textbox, false, ContentVariation.Nothing, new PropertyValueConverterCollection(Enumerable.Empty()), Mock.Of(), - Mock.Of()), + Mock.Of()), }; _publishedContentType = new PublishedContentType(0, "Doc", PublishedItemType.Content, Enumerable.Empty(), properties, ContentVariation.Nothing); } diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs index 0c1f89f430..6a56feaad9 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs @@ -20,10 +20,10 @@ namespace Umbraco.Tests.Routing var properties = new[] { - new PublishedPropertyType("umbracoUrlAlias", Constants.DataTypes.Textbox, false, ContentVariation.Nothing, + new PublishedPropertyType("umbracoUrlAlias", ConstantsCore.DataTypes.Textbox, false, ContentVariation.Nothing, new PropertyValueConverterCollection(Enumerable.Empty()), Mock.Of(), - Mock.Of()), + Mock.Of()), }; _publishedContentType = new PublishedContentType(0, "Doc", PublishedItemType.Content, Enumerable.Empty(), properties, ContentVariation.Nothing); } diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs index d0258a100f..b83f3b4ba6 100644 --- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs +++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs @@ -52,7 +52,7 @@ namespace Umbraco.Tests.Runtimes // settings // reset the current version to 0.0.0, clear connection strings - ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus] = ""; + ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ConfigurationStatus] = ""; // FIXME: we need a better management of settings here (and, true config files?) // create the very basic and essential things we need diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index 2b04a02f46..f637db83d2 100644 --- a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs +++ b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs @@ -27,7 +27,7 @@ namespace Umbraco.Tests.Security public void ShouldAuthenticateRequest_When_Not_Configured() { //should force app ctx to show not-configured - ConfigurationManager.AppSettings.Set(Constants.AppSettings.ConfigurationStatus, ""); + ConfigurationManager.AppSettings.Set(ConstantsCore.AppSettings.ConfigurationStatus, ""); var globalSettings = TestObjects.GetGlobalSettings(); var umbracoContext = new UmbracoContext( diff --git a/src/Umbraco.Tests/Security/UmbracoBackOfficeIdentityTests.cs b/src/Umbraco.Tests/Security/UmbracoBackOfficeIdentityTests.cs index acb53a895a..073fcafbd5 100644 --- a/src/Umbraco.Tests/Security/UmbracoBackOfficeIdentityTests.cs +++ b/src/Umbraco.Tests/Security/UmbracoBackOfficeIdentityTests.cs @@ -30,13 +30,13 @@ namespace Umbraco.Tests.Security //This is the id that 'identity' uses to check for the username new Claim(ClaimTypes.Name, "testing", ClaimValueTypes.String, TestIssuer, TestIssuer), new Claim(ClaimTypes.GivenName, "hello world", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.StartContentNodeIdClaimType, "-1", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), - new Claim(Constants.Security.StartMediaNodeIdClaimType, "5543", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), - new Claim(Constants.Security.StartMediaNodeIdClaimType, "5555", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), - new Claim(Constants.Security.AllowedApplicationsClaimType, "content", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.AllowedApplicationsClaimType, "media", ClaimValueTypes.String, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.StartContentNodeIdClaimType, "-1", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.StartMediaNodeIdClaimType, "5543", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.StartMediaNodeIdClaimType, "5555", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, "content", ClaimValueTypes.String, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, "media", ClaimValueTypes.String, TestIssuer, TestIssuer), new Claim(ClaimTypes.Locality, "en-us", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.SessionIdClaimType, sessionId, Constants.Security.SessionIdClaimType, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, ConstantsCore.Security.SessionIdClaimType, TestIssuer, TestIssuer), new Claim(ClaimsIdentity.DefaultRoleClaimType, "admin", ClaimValueTypes.String, TestIssuer, TestIssuer), new Claim(Microsoft.AspNet.Identity.Constants.DefaultSecurityStampClaimType, securityStamp, ClaimValueTypes.String, TestIssuer, TestIssuer), }); @@ -79,12 +79,12 @@ namespace Umbraco.Tests.Security new Claim(ClaimTypes.NameIdentifier, "", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), new Claim(ClaimTypes.Name, "testing", ClaimValueTypes.String, TestIssuer, TestIssuer), new Claim(ClaimTypes.GivenName, "hello world", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.StartContentNodeIdClaimType, "-1", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), - new Claim(Constants.Security.StartMediaNodeIdClaimType, "5543", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), - new Claim(Constants.Security.AllowedApplicationsClaimType, "content", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.AllowedApplicationsClaimType, "media", ClaimValueTypes.String, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.StartContentNodeIdClaimType, "-1", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.StartMediaNodeIdClaimType, "5543", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, "content", ClaimValueTypes.String, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, "media", ClaimValueTypes.String, TestIssuer, TestIssuer), new Claim(ClaimTypes.Locality, "en-us", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(Constants.Security.SessionIdClaimType, sessionId, Constants.Security.SessionIdClaimType, TestIssuer, TestIssuer), + new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, ConstantsCore.Security.SessionIdClaimType, TestIssuer, TestIssuer), new Claim(ClaimsIdentity.DefaultRoleClaimType, "admin", ClaimValueTypes.String, TestIssuer, TestIssuer), }); @@ -96,7 +96,7 @@ namespace Umbraco.Tests.Security public void Create_With_Claims_And_User_Data() { var sessionId = Guid.NewGuid().ToString(); - + var claimsIdentity = new ClaimsIdentity(new[] { new Claim("TestClaim1", "test", ClaimValueTypes.Integer32, TestIssuer, TestIssuer), diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index e26e764cd1..e673cfa584 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -68,7 +68,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); contentTypeService.Save(contentType); - var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", ConstantsCore.System.Root); blueprint.SetValue("title", "blueprint 1"); blueprint.SetValue("bodyText", "blueprint 2"); blueprint.SetValue("keywords", "blueprint 3"); @@ -94,7 +94,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); contentTypeService.Save(contentType); - var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", ConstantsCore.System.Root); blueprint.SetValue("title", "blueprint 1"); blueprint.SetValue("bodyText", "blueprint 2"); blueprint.SetValue("keywords", "blueprint 3"); @@ -120,7 +120,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); contentTypeService.Save(contentType); - var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", ConstantsCore.System.Root); blueprint.SetValue("title", "blueprint 1"); blueprint.SetValue("bodyText", "blueprint 2"); blueprint.SetValue("keywords", "blueprint 3"); @@ -155,7 +155,7 @@ namespace Umbraco.Tests.Services for (int i = 0; i < 10; i++) { - var blueprint = MockedContent.CreateTextpageContent(i % 2 == 0 ? ct1 : ct2, "hello" + i, Constants.System.Root); + var blueprint = MockedContent.CreateTextpageContent(i % 2 == 0 ? ct1 : ct2, "hello" + i, ConstantsCore.System.Root); contentService.SaveBlueprint(blueprint); } @@ -266,10 +266,10 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); content.ContentSchedule.Add(null, DateTime.Now.AddHours(2)); - contentService.Save(content, Constants.Security.SuperUserId); + contentService.Save(content, ConstantsCore.Security.SuperUserId); Assert.AreEqual(1, content.ContentSchedule.FullSchedule.Count); content = contentService.GetById(content.Id); @@ -277,7 +277,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(1, sched.Count); Assert.AreEqual(1, sched.Count(x => x.Culture == string.Empty)); content.ContentSchedule.Clear(ContentScheduleAction.Expire); - contentService.Save(content, Constants.Security.SuperUserId); + contentService.Save(content, ConstantsCore.Security.SuperUserId); // Assert @@ -294,7 +294,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); for (var i = 0; i < 20; i++) { content.SetValue("bodyText", "hello world " + Guid.NewGuid()); @@ -319,7 +319,7 @@ namespace Umbraco.Tests.Services var results = new List(); for (var i = 0; i < 20; i++) { - results.Add(contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", 0)); + results.Add(contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", 0)); } var sortedGet = contentService.GetByIds(new[] {results[10].Id, results[5].Id, results[12].Id}).ToArray(); @@ -339,7 +339,7 @@ namespace Umbraco.Tests.Services // Act for (int i = 0; i < 20; i++) { - contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); } // Assert @@ -358,7 +358,7 @@ namespace Umbraco.Tests.Services // Act for (int i = 0; i < 20; i++) { - contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.Security.SuperUserId); + contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); } // Assert @@ -373,7 +373,7 @@ namespace Umbraco.Tests.Services var contentTypeService = ServiceContext.ContentTypeService; var contentType = MockedContentTypes.CreateSimpleContentType("umbBlah", "test Doc Type"); contentTypeService.Save(contentType); - var parent = contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.Security.SuperUserId); + var parent = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); // Act for (int i = 0; i < 20; i++) @@ -393,7 +393,7 @@ namespace Umbraco.Tests.Services var contentTypeService = ServiceContext.ContentTypeService; var contentType = MockedContentTypes.CreateSimpleContentType("umbBlah", "test Doc Type"); contentTypeService.Save(contentType); - var parent = contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.Security.SuperUserId); + var parent = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); // Act IContent current = parent; @@ -427,7 +427,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.Create("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); // Assert Assert.That(content, Is.Not.Null); @@ -441,7 +441,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.Create("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); // Assert Assert.That(content, Is.Not.Null); @@ -455,12 +455,12 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.Create("Test", Constants.System.Root, "umbTextpage"); + var content = contentService.Create("Test", ConstantsCore.System.Root, "umbTextpage"); // Assert Assert.That(content, Is.Not.Null); Assert.That(content.HasIdentity, Is.False); - Assert.That(content.CreatorId, Is.EqualTo(Constants.Security.SuperUserId)); //Default to -1 aka SuperUser (unknown) since we didn't explicitly set this in the Create call + Assert.That(content.CreatorId, Is.EqualTo(ConstantsCore.Security.SuperUserId)); //Default to -1 aka SuperUser (unknown) since we didn't explicitly set this in the Create call } [Test] @@ -474,7 +474,7 @@ namespace Umbraco.Tests.Services RawPasswordValue = "test" }; ServiceContext.UserService.Save(user); - var content = new Content("Test", Constants.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); + var content = new Content("Test", ConstantsCore.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); // Act ServiceContext.ContentService.Save(content, (int)user.Id); @@ -491,7 +491,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act & Assert - Assert.Throws(() => contentService.Create("Test", Constants.System.Root, "umbAliasDoesntExist")); + Assert.Throws(() => contentService.Create("Test", ConstantsCore.System.Root, "umbAliasDoesntExist")); } [Test] @@ -499,7 +499,7 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = new Content(string.Empty, Constants.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); + var content = new Content(string.Empty, ConstantsCore.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); // Act & Assert Assert.Throws(() => contentService.Save(content)); @@ -779,15 +779,15 @@ namespace Umbraco.Tests.Services Assert.AreEqual(PublishedState.Published, content.PublishedState); Assert.IsTrue(content.IsCulturePublished(langUk.IsoCode)); Assert.IsFalse(content.IsCulturePublished(langFr.IsoCode)); - + content = ServiceContext.ContentService.GetById(content.Id); //reget Assert.AreEqual(PublishedState.Published, content.PublishedState); Assert.IsTrue(content.IsCulturePublished(langUk.IsoCode)); Assert.IsFalse(content.IsCulturePublished(langFr.IsoCode)); - + } - + [Test] public void Unpublish_All_Cultures_Has_Unpublished_State() @@ -828,7 +828,7 @@ namespace Umbraco.Tests.Services //re-get content = ServiceContext.ContentService.GetById(content.Id); Assert.AreEqual(PublishedState.Unpublished, content.PublishedState); //just double checking - Assert.IsFalse(content.IsCulturePublished(langFr.IsoCode)); + Assert.IsFalse(content.IsCulturePublished(langFr.IsoCode)); Assert.IsFalse(content.IsCulturePublished(langUk.IsoCode)); } @@ -845,7 +845,7 @@ namespace Umbraco.Tests.Services contentType.Variations = ContentVariation.Culture; ServiceContext.ContentTypeService.Save(contentType); - IContent content = new Content("content", Constants.System.Root, contentType); + IContent content = new Content("content", ConstantsCore.System.Root, contentType); content.SetCultureName("content-fr", langFr.IsoCode); content.SetCultureName("content-en", langUk.IsoCode); @@ -857,13 +857,13 @@ namespace Umbraco.Tests.Services //re-get content = ServiceContext.ContentService.GetById(content.Id); - + var unpublished = ServiceContext.ContentService.Unpublish(content, langUk.IsoCode); //unpublish mandatory lang Assert.IsTrue(unpublished.Success); - Assert.AreEqual(PublishResultType.SuccessUnpublishMandatoryCulture, unpublished.Result); + Assert.AreEqual(PublishResultType.SuccessUnpublishMandatoryCulture, unpublished.Result); Assert.IsFalse(content.IsCulturePublished(langUk.IsoCode)); Assert.IsTrue(content.IsCulturePublished(langFr.IsoCode)); //remains published - Assert.AreEqual(PublishedState.Unpublished, content.PublishedState); + Assert.AreEqual(PublishedState.Unpublished, content.PublishedState); } [Test] @@ -880,7 +880,7 @@ namespace Umbraco.Tests.Services //re-get content = ServiceContext.ContentService.GetById(content.Id); - var unpublished = ServiceContext.ContentService.Unpublish(content, langUk.IsoCode); + var unpublished = ServiceContext.ContentService.Unpublish(content, langUk.IsoCode); Assert.IsTrue(unpublished.Success); Assert.AreEqual(PublishResultType.SuccessUnpublishCulture, unpublished.Result); Assert.IsFalse(content.IsCulturePublished(langUk.IsoCode)); @@ -917,7 +917,7 @@ namespace Umbraco.Tests.Services //Change some data since SaveAndPublish should always Save content.SetCultureName("content-en-updated", langUk.IsoCode); - var saved = ServiceContext.ContentService.SaveAndPublish(content, new string [] { }); //save without cultures + var saved = ServiceContext.ContentService.SaveAndPublish(content, new string [] { }); //save without cultures Assert.AreEqual(PublishResultType.FailedPublishNothingToPublish, saved.Result); //re-get @@ -947,7 +947,7 @@ namespace Umbraco.Tests.Services ServiceContext.ContentTypeService.Save(contentType); - IContent content = new Content("content", Constants.System.Root, contentType); + IContent content = new Content("content", ConstantsCore.System.Root, contentType); content.SetCultureName("content-en", langGB.IsoCode); content.SetCultureName("content-fr", langFr.IsoCode); @@ -979,7 +979,7 @@ namespace Umbraco.Tests.Services { CreateEnglishAndFrenchDocumentType(out var langUk, out var langFr, out var contentType); - IContent content = new Content("content", Constants.System.Root, contentType); + IContent content = new Content("content", ConstantsCore.System.Root, contentType); content.SetCultureName("content-fr", langFr.IsoCode); var published = ServiceContext.ContentService.SaveAndPublish(content, langFr.IsoCode); //audit log will only show that french was published @@ -1010,7 +1010,7 @@ namespace Umbraco.Tests.Services contentType.Variations = ContentVariation.Culture; ServiceContext.ContentTypeService.Save(contentType); - IContent content = new Content("content", Constants.System.Root, contentType); + IContent content = new Content("content", ConstantsCore.System.Root, contentType); content.SetCultureName("content-fr", langFr.IsoCode); content.SetCultureName("content-gb", langGB.IsoCode); var published = ServiceContext.ContentService.SaveAndPublish(content, new[] {langGB.IsoCode, langFr.IsoCode}); @@ -1041,7 +1041,7 @@ namespace Umbraco.Tests.Services var content = contentService.GetById(NodeDto.NodeIdSeed + 2); // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(published.Success, Is.True); @@ -1068,7 +1068,7 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var parent = contentService.Create("parent", Constants.System.Root, "umbTextpage"); + var parent = contentService.Create("parent", ConstantsCore.System.Root, "umbTextpage"); contentService.SaveAndPublish(parent); var content = contentService.Create("child", parent, "umbTextpage"); @@ -1095,7 +1095,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual("Home", content.Name); content.Name = "foo"; - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); Assert.That(published.Success, Is.True); Assert.That(content.Published, Is.True); @@ -1141,7 +1141,7 @@ namespace Umbraco.Tests.Services const int parentId = NodeDto.NodeIdSeed + 2; var contentService = ServiceContext.ContentService; - + var parent = contentService.GetById(parentId); var parentPublished = contentService.SaveAndPublish(parent); @@ -1172,7 +1172,7 @@ namespace Umbraco.Tests.Services Assert.Greater(content.Id, 0); Assert.IsTrue(content.HasIdentity); } - + [Test] public void Can_Publish_And_Unpublish_Cultures_In_Single_Operation() @@ -1281,10 +1281,10 @@ namespace Umbraco.Tests.Services contentService.Save(content); var parent = contentService.GetById(NodeDto.NodeIdSeed + 2); - var parentPublished = contentService.SaveAndPublish(parent, userId: Constants.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' + var parentPublished = contentService.SaveAndPublish(parent, userId: ConstantsCore.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(parentPublished.Success, Is.True); @@ -1305,7 +1305,7 @@ namespace Umbraco.Tests.Services content.ContentSchedule.Add("en-US", null, DateTime.Now.AddMinutes(-5)); ServiceContext.ContentService.Save(content); - var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", Constants.Security.SuperUserId); + var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", ConstantsCore.Security.SuperUserId); Assert.IsFalse(published.Success); Assert.AreEqual(PublishResultType.FailedPublishCultureHasExpired, published.Result); @@ -1319,13 +1319,13 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; var content = contentService.GetById(NodeDto.NodeIdSeed + 3); content.ContentSchedule.Add(DateTime.Now.AddHours(2), null); - contentService.Save(content, Constants.Security.SuperUserId); + contentService.Save(content, ConstantsCore.Security.SuperUserId); var parent = contentService.GetById(NodeDto.NodeIdSeed + 2); - var parentPublished = contentService.SaveAndPublish(parent, userId: Constants.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' + var parentPublished = contentService.SaveAndPublish(parent, userId: ConstantsCore.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(parentPublished.Success, Is.True); @@ -1346,7 +1346,7 @@ namespace Umbraco.Tests.Services content.ContentSchedule.Add("en-US", DateTime.Now.AddHours(2), null); ServiceContext.ContentService.Save(content); - var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", Constants.Security.SuperUserId); + var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", ConstantsCore.Security.SuperUserId); Assert.IsFalse(published.Success); Assert.AreEqual(PublishResultType.FailedPublishCultureAwaitingRelease, published.Result); @@ -1358,8 +1358,8 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = contentService.Create("Subpage with Unpublished Parent", NodeDto.NodeIdSeed + 2, "umbTextpage", Constants.Security.SuperUserId); - contentService.Save(content, Constants.Security.SuperUserId); + var content = contentService.Create("Subpage with Unpublished Parent", NodeDto.NodeIdSeed + 2, "umbTextpage", ConstantsCore.Security.SuperUserId); + contentService.Save(content, ConstantsCore.Security.SuperUserId); // Act var published = contentService.SaveAndPublishBranch(content, true); @@ -1377,7 +1377,7 @@ namespace Umbraco.Tests.Services var content = contentService.GetById(NodeDto.NodeIdSeed + 5); // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(published.Success, Is.False); @@ -1390,11 +1390,11 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", - 1, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Home US", - 1, "umbTextpage", ConstantsCore.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(content.HasIdentity, Is.True); @@ -1414,17 +1414,17 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Home US", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); - var childContent = contentService.Create("Child", content.Id, "umbTextpage", Constants.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); + var childContent = contentService.Create("Child", content.Id, "umbTextpage", ConstantsCore.Security.SuperUserId); // Reset all identity properties childContent.Id = 0; childContent.Path = null; ((Content)childContent).ResetIdentity(); - var childPublished = contentService.SaveAndPublish(childContent, userId: Constants.Security.SuperUserId); + var childPublished = contentService.SaveAndPublish(childContent, userId: ConstantsCore.Security.SuperUserId); // Assert Assert.That(content.HasIdentity, Is.True); @@ -1486,11 +1486,11 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", - 1, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Home US", - 1, "umbTextpage", ConstantsCore.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - contentService.Save(content, Constants.Security.SuperUserId); + contentService.Save(content, ConstantsCore.Security.SuperUserId); // Assert Assert.That(content.HasIdentity, Is.True); @@ -1509,7 +1509,7 @@ namespace Umbraco.Tests.Services var list = new List {subpage, subpage2}; // Act - contentService.Save(list, Constants.Security.SuperUserId); + contentService.Save(list, ConstantsCore.Security.SuperUserId); // Assert Assert.That(list.Any(x => !x.HasIdentity), Is.False); @@ -1523,7 +1523,7 @@ namespace Umbraco.Tests.Services var hierarchy = CreateContentHierarchy().ToList(); // Act - contentService.Save(hierarchy, Constants.Security.SuperUserId); + contentService.Save(hierarchy, ConstantsCore.Security.SuperUserId); Assert.That(hierarchy.Any(), Is.True); Assert.That(hierarchy.Any(x => x.HasIdentity == false), Is.False); @@ -1558,7 +1558,7 @@ namespace Umbraco.Tests.Services var content = contentService.GetById(NodeDto.NodeIdSeed + 4); // Act - contentService.Delete(content, Constants.Security.SuperUserId); + contentService.Delete(content, ConstantsCore.Security.SuperUserId); var deleted = contentService.GetById(NodeDto.NodeIdSeed + 4); // Assert @@ -1573,7 +1573,7 @@ namespace Umbraco.Tests.Services var content = contentService.GetById(NodeDto.NodeIdSeed + 3); // Act - contentService.MoveToRecycleBin(content, Constants.Security.SuperUserId); + contentService.MoveToRecycleBin(content, ConstantsCore.Security.SuperUserId); // Assert Assert.That(content.ParentId, Is.EqualTo(-20)); @@ -1587,7 +1587,7 @@ namespace Umbraco.Tests.Services var contentType = ServiceContext.ContentTypeService.Get("umbTextpage"); var subsubpage = MockedContent.CreateSimpleContent(contentType, "Text Page 3", NodeDto.NodeIdSeed + 3); - contentService.Save(subsubpage, Constants.Security.SuperUserId); + contentService.Save(subsubpage, ConstantsCore.Security.SuperUserId); var content = contentService.GetById(NodeDto.NodeIdSeed + 2); const int pageSize = 500; @@ -1603,7 +1603,7 @@ namespace Umbraco.Tests.Services Assert.IsFalse(descendants.Any(x => x.Path.StartsWith("-1,-20,"))); Assert.IsFalse(descendants.Any(x => x.Trashed)); - contentService.MoveToRecycleBin(content, Constants.Security.SuperUserId); + contentService.MoveToRecycleBin(content, ConstantsCore.Security.SuperUserId); descendants.Clear(); page = 0; @@ -1616,7 +1616,7 @@ namespace Umbraco.Tests.Services Assert.IsTrue(descendants.All(x => x.Path.StartsWith("-1,-20,"))); Assert.True(descendants.All(x => x.Trashed)); - contentService.EmptyRecycleBin(Constants.Security.SuperUserId); + contentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var trashed = contentService.GetPagedContentInRecycleBin(0, int.MaxValue, out var _).ToList(); Assert.IsEmpty(trashed); } @@ -1628,7 +1628,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - contentService.EmptyRecycleBin(Constants.Security.SuperUserId); + contentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var contents = contentService.GetPagedContentInRecycleBin(0, int.MaxValue, out var _).ToList(); // Assert @@ -1752,7 +1752,7 @@ namespace Umbraco.Tests.Services // * multiple versions var contentType = MockedContentTypes.CreateAllTypesContentType("test", "test"); - ServiceContext.ContentTypeService.Save(contentType, Constants.Security.SuperUserId); + ServiceContext.ContentTypeService.Save(contentType, ConstantsCore.Security.SuperUserId); object obj = new @@ -1762,23 +1762,23 @@ namespace Umbraco.Tests.Services var content1 = MockedContent.CreateBasicContent(contentType); content1.PropertyValues(obj); content1.ResetDirtyProperties(false); - ServiceContext.ContentService.Save(content1, Constants.Security.SuperUserId); + ServiceContext.ContentService.Save(content1, ConstantsCore.Security.SuperUserId); Assert.IsTrue(ServiceContext.ContentService.SaveAndPublish(content1, userId: 0).Success); var content2 = MockedContent.CreateBasicContent(contentType); content2.PropertyValues(obj); content2.ResetDirtyProperties(false); - ServiceContext.ContentService.Save(content2, Constants.Security.SuperUserId); + ServiceContext.ContentService.Save(content2, ConstantsCore.Security.SuperUserId); Assert.IsTrue(ServiceContext.ContentService.SaveAndPublish(content2, userId: 0).Success); var editorGroup = ServiceContext.UserService.GetUserGroupByAlias("editor"); editorGroup.StartContentId = content1.Id; ServiceContext.UserService.Save(editorGroup); - var admin = ServiceContext.UserService.GetUserById(Constants.Security.SuperUserId); + var admin = ServiceContext.UserService.GetUserById(ConstantsCore.Security.SuperUserId); admin.StartContentIds = new[] {content1.Id}; ServiceContext.UserService.Save(admin); - ServiceContext.RelationService.Save(new RelationType(Constants.ObjectTypes.Document, Constants.ObjectTypes.Document, "test")); + ServiceContext.RelationService.Save(new RelationType(ConstantsCore.ObjectTypes.Document, ConstantsCore.ObjectTypes.Document, "test")); Assert.IsNotNull(ServiceContext.RelationService.Relate(content1, content2, "test")); ServiceContext.PublicAccessService.Save(new PublicAccessEntry(content1, content2, content2, new List @@ -1791,7 +1791,7 @@ namespace Umbraco.Tests.Services })); Assert.IsTrue(ServiceContext.PublicAccessService.AddRule(content1, "test2", "test2").Success); - var user = ServiceContext.UserService.GetUserById(Constants.Security.SuperUserId); + var user = ServiceContext.UserService.GetUserById(ConstantsCore.Security.SuperUserId); var userGroup = ServiceContext.UserService.GetUserGroupByAlias(user.Groups.First().Alias); Assert.IsNotNull(ServiceContext.NotificationService.CreateNotification(user, content1, "X")); @@ -1804,7 +1804,7 @@ namespace Umbraco.Tests.Services // Act ServiceContext.ContentService.MoveToRecycleBin(content1); - ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); var contents = ServiceContext.ContentService.GetPagedContentInRecycleBin(0, int.MaxValue, out var _).ToList(); // Assert @@ -1835,7 +1835,7 @@ namespace Umbraco.Tests.Services var temp = contentService.GetById(NodeDto.NodeIdSeed + 4); // Act - var copy = contentService.Copy(temp, temp.ParentId, false, Constants.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, ConstantsCore.Security.SuperUserId); var content = contentService.GetById(NodeDto.NodeIdSeed + 4); // Assert @@ -1859,7 +1859,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(2, contentService.CountChildren(temp.Id)); // Act - var copy = contentService.Copy(temp, temp.ParentId, false, true, Constants.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, true, ConstantsCore.Security.SuperUserId); var content = contentService.GetById(NodeDto.NodeIdSeed + 2); // Assert @@ -1885,7 +1885,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(2, contentService.CountChildren(temp.Id)); // Act - var copy = contentService.Copy(temp, temp.ParentId, false, false, Constants.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, false, ConstantsCore.Security.SuperUserId); var content = contentService.GetById(NodeDto.NodeIdSeed + 2); // Assert @@ -1909,7 +1909,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType! ServiceContext.ContentTypeService.Save(contentType); - var content = MockedContent.CreateSimpleContent(contentType, "Simple Tags Page", Constants.System.Root); + var content = MockedContent.CreateSimpleContent(contentType, "Simple Tags Page", ConstantsCore.System.Root); content.AssignTags(propAlias, new[] {"hello", "world"}); contentService.Save(content); @@ -2085,7 +2085,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); // else, FK violation on contentType! ServiceContext.ContentTypeService.Save(contentType); - var page = new Content("Page", Constants.System.Root, contentType) + var page = new Content("Page", ConstantsCore.System.Root, contentType) { Level = 1, SortOrder = 1, @@ -2312,7 +2312,7 @@ namespace Umbraco.Tests.Services var contentType = MockedContentTypes.CreateAllTypesContentType("allDataTypes", "All DataTypes"); contentTypeService.Save(contentType); var contentService = ServiceContext.ContentService; - var content = MockedContent.CreateAllTypesContent(contentType, "Random Content", Constants.System.Root); + var content = MockedContent.CreateAllTypesContent(contentType, "Random Content", ConstantsCore.System.Root); contentService.Save(content); var id = content.Id; @@ -2354,7 +2354,7 @@ namespace Umbraco.Tests.Services var version = content.VersionId; // Act - contentService.DeleteVersion(NodeDto.NodeIdSeed + 5, version, true, Constants.Security.SuperUserId); + contentService.DeleteVersion(NodeDto.NodeIdSeed + 5, version, true, ConstantsCore.Security.SuperUserId); var sut = contentService.GetById(NodeDto.NodeIdSeed + 5); // Assert @@ -2365,7 +2365,7 @@ namespace Umbraco.Tests.Services public void Ensure_Content_Xml_Created() { var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Home US", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); content.SetValue("author", "Barack Obama"); contentService.Save(content); @@ -2387,7 +2387,7 @@ namespace Umbraco.Tests.Services public void Ensure_Preview_Xml_Created() { var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); + var content = contentService.Create("Home US", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); content.SetValue("author", "Barack Obama"); contentService.Save(content); @@ -2415,10 +2415,10 @@ namespace Umbraco.Tests.Services } long total; - var entities = service.GetPagedChildren(Constants.System.Root, 0, 6, out total).ToArray(); + var entities = service.GetPagedChildren(ConstantsCore.System.Root, 0, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(6)); Assert.That(total, Is.EqualTo(10)); - entities = service.GetPagedChildren(Constants.System.Root, 1, 6, out total).ToArray(); + entities = service.GetPagedChildren(ConstantsCore.System.Root, 1, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(4)); Assert.That(total, Is.EqualTo(10)); } @@ -2450,10 +2450,10 @@ namespace Umbraco.Tests.Services long total; // children in root including the folder - not the descendants in the folder - var entities = service.GetPagedChildren(Constants.System.Root, 0, 6, out total).ToArray(); + var entities = service.GetPagedChildren(ConstantsCore.System.Root, 0, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(6)); Assert.That(total, Is.EqualTo(10)); - entities = service.GetPagedChildren(Constants.System.Root, 1, 6, out total).ToArray(); + entities = service.GetPagedChildren(ConstantsCore.System.Root, 1, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(4)); Assert.That(total, Is.EqualTo(10)); @@ -2469,7 +2469,7 @@ namespace Umbraco.Tests.Services [Test] public void PublishingTest() { - var contentType = new ContentType(Constants.System.Root) + var contentType = new ContentType(ConstantsCore.System.Root) { Alias = "foo", Name = "Foo" @@ -2487,7 +2487,7 @@ namespace Umbraco.Tests.Services ServiceContext.ContentTypeService.Save(contentType); var contentService = ServiceContext.ContentService; - var content = contentService.Create("foo", Constants.System.Root, "foo"); + var content = contentService.Create("foo", ConstantsCore.System.Root, "foo"); contentService.Save(content); Assert.IsFalse(content.Published); @@ -2615,7 +2615,7 @@ namespace Umbraco.Tests.Services contentTypeService.Save(contentType); var contentService = ServiceContext.ContentService; - var content = new Content(null, Constants.System.Root, contentType); + var content = new Content(null, ConstantsCore.System.Root, contentType); content.SetCultureName("name-us", langUk.IsoCode); content.SetCultureName("name-fr", langFr.IsoCode); @@ -2650,7 +2650,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; - var content = new Content(null, Constants.System.Root, contentType); + var content = new Content(null, ConstantsCore.System.Root, contentType); content.SetCultureName("root", langUk.IsoCode); contentService.Save(content); @@ -2692,13 +2692,13 @@ namespace Umbraco.Tests.Services var o = new[] { 2, 1, 3, 0, 4 }; // randomly different for (var i = 0; i < 5; i++) { - var contentA = new Content(null, Constants.System.Root, contentType); + var contentA = new Content(null, ConstantsCore.System.Root, contentType); contentA.SetCultureName("contentA" + i + "uk", langUk.IsoCode); contentA.SetCultureName("contentA" + o[i] + "fr", langFr.IsoCode); contentA.SetCultureName("contentX" + i + "da", langDa.IsoCode); contentService.Save(contentA); - var contentB = new Content(null, Constants.System.Root, contentType); + var contentB = new Content(null, ConstantsCore.System.Root, contentType); contentB.SetCultureName("contentB" + i + "uk", langUk.IsoCode); contentB.SetCultureName("contentB" + o[i] + "fr", langFr.IsoCode); contentB.SetCultureName("contentX" + i + "da", langDa.IsoCode); @@ -2706,7 +2706,7 @@ namespace Umbraco.Tests.Services } // get all - var list = contentService.GetPagedChildren(Constants.System.Root, 0, 100, out var total).ToList(); + var list = contentService.GetPagedChildren(ConstantsCore.System.Root, 0, 100, out var total).ToList(); Console.WriteLine("ALL"); WriteList(list); @@ -2716,7 +2716,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(11, list.Count); // filter - list = contentService.GetPagedChildren(Constants.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(ConstantsCore.System.Root, 0, 100, out total, SqlContext.Query().Where(x => x.Name.Contains("contentX")), Ordering.By("name", culture: langFr.IsoCode)).ToList(); @@ -2724,7 +2724,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(0, list.Count); // filter - list = contentService.GetPagedChildren(Constants.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(ConstantsCore.System.Root, 0, 100, out total, SqlContext.Query().Where(x => x.Name.Contains("contentX")), Ordering.By("name", culture: langDa.IsoCode)).ToList(); @@ -2735,7 +2735,7 @@ namespace Umbraco.Tests.Services Assert.AreEqual(10, list.Count); // filter - list = contentService.GetPagedChildren(Constants.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(ConstantsCore.System.Root, 0, 100, out total, SqlContext.Query().Where(x => x.Name.Contains("contentA")), Ordering.By("name", culture: langFr.IsoCode)).ToList(); @@ -2748,7 +2748,7 @@ namespace Umbraco.Tests.Services for (var i = 0; i < 5; i++) Assert.AreEqual("contentA" + i + "fr", list[i].GetCultureName(langFr.IsoCode)); - list = contentService.GetPagedChildren(Constants.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(ConstantsCore.System.Root, 0, 100, out total, SqlContext.Query().Where(x => x.Name.Contains("contentA")), Ordering.By("name", direction: Direction.Descending, culture: langFr.IsoCode)).ToList(); @@ -2793,7 +2793,7 @@ namespace Umbraco.Tests.Services contentTypeService.Save(contentType); var contentService = ServiceContext.ContentService; - var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage"); + var content = contentService.Create("Home US", ConstantsCore.System.Root, "umbTextpage"); // creating content with a name but no culture - will set the invariant name // but, because that content is variant, as soon as we save, we'll need to @@ -3186,7 +3186,7 @@ namespace Umbraco.Tests.Services { CreateEnglishAndFrenchDocumentType(out langUk, out langFr, out contentType); - IContent content = new Content("content", Constants.System.Root, contentType); + IContent content = new Content("content", ConstantsCore.System.Root, contentType); content.SetCultureName("content-fr", langFr.IsoCode); content.SetCultureName("content-en", langUk.IsoCode); diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs index f2a4368ae4..92c8afd144 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -53,7 +53,7 @@ namespace Umbraco.Tests.Services Assert.IsTrue(contentType.IsElement); } - + [Test] public void Deleting_Content_Type_With_Hierarchy_Of_Content_Items_Moves_Orphaned_Content_To_Recycle_Bin() @@ -524,7 +524,7 @@ namespace Umbraco.Tests.Services var cts = ServiceContext.ContentTypeService; // Act - var container = new EntityContainer(Constants.ObjectTypes.DocumentType); + var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType); container.Name = "container1"; cts.SaveContainer(container); @@ -540,11 +540,11 @@ namespace Umbraco.Tests.Services var cts = ServiceContext.ContentTypeService; // Act - var container1 = new EntityContainer(Constants.ObjectTypes.DocumentType); + var container1 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType); container1.Name = "container1"; cts.SaveContainer(container1); - var container2 = new EntityContainer(Constants.ObjectTypes.DocumentType); + var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType); container2.Name = "container2"; cts.SaveContainer(container2); diff --git a/src/Umbraco.Tests/Services/EntityServiceTests.cs b/src/Umbraco.Tests/Services/EntityServiceTests.cs index 0598b8cea2..e642b25e66 100644 --- a/src/Umbraco.Tests/Services/EntityServiceTests.cs +++ b/src/Umbraco.Tests/Services/EntityServiceTests.cs @@ -486,7 +486,7 @@ namespace Umbraco.Tests.Services { var service = ServiceContext.EntityService; - var objectTypeId = Constants.ObjectTypes.Document; + var objectTypeId = ConstantsCore.ObjectTypes.Document; var entities = service.GetAll(objectTypeId).ToArray(); Assert.That(entities.Any(), Is.True); @@ -623,7 +623,7 @@ namespace Umbraco.Tests.Services public void EntityService_Throws_When_Getting_All_With_Invalid_Type() { var service = ServiceContext.EntityService; - var objectTypeId = Constants.ObjectTypes.ContentItem; + var objectTypeId = ConstantsCore.ObjectTypes.ContentItem; Assert.Throws(() => service.GetAll()); Assert.Throws(() => service.GetAll(objectTypeId)); @@ -645,7 +645,7 @@ namespace Umbraco.Tests.Services { var service = ServiceContext.EntityService; - var objectTypeId = Constants.ObjectTypes.DocumentType; + var objectTypeId = ConstantsCore.ObjectTypes.DocumentType; var entities = service.GetAll(objectTypeId).ToArray(); Assert.That(entities.Any(), Is.True); diff --git a/src/Umbraco.Tests/Services/MemberServiceTests.cs b/src/Umbraco.Tests/Services/MemberServiceTests.cs index 57d6b67af8..4ae6439f4b 100644 --- a/src/Umbraco.Tests/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberServiceTests.cs @@ -111,14 +111,14 @@ namespace Umbraco.Tests.Services var member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "test"); ServiceContext.MemberService.Save(member); - Assert.IsTrue(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)); + Assert.IsTrue(member.RawPasswordValue.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix)); ServiceContext.MemberService.SavePassword(member, "hello123456$!"); var foundMember = ServiceContext.MemberService.GetById(member.Id); Assert.IsNotNull(foundMember); Assert.AreNotEqual("hello123456$!", foundMember.RawPasswordValue); - Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)); + Assert.IsFalse(member.RawPasswordValue.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix)); } [Test] @@ -130,7 +130,7 @@ namespace Umbraco.Tests.Services var member = MockedMember.CreateSimpleMember(memberType, "test", "test@test.com", "hello123456$!", "test"); ServiceContext.MemberService.Save(member); - Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)); + Assert.IsFalse(member.RawPasswordValue.StartsWith(ConstantsCore.Security.EmptyPasswordPrefix)); Assert.Throws(() => ServiceContext.MemberService.SavePassword(member, "HELLO123456$!")); } diff --git a/src/Umbraco.Tests/Services/RelationServiceTests.cs b/src/Umbraco.Tests/Services/RelationServiceTests.cs index cfef50a330..3e760bf795 100644 --- a/src/Umbraco.Tests/Services/RelationServiceTests.cs +++ b/src/Umbraco.Tests/Services/RelationServiceTests.cs @@ -17,7 +17,7 @@ namespace Umbraco.Tests.Services public void Can_Create_RelationType_Without_Name() { var rs = ServiceContext.RelationService; - var rt = new RelationType(Constants.ObjectTypes.Document, Constants.ObjectTypes.Document, "repeatedEventOccurence"); + var rt = new RelationType(ConstantsCore.ObjectTypes.Document, ConstantsCore.ObjectTypes.Document, "repeatedEventOccurence"); Assert.DoesNotThrow(() => rs.Save(rt)); diff --git a/src/Umbraco.Tests/Services/TagServiceTests.cs b/src/Umbraco.Tests/Services/TagServiceTests.cs index 0665210430..1cd7f3ae3f 100644 --- a/src/Umbraco.Tests/Services/TagServiceTests.cs +++ b/src/Umbraco.Tests/Services/TagServiceTests.cs @@ -79,7 +79,7 @@ namespace Umbraco.Tests.Services contentType.PropertyGroups.First().PropertyTypes.Add( new PropertyType(Constants.PropertyEditors.Aliases.Tags, ValueStorageType.Ntext, "tags") { - DataTypeId = Constants.DataTypes.Tags + DataTypeId = ConstantsCore.DataTypes.Tags }); contentTypeService.Save(contentType); diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index e93e8e8740..903c6a65ab 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -174,7 +174,7 @@ namespace Umbraco.Tests.TestHelpers.Entities Description = "Tags", Mandatory = false, SortOrder = 99, - DataTypeId = Constants.DataTypes.Tags + DataTypeId = ConstantsCore.DataTypes.Tags }; contentType.AddPropertyType(propertyType); diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index 56ad22d414..7e8dc618ea 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs @@ -238,7 +238,7 @@ namespace Umbraco.Tests.TestHelpers // mappersBuilder.AddCore(); // var mappers = mappersBuilder.CreateCollection(); var mappers = Current.Factory.GetInstance(); - databaseFactory = new UmbracoDatabaseFactory(Constants.System.UmbracoConnectionName, logger, new Lazy(() => mappers)); + databaseFactory = new UmbracoDatabaseFactory(ConstantsCore.System.UmbracoConnectionName, logger, new Lazy(() => mappers)); } fileSystems = fileSystems ?? new FileSystems(Current.Factory, logger); diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs index 050de4fcb9..cc054520f3 100644 --- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs +++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs @@ -175,9 +175,9 @@ namespace Umbraco.Tests.TestHelpers var path = TestHelper.CurrentAssemblyDirectory; //Get the connectionstring settings from config - var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; ConfigurationManager.AppSettings.Set( - Constants.System.UmbracoConnectionName, + ConstantsCore.System.UmbracoConnectionName, GetDbConnectionString()); _databasePath = string.Concat(path, "\\UmbracoNPocoTests.sdf"); diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 7e72a5aefb..132319b527 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -346,7 +346,7 @@ namespace Umbraco.Tests.Testing Composition.RegisterUnique(_ => new TransientEventMessagesFactory()); Composition.RegisterUnique(f => new UmbracoDatabaseFactory( - Constants.System.UmbracoConnectionName, + ConstantsCore.System.UmbracoConnectionName, Logger, new Lazy(f.GetInstance))); Composition.RegisterUnique(f => f.TryGetInstance().SqlContext); diff --git a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs index d77867152a..fe378c105d 100644 --- a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs +++ b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs @@ -82,10 +82,10 @@ namespace Umbraco.Tests.Web.Controllers { switch (id) { - case Constants.DataTypes.Textbox: - return Attempt.Succeed(Constants.DataTypes.Guids.TextstringGuid); - case Constants.DataTypes.RichtextEditor: - return Attempt.Succeed(Constants.DataTypes.Guids.RichtextEditorGuid); + case ConstantsCore.DataTypes.Textbox: + return Attempt.Succeed(ConstantsCore.DataTypes.Guids.TextstringGuid); + case ConstantsCore.DataTypes.RichtextEditor: + return Attempt.Succeed(ConstantsCore.DataTypes.Guids.RichtextEditorGuid); } return Attempt.Fail(); }); diff --git a/src/Umbraco.Tests/Web/Controllers/UserEditorAuthorizationHelperTests.cs b/src/Umbraco.Tests/Web/Controllers/UserEditorAuthorizationHelperTests.cs index 04694b21ee..9f9a975716 100644 --- a/src/Umbraco.Tests/Web/Controllers/UserEditorAuthorizationHelperTests.cs +++ b/src/Umbraco.Tests/Web/Controllers/UserEditorAuthorizationHelperTests.cs @@ -419,7 +419,7 @@ namespace Umbraco.Tests.Web.Controllers { var admin = Mock.Of(user => user.Groups == new[] { - new ReadOnlyUserGroup(1, "Admin", "icon-user", null, null, Constants.Security.AdminGroupAlias, new string[0], new string[0]) + new ReadOnlyUserGroup(1, "Admin", "icon-user", null, null, ConstantsCore.Security.AdminGroupAlias, new string[0], new string[0]) }); return admin; } diff --git a/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs index 901c737584..d9887a703f 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs @@ -106,7 +106,7 @@ namespace Umbraco.Tests.Web.Mvc { var binder = ContentModelBinder.Instance; var routeData = new RouteData(); - routeData.DataTokens[Core.Constants.Web.UmbracoDataToken] = "hello"; + routeData.DataTokens[Core.ConstantsCore.Web.UmbracoDataToken] = "hello"; //the value provider is the default implementation var valueProvider = new Mock(); @@ -136,7 +136,7 @@ namespace Umbraco.Tests.Web.Mvc var content = new MyContent(Mock.Of()); var binder = ContentModelBinder.Instance; var routeData = new RouteData(); - routeData.DataTokens[Core.Constants.Web.UmbracoDataToken] = content; + routeData.DataTokens[Core.ConstantsCore.Web.UmbracoDataToken] = content; //the value provider is the default implementation var valueProvider = new Mock(); diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index a9c405237b..5d19950652 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -165,7 +165,7 @@ namespace Umbraco.Tests.Web.Mvc }; var routeData = new RouteData(); - routeData.DataTokens.Add(Core.Constants.Web.UmbracoRouteDefinitionDataToken, routeDefinition); + routeData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken, routeDefinition); var ctrl = new TestSurfaceController(umbracoContextAccessor, new UmbracoHelper()); ctrl.ControllerContext = new ControllerContext(contextBase, routeData, ctrl); diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs index 9ca17675af..d6a12fcbf6 100644 --- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs @@ -399,7 +399,7 @@ namespace Umbraco.Tests.Web.Mvc var context = new ViewContext(); context.RouteData = new RouteData(); - context.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbracoContext); + context.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbracoContext); return context; } diff --git a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs index 9ba010642e..5a1d73946a 100644 --- a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs +++ b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs @@ -36,10 +36,10 @@ namespace Umbraco.Tests.Web TestObjects.GetGlobalSettings(), new TestVariationContextAccessor()); var r1 = new RouteData(); - r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); + r1.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); - Assert.IsTrue(r1.DataTokens.ContainsKey(Core.Constants.Web.UmbracoContextDataToken)); - Assert.AreSame(umbCtx, r1.DataTokens[Core.Constants.Web.UmbracoContextDataToken]); + Assert.IsTrue(r1.DataTokens.ContainsKey(Core.ConstantsCore.Web.UmbracoContextDataToken)); + Assert.AreSame(umbCtx, r1.DataTokens[Core.ConstantsCore.Web.UmbracoContextDataToken]); } [Test] @@ -56,7 +56,7 @@ namespace Umbraco.Tests.Web new TestVariationContextAccessor()); var r1 = new RouteData(); - r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); + r1.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); var ctx1 = CreateViewContext(new ControllerContext(Mock.Of(), r1, new MyController())); var r2 = new RouteData(); r2.DataTokens.Add("ParentActionViewContext", ctx1); diff --git a/src/Umbraco.Web/Compose/NotificationsComponent.cs b/src/Umbraco.Web/Compose/NotificationsComponent.cs index 6fcc1269cb..f23bdd8d03 100644 --- a/src/Umbraco.Web/Compose/NotificationsComponent.cs +++ b/src/Umbraco.Web/Compose/NotificationsComponent.cs @@ -51,16 +51,16 @@ namespace Umbraco.Web.Compose //Send notifications for the delete action when content is moved to the recycle bin ContentService.Trashed += (sender, args) => _notifier.Notify(_actions.GetAction(), args.MoveInfoCollection.Select(m => m.Entity).ToArray()); - + //Send notifications for the copy action ContentService.Copied += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Original); - + //Send notifications for the rollback action - ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Entity); - + ContentService.RolledBack += (sender, args) => _notifier.Notify(_actions.GetAction(), args.Entity); + //Send notifications for the public access changed action PublicAccessService.Saved += (sender, args) => PublicAccessServiceSaved(_notifier, sender, args, _contentService, _actions); - + UserService.UserGroupPermissionsAssigned += (sender, args) => UserServiceUserGroupPermissionsAssigned(_notifier, sender, args, _contentService, _actions); } @@ -115,7 +115,7 @@ namespace Umbraco.Web.Compose } notifier.Notify(actions.GetAction(), entities); } - + private void ContentServiceMoved(Notifier notifier, IContentService sender, Core.Events.MoveEventArgs args, ActionCollection actions) { // notify about the move for all moved items @@ -123,7 +123,7 @@ namespace Umbraco.Web.Compose // for any items being moved from the recycle bin (restored), explicitly notify about that too var restoredEntities = args.MoveInfoCollection - .Where(m => m.OriginalPath.Contains(Constants.System.RecycleBinContentString)) + .Where(m => m.OriginalPath.Contains(ConstantsCore.System.RecycleBinContentString)) .Select(m => m.Entity) .ToArray(); if(restoredEntities.Any()) @@ -141,7 +141,7 @@ namespace Umbraco.Web.Compose } notifier.Notify(actions.GetAction(), entities); } - + /// /// This class is used to send the notifications /// @@ -190,10 +190,10 @@ namespace Umbraco.Web.Compose if (user == null) { _logger.Debug(typeof(Notifier), "There is no current Umbraco user logged in, the notifications will be sent from the administrator"); - user = _userService.GetUserById(Constants.Security.SuperUserId); + user = _userService.GetUserById(ConstantsCore.Security.SuperUserId); if (user == null) { - _logger.Warn(typeof(Notifier), "Notifications can not be sent, no admin user with id {SuperUserId} could be resolved", Constants.Security.SuperUserId); + _logger.Warn(typeof(Notifier), "Notifications can not be sent, no admin user with id {SuperUserId} could be resolved", ConstantsCore.Security.SuperUserId); return; } } diff --git a/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs b/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs index 8c251cacd2..488c35b757 100644 --- a/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs +++ b/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.ContentApps { Alias = "umbContent", Name = "Content", - Icon = Constants.Icons.Content, + Icon = ConstantsCore.Icons.Content, View = "views/content/apps/content/content.html", Weight = Weight }); @@ -37,7 +37,7 @@ namespace Umbraco.Web.ContentApps { Alias = "umbContent", Name = "Content", - Icon = Constants.Icons.Content, + Icon = ConstantsCore.Icons.Content, View = "views/media/apps/content/content.html", Weight = Weight }); diff --git a/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs b/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs index ae6d324e84..c11a4fb108 100644 --- a/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs +++ b/src/Umbraco.Web/ContentApps/ListViewContentAppFactory.cs @@ -36,14 +36,14 @@ namespace Umbraco.Web.ContentApps case IContent content: contentTypeAlias = content.ContentType.Alias; entityType = "content"; - dtdId = Core.Constants.DataTypes.DefaultContentListView; + dtdId = Core.ConstantsCore.DataTypes.DefaultContentListView; break; case IMedia media when !media.ContentType.IsContainer && media.ContentType.Alias != Core.Constants.Conventions.MediaTypes.Folder: return null; case IMedia media: contentTypeAlias = media.ContentType.Alias; entityType = "media"; - dtdId = Core.Constants.DataTypes.DefaultMediaListView; + dtdId = Core.ConstantsCore.DataTypes.DefaultMediaListView; break; default: throw new NotSupportedException($"Object type {o.GetType()} is not supported here."); @@ -73,7 +73,7 @@ namespace Umbraco.Web.ContentApps }; var customDtdName = Core.Constants.Conventions.DataTypes.ListViewPrefix + contentTypeAlias; - + //first try to get the custom one if there is one var dt = dataTypeService.GetDataType(customDtdName) ?? dataTypeService.GetDataType(defaultListViewDataType); diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 0cd96f738c..a991c323ee 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -19,8 +19,8 @@ namespace Umbraco.Web.Dashboards { var rules = new IAccessRule[] { - new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias}, - new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} + new AccessRule {Type = AccessRuleType.Deny, Value = ConstantsCore.Security.TranslatorGroupAlias}, + new AccessRule {Type = AccessRuleType.Grant, Value = ConstantsCore.Security.AdminGroupAlias} }; return rules; } diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs index 867e8af3aa..c355879098 100644 --- a/src/Umbraco.Web/Dashboards/FormsDashboard.cs +++ b/src/Umbraco.Web/Dashboards/FormsDashboard.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.Dashboards { public string Alias => "formsInstall"; - public string[] Sections => new [] { Constants.Applications.Forms }; + public string[] Sections => new [] { ConstantsCore.Applications.Forms }; public string View => "views/dashboard/forms/formsdashboardintro.html"; diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs index c2c481e8e4..69a8bfb1ed 100644 --- a/src/Umbraco.Web/Editors/AuthenticationController.cs +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -96,8 +96,8 @@ namespace Umbraco.Web.Editors } Request.TryGetOwinContext().Result.Authentication.SignOut( - Core.Constants.Security.BackOfficeAuthenticationType, - Core.Constants.Security.BackOfficeExternalAuthenticationType); + Core.ConstantsCore.Security.BackOfficeAuthenticationType, + Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); await SignInManager.SignInAsync(identityUser, false, false); @@ -468,8 +468,8 @@ namespace Umbraco.Web.Editors var owinContext = Request.TryGetOwinContext().Result; owinContext.Authentication.SignOut( - Core.Constants.Security.BackOfficeAuthenticationType, - Core.Constants.Security.BackOfficeExternalAuthenticationType); + Core.ConstantsCore.Security.BackOfficeAuthenticationType, + Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); Logger.Info("User {UserName} from IP address {RemoteIpAddress} has logged out", User.Identity == null ? "UNKNOWN" : User.Identity.Name, owinContext.Request.RemoteIpAddress); diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index e77a1b70f2..6ab0043e93 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -79,8 +79,8 @@ namespace Umbraco.Web.Editors if(Security.IsAuthenticated()) { AuthenticationManager.SignOut( - Core.Constants.Security.BackOfficeAuthenticationType, - Core.Constants.Security.BackOfficeExternalAuthenticationType); + Core.ConstantsCore.Security.BackOfficeAuthenticationType, + Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); } if (invite == null) @@ -319,7 +319,7 @@ namespace Umbraco.Web.Editors public async Task ExternalLinkLoginCallback() { var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync( - Constants.Security.BackOfficeExternalAuthenticationType, + ConstantsCore.Security.BackOfficeExternalAuthenticationType, XsrfKey, User.Identity.GetUserId()); if (loginInfo == null) @@ -361,7 +361,7 @@ namespace Umbraco.Web.Editors //First check if there's external login info, if there's not proceed as normal var loginInfo = await OwinContext.Authentication.GetExternalLoginInfoAsync( - Constants.Security.BackOfficeExternalAuthenticationType); + ConstantsCore.Security.BackOfficeExternalAuthenticationType); if (loginInfo == null || loginInfo.ExternalIdentity.IsAuthenticated == false) { @@ -426,9 +426,9 @@ namespace Umbraco.Web.Editors } //Remove the cookie otherwise this message will keep appearing - if (Response.Cookies[Constants.Security.BackOfficeExternalCookieName] != null) + if (Response.Cookies[ConstantsCore.Security.BackOfficeExternalCookieName] != null) { - Response.Cookies[Constants.Security.BackOfficeExternalCookieName].Expires = DateTime.MinValue; + Response.Cookies[ConstantsCore.Security.BackOfficeExternalCookieName].Expires = DateTime.MinValue; } } diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 3e51befcfb..f878342948 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -120,7 +120,7 @@ namespace Umbraco.Web.Editors {"serverVarsJs", _urlHelper.Action("Application", "BackOffice")}, //API URLs { - "packagesRestApiBaseUrl", Constants.PackageRepository.RestApiBaseUrl + "packagesRestApiBaseUrl", ConstantsCore.PackageRepository.RestApiBaseUrl }, { "redirectUrlManagementApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index 5ddbb506c9..5796856377 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web.Editors // ref: https://www.exceptionnotfound.net/the-asp-net-web-api-exception-handling-pipeline-a-guided-tour/ [PluginController("UmbracoApi")] [PrefixlessBodyModelValidator] - [UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Settings)] public class CodeFileController : BackOfficeNotificationsController { public CodeFileController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) @@ -52,19 +52,19 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: var view = new PartialView(PartialViewType.PartialView, display.VirtualPath); view.Content = display.Content; var result = Services.FileService.CreatePartialView(view, display.Snippet, Security.CurrentUser.Id); return result.Success == true ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(result.Exception.Message); - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: var viewMacro = new PartialView(PartialViewType.PartialViewMacro, display.VirtualPath); viewMacro.Content = display.Content; var resultMacro = Services.FileService.CreatePartialViewMacro(viewMacro, display.Snippet, Security.CurrentUser.Id); return resultMacro.Success == true ? Request.CreateResponse(HttpStatusCode.OK) : Request.CreateNotificationValidationErrorResponse(resultMacro.Exception.Message); - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: var script = new Script(display.VirtualPath); Services.FileService.SaveScript(script, Security.CurrentUser.Id); return Request.CreateResponse(HttpStatusCode.OK); @@ -93,7 +93,7 @@ namespace Umbraco.Web.Editors // if the parentId is root (-1) then we just need an empty string as we are // creating the path below and we don't want -1 in the path - if (parentId == Core.Constants.System.RootString) + if (parentId == Core.ConstantsCore.System.RootString) { parentId = string.Empty; } @@ -109,19 +109,19 @@ namespace Umbraco.Web.Editors var virtualPath = string.Empty; switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: virtualPath = NormalizeVirtualPath(name, SystemDirectories.PartialViews); Services.FileService.CreatePartialViewFolder(virtualPath); break; - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: virtualPath = NormalizeVirtualPath(name, SystemDirectories.MacroPartials); Services.FileService.CreatePartialViewMacroFolder(virtualPath); break; - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: virtualPath = NormalizeVirtualPath(name, SystemDirectories.Scripts); Services.FileService.CreateScriptFolder(virtualPath); break; - case Core.Constants.Trees.Stylesheets: + case Core.ConstantsCore.Trees.Stylesheets: virtualPath = NormalizeVirtualPath(name, SystemDirectories.Css); Services.FileService.CreateStyleSheetFolder(virtualPath); break; @@ -150,48 +150,48 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: var view = Services.FileService.GetPartialView(virtualPath); if (view != null) { var display = Mapper.Map(view); - display.FileType = Core.Constants.Trees.PartialViews; + display.FileType = Core.ConstantsCore.Trees.PartialViews; display.Path = Url.GetTreePathFromFilePath(view.Path); display.Id = System.Web.HttpUtility.UrlEncode(view.Path); return display; } throw new HttpResponseException(HttpStatusCode.NotFound); - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: var viewMacro = Services.FileService.GetPartialViewMacro(virtualPath); if (viewMacro != null) { var display = Mapper.Map(viewMacro); - display.FileType = Core.Constants.Trees.PartialViewMacros; + display.FileType = Core.ConstantsCore.Trees.PartialViewMacros; display.Path = Url.GetTreePathFromFilePath(viewMacro.Path); display.Id = System.Web.HttpUtility.UrlEncode(viewMacro.Path); return display; } throw new HttpResponseException(HttpStatusCode.NotFound); - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: var script = Services.FileService.GetScriptByName(virtualPath); if (script != null) { var display = Mapper.Map(script); - display.FileType = Core.Constants.Trees.Scripts; + display.FileType = Core.ConstantsCore.Trees.Scripts; display.Path = Url.GetTreePathFromFilePath(script.Path); display.Id = System.Web.HttpUtility.UrlEncode(script.Path); return display; } throw new HttpResponseException(HttpStatusCode.NotFound); - case Core.Constants.Trees.Stylesheets: + case Core.ConstantsCore.Trees.Stylesheets: var stylesheet = Services.FileService.GetStylesheetByName(virtualPath); if (stylesheet != null) { var display = Mapper.Map(stylesheet); - display.FileType = Core.Constants.Trees.Stylesheets; + display.FileType = Core.ConstantsCore.Trees.Stylesheets; display.Path = Url.GetTreePathFromFilePath(stylesheet.Path); display.Id = System.Web.HttpUtility.UrlEncode(stylesheet.Path); return display; @@ -214,7 +214,7 @@ namespace Umbraco.Web.Editors IEnumerable snippets; switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: snippets = Services.FileService.GetPartialViewSnippetNames( //ignore these - (this is taken from the logic in "PartialView.ascx.cs") "Gallery", @@ -222,7 +222,7 @@ namespace Umbraco.Web.Editors "ListChildPagesOrderedByProperty", "ListImagesFromMediaFolder"); break; - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: snippets = Services.FileService.GetPartialViewSnippetNames(); break; default: @@ -248,23 +248,23 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: codeFileDisplay = Mapper.Map(new PartialView(PartialViewType.PartialView, string.Empty)); codeFileDisplay.VirtualPath = SystemDirectories.PartialViews; if (snippetName.IsNullOrWhiteSpace() == false) codeFileDisplay.Content = Services.FileService.GetPartialViewSnippetContent(snippetName); break; - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: codeFileDisplay = Mapper.Map(new PartialView(PartialViewType.PartialViewMacro, string.Empty)); codeFileDisplay.VirtualPath = SystemDirectories.MacroPartials; if (snippetName.IsNullOrWhiteSpace() == false) codeFileDisplay.Content = Services.FileService.GetPartialViewMacroSnippetContent(snippetName); break; - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: codeFileDisplay = Mapper.Map(new Script(string.Empty)); codeFileDisplay.VirtualPath = SystemDirectories.Scripts; break; - case Core.Constants.Trees.Stylesheets: + case Core.ConstantsCore.Trees.Stylesheets: codeFileDisplay = Mapper.Map(new Stylesheet(string.Empty)); codeFileDisplay.VirtualPath = SystemDirectories.Css; break; @@ -275,7 +275,7 @@ namespace Umbraco.Web.Editors // Make sure that the root virtual path ends with '/' codeFileDisplay.VirtualPath = codeFileDisplay.VirtualPath.EnsureEndsWith("/"); - if (id != Core.Constants.System.RootString) + if (id != Core.ConstantsCore.System.RootString) { codeFileDisplay.VirtualPath += id.TrimStart("/").EnsureEndsWith("/"); //if it's not new then it will have a path, otherwise it won't @@ -304,7 +304,7 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: if (IsDirectory(virtualPath, SystemDirectories.PartialViews)) { Services.FileService.DeletePartialViewFolder(virtualPath); @@ -316,7 +316,7 @@ namespace Umbraco.Web.Editors } return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Partial View or folder found with the specified path"); - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: if (IsDirectory(virtualPath, SystemDirectories.MacroPartials)) { Services.FileService.DeletePartialViewMacroFolder(virtualPath); @@ -328,7 +328,7 @@ namespace Umbraco.Web.Editors } return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Partial View Macro or folder found with the specified path"); - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: if (IsDirectory(virtualPath, SystemDirectories.Scripts)) { Services.FileService.DeleteScriptFolder(virtualPath); @@ -341,7 +341,7 @@ namespace Umbraco.Web.Editors } return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Script or folder found with the specified path"); - case Core.Constants.Trees.Stylesheets: + case Core.ConstantsCore.Trees.Stylesheets: if (IsDirectory(virtualPath, SystemDirectories.Css)) { Services.FileService.DeleteStyleSheetFolder(virtualPath); @@ -377,7 +377,7 @@ namespace Umbraco.Web.Editors switch (display.FileType) { - case Core.Constants.Trees.PartialViews: + case Core.ConstantsCore.Trees.PartialViews: var partialViewResult = CreateOrUpdatePartialView(display); if (partialViewResult.Success) { @@ -392,7 +392,7 @@ namespace Umbraco.Web.Editors Services.TextService.Localize("speechBubbles/partialViewErrorText")); break; - case Core.Constants.Trees.PartialViewMacros: + case Core.ConstantsCore.Trees.PartialViewMacros: var partialViewMacroResult = CreateOrUpdatePartialViewMacro(display); if (partialViewMacroResult.Success) { @@ -407,7 +407,7 @@ namespace Umbraco.Web.Editors Services.TextService.Localize("speechBubbles/partialViewErrorText")); break; - case Core.Constants.Trees.Scripts: + case Core.ConstantsCore.Trees.Scripts: var scriptResult = CreateOrUpdateScript(display); display = Mapper.Map(scriptResult, display); @@ -419,7 +419,7 @@ namespace Umbraco.Web.Editors // Services.TextService.Localize("speechBubbles/partialViewErrorHeader"), // Services.TextService.Localize("speechBubbles/partialViewErrorText")); - case Core.Constants.Trees.Stylesheets: + case Core.ConstantsCore.Trees.Stylesheets: var stylesheetResult = CreateOrUpdateStylesheet(display); display = Mapper.Map(stylesheetResult, display); diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index d19c066861..219af1ac50 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -48,7 +48,7 @@ namespace Umbraco.Web.Editors /// access to ALL of the methods on this controller will need access to the content application. /// [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Constants.Applications.Content)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Content)] [ContentControllerConfiguration] public class ContentController : ContentControllerBase { @@ -227,15 +227,15 @@ namespace Umbraco.Web.Editors public ContentItemDisplay GetRecycleBin() { var apps = new List(); - apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "content", Core.Constants.DataTypes.DefaultMembersListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "content", Core.ConstantsCore.DataTypes.DefaultMembersListView)); apps[0].Active = true; var display = new ContentItemDisplay { - Id = Constants.System.RecycleBinContent, + Id = ConstantsCore.System.RecycleBinContent, ParentId = -1, ContentTypeAlias = "recycleBin", IsContainer = true, - Path = "-1," + Constants.System.RecycleBinContent, + Path = "-1," + ConstantsCore.System.RecycleBinContent, Variants = new List { new ContentVariantDisplay @@ -813,7 +813,7 @@ namespace Umbraco.Web.Editors /// /// /// For invariant, the variants collection count will be 1 and this will check if that invariant item has the critical values for persistence (i.e. Name) - /// + /// /// For variant, each variant will be checked for critical data for persistence and if it's not there then it's flags will be reset and it will not /// be persisted. However, we also need to deal with the case where all variants don't pass this check and then there is nothing to save. This also deals /// with removing the Name validation keys based on data annotations validation for items that haven't been marked to be saved. @@ -869,7 +869,7 @@ namespace Umbraco.Web.Editors return true; } - + /// /// Helper method to perform the saving of the content and add the notifications to the result @@ -1161,14 +1161,14 @@ namespace Umbraco.Web.Editors //validate if we can publish based on the mandatory language requirements var canPublish = ValidatePublishingMandatoryLanguages( cultureErrors, - contentItem, cultureVariants, mandatoryCultures, + contentItem, cultureVariants, mandatoryCultures, mandatoryVariant => mandatoryVariant.Publish); //Now check if there are validation errors on each variant. //If validation errors are detected on a variant and it's state is set to 'publish', then we //need to change it to 'save'. //It is a requirement that this is performed AFTER ValidatePublishingMandatoryLanguages. - + foreach (var variant in contentItem.Variants) { if (cultureErrors.Contains(variant.Culture)) @@ -1242,7 +1242,7 @@ namespace Umbraco.Web.Editors //Now check if there are validation errors on each variant. //If validation errors are detected on a variant and it's state is set to 'publish', then we //need to change it to 'save'. - //It is a requirement that this is performed AFTER ValidatePublishingMandatoryLanguages. + //It is a requirement that this is performed AFTER ValidatePublishingMandatoryLanguages. foreach (var variant in contentItem.Variants) { if (cultureErrors.Contains(variant.Culture)) @@ -1372,7 +1372,7 @@ namespace Umbraco.Web.Editors /// Culture to assign the error to /// /// - /// The culture used in the localization message, null by default which means will be used. + /// The culture used in the localization message, null by default which means will be used. /// private void AddCultureValidationError(string culture, string localizationKey, string cultureToken = null) { @@ -1484,10 +1484,10 @@ namespace Umbraco.Web.Editors /// [HttpDelete] [HttpPost] - [EnsureUserPermissionForContent(Constants.System.RecycleBinContent, ActionDelete.ActionLetter)] + [EnsureUserPermissionForContent(ConstantsCore.System.RecycleBinContent, ActionDelete.ActionLetter)] public HttpResponseMessage EmptyRecycleBin() { - Services.ContentService.EmptyRecycleBin(Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + Services.ContentService.EmptyRecycleBin(Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); return Request.CreateNotificationSuccessResponse(Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")); } @@ -1663,7 +1663,7 @@ namespace Umbraco.Web.Editors var uri = DomainUtilities.ParseUriFromDomainName(domain.Name, Request.RequestUri); } catch (UriFormatException) - { + { var response = Request.CreateValidationErrorResponse(Services.TextService.Localize("assignDomain/invalidDomain")); throw new HttpResponseException(response); } @@ -1829,7 +1829,7 @@ namespace Umbraco.Web.Editors base.HandleInvalidModelState(display); } - + /// /// Maps the dto property values and names to the persisted model /// diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 0f51c35a14..6a02e65790 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.Editors /// An API controller used for dealing with content types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.DocumentTypes)] [EnableOverrideAuthorization] public class ContentTypeController : ContentTypeControllerBase { @@ -106,9 +106,9 @@ namespace Umbraco.Web.Editors /// /// [UmbracoTreeAuthorize( - Constants.Trees.DocumentTypes, Constants.Trees.Content, - Constants.Trees.MediaTypes, Constants.Trees.Media, - Constants.Trees.MemberTypes, Constants.Trees.Members)] + ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, + ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, + ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] public IEnumerable GetAllPropertyTypeAliases() { return Services.ContentTypeService.GetAllPropertyTypeAliases(); @@ -119,9 +119,9 @@ namespace Umbraco.Web.Editors /// /// [UmbracoTreeAuthorize( - Constants.Trees.DocumentTypes, Constants.Trees.Content, - Constants.Trees.MediaTypes, Constants.Trees.Media, - Constants.Trees.MemberTypes, Constants.Trees.Members)] + ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, + ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, + ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] public IEnumerable GetAllStandardFields() { string[] preValuesSource = { "createDate", "creatorName", "level", "nodeType", "nodeTypeAlias", "pageID", "pageName", "parentID", "path", "template", "updateDate", "writerID", "writerName" }; @@ -163,9 +163,9 @@ namespace Umbraco.Web.Editors } [UmbracoTreeAuthorize( - Constants.Trees.DocumentTypes, Constants.Trees.Content, - Constants.Trees.MediaTypes, Constants.Trees.Media, - Constants.Trees.MemberTypes, Constants.Trees.Members)] + ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, + ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, + ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] public ContentPropertyDisplay GetPropertyTypeScaffold(int id) { var dataTypeDiff = Services.DataTypeService.GetDataType(id); @@ -370,7 +370,7 @@ namespace Umbraco.Web.Editors public DocumentTypeDisplay GetEmpty(int parentId) { IContentType ct; - if (parentId != Constants.System.Root) + if (parentId != ConstantsCore.System.Root) { var parent = Services.ContentTypeService.Get(parentId); ct = parent != null ? new ContentType(parent, string.Empty) : new ContentType(parentId); @@ -378,7 +378,7 @@ namespace Umbraco.Web.Editors else ct = new ContentType(parentId); - ct.Icon = Constants.Icons.Content; + ct.Icon = ConstantsCore.Icons.Content; var dto = Mapper.Map(ct); return dto; @@ -405,14 +405,14 @@ namespace Umbraco.Web.Editors /// Returns the allowed child content type objects for the content item id passed in /// /// - [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes, Constants.Trees.Content)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content)] public IEnumerable GetAllowedChildren(int contentId) { - if (contentId == Constants.System.RecycleBinContent) + if (contentId == ConstantsCore.System.RecycleBinContent) return Enumerable.Empty(); IEnumerable types; - if (contentId == Constants.System.Root) + if (contentId == ConstantsCore.System.Root) { types = Services.ContentTypeService.GetAll().Where(x => x.AllowedAsRoot).ToList(); } diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs index 31e0d70a42..af565656ac 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -32,7 +32,7 @@ namespace Umbraco.Web.Editors /// Content Types, Member Types or Media Types ... and of course to Data Types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.DataTypes, Constants.Trees.DocumentTypes, Constants.Trees.MediaTypes, Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.DataTypes, ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.MemberTypes)] [EnableOverrideAuthorization] public class DataTypeController : BackOfficeNotificationsController { @@ -346,8 +346,8 @@ namespace Umbraco.Web.Editors /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members /// [UmbracoApplicationAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Packages)] + ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, + ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] public IEnumerable GetAll() { return Services.DataTypeService @@ -363,8 +363,8 @@ namespace Umbraco.Web.Editors /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members /// [UmbracoTreeAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Packages)] + ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, + ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] public IDictionary> GetGroupedDataTypes() { var dataTypes = Services.DataTypeService @@ -396,8 +396,8 @@ namespace Umbraco.Web.Editors /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members /// [UmbracoTreeAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Packages)] + ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, + ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] public IDictionary> GetGroupedPropertyEditors() { var datatypes = new List(); @@ -429,8 +429,8 @@ namespace Umbraco.Web.Editors /// Permission is granted to this method if the user has access to any of these sections: Content, media, settings, developer, members /// [UmbracoTreeAuthorize( - Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, - Constants.Applications.Settings, Constants.Applications.Packages)] + ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, + ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] public IEnumerable GetAllPropertyEditors() { return Current.PropertyEditors diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs index d132fdc201..3654fc0f5d 100644 --- a/src/Umbraco.Web/Editors/DictionaryController.cs +++ b/src/Umbraco.Web/Editors/DictionaryController.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Editors /// Dictionary /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.Dictionary)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Dictionary)] [EnableOverrideAuthorization] public class DictionaryController : BackOfficeNotificationsController { diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 0513017b70..2be28a7304 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -449,7 +449,7 @@ namespace Umbraco.Web.Editors var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeKey); // root is special: we reduce it to start nodes if the user's start node is not the default, then we need to return their start nodes - if (id == Constants.System.Root && startNodes.Length > 0 && startNodes.Contains(Constants.System.Root) == false && !ignoreUserStartNodes) + if (id == ConstantsCore.System.Root && startNodes.Length > 0 && startNodes.Contains(ConstantsCore.System.Root) == false && !ignoreUserStartNodes) { var nodes = Services.EntityService.GetAll(objectType.Value, startNodes).ToArray(); if (nodes.Length == 0) @@ -574,7 +574,7 @@ namespace Umbraco.Web.Editors var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeKey); // root is special: we reduce it to start nodes if the user's start node is not the default, then we need to return their start nodes - if (id == Constants.System.Root && startNodes.Length > 0 && startNodes.Contains(Constants.System.Root) == false && !ignoreUserStartNodes) + if (id == ConstantsCore.System.Root && startNodes.Length > 0 && startNodes.Contains(ConstantsCore.System.Root) == false && !ignoreUserStartNodes) { if (pageNumber > 0) return new PagedResult(0, 0, 0); @@ -668,14 +668,14 @@ namespace Umbraco.Web.Editors IEnumerable entities; long totalRecords; - if (id == Constants.System.Root) + if (id == ConstantsCore.System.Root) { // root is special: we reduce it to start nodes int[] aids = GetStartNodes(type); var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeKey); - entities = aids == null || aids.Contains(Constants.System.Root) || ignoreUserStartNodes + entities = aids == null || aids.Contains(ConstantsCore.System.Root) || ignoreUserStartNodes ? Services.EntityService.GetPagedDescendants(objectType.Value, pageNumber - 1, pageSize, out totalRecords, SqlContext.Query().Where(x => x.Name.Contains(filter)), Ordering.By(orderBy, orderDirection), includeTrashed: false) diff --git a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs index 18fd334b1c..0b12d81546 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs @@ -49,7 +49,7 @@ namespace Umbraco.Web.Editors.Filters if (!ValidateAtLeastOneVariantIsBeingSaved(model, actionContext)) return; if (!contentItemValidator.ValidateExistingContent(model, actionContext)) return; if (!ValidateUserAccess(model, actionContext, _umbracoContextAccessor.UmbracoContext.Security)) return; - + //validate for each variant that is being updated foreach (var variant in model.Variants.Where(x => x.Save)) { @@ -82,7 +82,7 @@ namespace Umbraco.Web.Editors.Filters /// /// private bool ValidateUserAccess(ContentItemSave contentItem, HttpActionContext actionContext, WebSecurity webSecurity) - { + { //We now need to validate that the user is allowed to be doing what they are doing. //Based on the action we need to check different permissions. @@ -121,7 +121,7 @@ namespace Umbraco.Web.Editors.Filters permissionToCheck.Add(ActionNew.ActionLetter); - if (contentItem.ParentId != Constants.System.Root) + if (contentItem.ParentId != ConstantsCore.System.Root) { contentToCheck = _contentService.GetById(contentItem.ParentId); contentIdToCheck = contentToCheck.Id; @@ -136,7 +136,7 @@ namespace Umbraco.Web.Editors.Filters permissionToCheck.Add(ActionNew.ActionLetter); permissionToCheck.Add(ActionToPublish.ActionLetter); - if (contentItem.ParentId != Constants.System.Root) + if (contentItem.ParentId != ConstantsCore.System.Root) { contentToCheck = _contentService.GetById(contentItem.ParentId); contentIdToCheck = contentToCheck.Id; @@ -155,7 +155,7 @@ namespace Umbraco.Web.Editors.Filters permissionToCheck.Add(ActionNew.ActionLetter); permissionToCheck.Add(ActionPublish.ActionLetter); - if (contentItem.ParentId != Constants.System.Root) + if (contentItem.ParentId != ConstantsCore.System.Root) { contentToCheck = _contentService.GetById(contentItem.ParentId); contentIdToCheck = contentToCheck.Id; @@ -166,12 +166,12 @@ namespace Umbraco.Web.Editors.Filters } break; case ContentSaveAction.ScheduleNew: - + permissionToCheck.Add(ActionNew.ActionLetter); permissionToCheck.Add(ActionUpdate.ActionLetter); permissionToCheck.Add(ActionPublish.ActionLetter); - if (contentItem.ParentId != Constants.System.Root) + if (contentItem.ParentId != ConstantsCore.System.Root) { contentToCheck = _contentService.GetById(contentItem.ParentId); contentIdToCheck = contentToCheck.Id; diff --git a/src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs b/src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs index 7351c476e4..66faff7af4 100644 --- a/src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/MediaItemSaveValidationAttribute.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web.Editors.Filters case ContentSaveAction.SaveNew: contentToCheck = _mediaService.GetById(mediaItem.ParentId); - if (mediaItem.ParentId != Constants.System.Root) + if (mediaItem.ParentId != ConstantsCore.System.Root) { contentToCheck = _mediaService.GetById(mediaItem.ParentId); contentIdToCheck = contentToCheck.Id; diff --git a/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs b/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs index 985c42bbbf..0c1301782b 100644 --- a/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs +++ b/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs @@ -59,7 +59,7 @@ namespace Umbraco.Web.Editors.Filters { // We're dealing with new groups, // so authorization should be given to any user with access to Users section - if (currentUser.AllowedSections.Contains(Constants.Applications.Users)) + if (currentUser.AllowedSections.Contains(ConstantsCore.Applications.Users)) return Attempt.Succeed(); } diff --git a/src/Umbraco.Web/Editors/LanguageController.cs b/src/Umbraco.Web/Editors/LanguageController.cs index cb7fde23db..1b04814978 100644 --- a/src/Umbraco.Web/Editors/LanguageController.cs +++ b/src/Umbraco.Web/Editors/LanguageController.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.Editors /// /// Deletes a language with a given ID /// - [UmbracoTreeAuthorize(Core.Constants.Trees.Languages)] + [UmbracoTreeAuthorize(Core.ConstantsCore.Trees.Languages)] [HttpDelete] [HttpPost] public IHttpActionResult DeleteLanguage(int id) @@ -91,7 +91,7 @@ namespace Umbraco.Web.Editors /// /// Creates or saves a language /// - [UmbracoTreeAuthorize(Core.Constants.Trees.Languages)] + [UmbracoTreeAuthorize(Core.ConstantsCore.Trees.Languages)] [HttpPost] public Language SaveLanguage(Language language) { diff --git a/src/Umbraco.Web/Editors/LogController.cs b/src/Umbraco.Web/Editors/LogController.cs index bfd82f8478..75b719fc73 100644 --- a/src/Umbraco.Web/Editors/LogController.cs +++ b/src/Umbraco.Web/Editors/LogController.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Editors [PluginController("UmbracoApi")] public class LogController : UmbracoAuthorizedJsonController { - [UmbracoApplicationAuthorize(Core.Constants.Applications.Content, Core.Constants.Applications.Media)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Content, Core.ConstantsCore.Applications.Media)] public PagedResult GetPagedEntityLog(int id, int pageNumber = 1, int pageSize = 10, @@ -30,7 +30,7 @@ namespace Umbraco.Web.Editors long totalRecords; var dateQuery = sinceDate.HasValue ? SqlContext.Query().Where(x => x.CreateDate >= sinceDate) : null; var result = Services.AuditService.GetPagedItemsByEntity(id, pageNumber - 1, pageSize, out totalRecords, orderDirection, customFilter: dateQuery); - var mapped = result.Select(item => Mapper.Map(item)); + var mapped = result.Select(item => Mapper.Map(item)); var page = new PagedResult(totalRecords, pageNumber, pageSize) { @@ -61,7 +61,7 @@ namespace Umbraco.Web.Editors Items = MapAvatarsAndNames(mapped) }; } - + private IEnumerable MapAvatarsAndNames(IEnumerable items) { var mappedItems = items.ToList(); @@ -79,7 +79,7 @@ namespace Umbraco.Web.Editors { item.UserName = name; } - + } return mappedItems; diff --git a/src/Umbraco.Web/Editors/MacrosController.cs b/src/Umbraco.Web/Editors/MacrosController.cs index 3cb161e547..2a76f1ea0b 100644 --- a/src/Umbraco.Web/Editors/MacrosController.cs +++ b/src/Umbraco.Web/Editors/MacrosController.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Editors /// The API controller used for editing dictionary items /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.Macros)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Macros)] public class MacrosController : BackOfficeNotificationsController { private readonly IMacroService _macroService; diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index a673f06e1d..ff96dcf207 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Editors /// access to ALL of the methods on this controller will need access to the media application. /// [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Constants.Applications.Media)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Media)] [MediaControllerControllerConfiguration] public class MediaController : ContentControllerBase { @@ -82,7 +82,7 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.NotFound); } - var emptyContent = Services.MediaService.CreateMedia("", parentId, contentType.Alias, Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + var emptyContent = Services.MediaService.CreateMedia("", parentId, contentType.Alias, Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); var mapped = Mapper.Map(emptyContent); //remove the listview app if it exists @@ -98,18 +98,18 @@ namespace Umbraco.Web.Editors public MediaItemDisplay GetRecycleBin() { var apps = new List(); - apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "media", Core.Constants.DataTypes.DefaultMediaListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "media", Core.ConstantsCore.DataTypes.DefaultMediaListView)); apps[0].Active = true; var display = new MediaItemDisplay { - Id = Constants.System.RecycleBinMedia, + Id = ConstantsCore.System.RecycleBinMedia, Alias = "recycleBin", ParentId = -1, Name = Services.TextService.Localize("general/recycleBin"), ContentTypeAlias = "recycleBin", CreateDate = DateTime.Now, IsContainer = true, - Path = "-1," + Constants.System.RecycleBinMedia, + Path = "-1," + ConstantsCore.System.RecycleBinMedia, ContentApps = apps }; @@ -255,7 +255,7 @@ namespace Umbraco.Web.Editors { //if a request is made for the root node data but the user's start node is not the default, then // we need to return their start nodes - if (id == Constants.System.Root && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.System.Root) == false) + if (id == ConstantsCore.System.Root && UserStartNodes.Length > 0 && UserStartNodes.Contains(ConstantsCore.System.Root) == false) { if (pageNumber > 0) return new PagedResult>(0, 0, 0); @@ -392,7 +392,7 @@ namespace Umbraco.Web.Editors //if the current item is in the recycle bin if (foundMedia.Trashed == false) { - var moveResult = Services.MediaService.MoveToRecycleBin(foundMedia, Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + var moveResult = Services.MediaService.MoveToRecycleBin(foundMedia, Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); if (moveResult == false) { //returning an object of INotificationModel will ensure that any pending @@ -402,7 +402,7 @@ namespace Umbraco.Web.Editors } else { - var deleteResult = Services.MediaService.Delete(foundMedia, Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + var deleteResult = Services.MediaService.Delete(foundMedia, Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); if (deleteResult == false) { //returning an object of INotificationModel will ensure that any pending @@ -426,7 +426,7 @@ namespace Umbraco.Web.Editors var destinationParentID = move.ParentId; var sourceParentID = toMove.ParentId; - var moveResult = Services.MediaService.Move(toMove, move.ParentId, Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + var moveResult = Services.MediaService.Move(toMove, move.ParentId, Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); if (sourceParentID == destinationParentID) { @@ -502,7 +502,7 @@ namespace Umbraco.Web.Editors } //save the item - var saveStatus = Services.MediaService.Save(contentItem.PersistedContent, Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + var saveStatus = Services.MediaService.Save(contentItem.PersistedContent, Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); //return the updated model var display = Mapper.Map(contentItem.PersistedContent); @@ -548,7 +548,7 @@ namespace Umbraco.Web.Editors [HttpPost] public HttpResponseMessage EmptyRecycleBin() { - Services.MediaService.EmptyRecycleBin(Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); + Services.MediaService.EmptyRecycleBin(Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); return Request.CreateNotificationSuccessResponse(Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")); } @@ -922,7 +922,7 @@ namespace Umbraco.Web.Editors if (mediaService == null) throw new ArgumentNullException("mediaService"); if (entityService == null) throw new ArgumentNullException("entityService"); - if (media == null && nodeId != Constants.System.Root && nodeId != Constants.System.RecycleBinMedia) + if (media == null && nodeId != ConstantsCore.System.Root && nodeId != ConstantsCore.System.RecycleBinMedia) { media = mediaService.GetById(nodeId); //put the content item into storage so it can be retrieved @@ -930,14 +930,14 @@ namespace Umbraco.Web.Editors storage[typeof(IMedia).ToString()] = media; } - if (media == null && nodeId != Constants.System.Root && nodeId != Constants.System.RecycleBinMedia) + if (media == null && nodeId != ConstantsCore.System.Root && nodeId != ConstantsCore.System.RecycleBinMedia) { throw new HttpResponseException(HttpStatusCode.NotFound); } - var hasPathAccess = (nodeId == Constants.System.Root) + var hasPathAccess = (nodeId == ConstantsCore.System.Root) ? user.HasMediaRootAccess(entityService) - : (nodeId == Constants.System.RecycleBinMedia) + : (nodeId == ConstantsCore.System.RecycleBinMedia) ? user.HasMediaBinAccess(entityService) : user.HasPathAccess(media, entityService); diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs index 43569c77e2..3c4c809578 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.Editors /// An API controller used for dealing with content types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes)] [EnableOverrideAuthorization] [MediaTypeControllerControllerConfiguration] public class MediaTypeController : ContentTypeControllerBase @@ -58,7 +58,7 @@ namespace Umbraco.Web.Editors return Services.ContentTypeService.Count(); } - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] public MediaTypeDisplay GetById(int id) { var ct = Services.MediaTypeService.Get(id); @@ -137,7 +137,7 @@ namespace Umbraco.Web.Editors public MediaTypeDisplay GetEmpty(int parentId) { IMediaType mt; - if (parentId != Constants.System.Root) + if (parentId != ConstantsCore.System.Root) { var parent = Services.MediaTypeService.Get(parentId); mt = parent != null ? new MediaType(parent, string.Empty) : new MediaType(parentId); @@ -145,7 +145,7 @@ namespace Umbraco.Web.Editors else mt = new MediaType(parentId); - mt.Icon = Constants.Icons.MediaImage; + mt.Icon = ConstantsCore.Icons.MediaImage; var dto = Mapper.Map(mt); return dto; @@ -216,14 +216,14 @@ namespace Umbraco.Web.Editors /// Returns the allowed child content type objects for the content item id passed in - based on an INT id /// /// - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] public IEnumerable GetAllowedChildren(int contentId) { - if (contentId == Constants.System.RecycleBinContent) + if (contentId == ConstantsCore.System.RecycleBinContent) return Enumerable.Empty(); IEnumerable types; - if (contentId == Constants.System.Root) + if (contentId == ConstantsCore.System.Root) { types = Services.MediaTypeService.GetAll().ToList(); @@ -262,7 +262,7 @@ namespace Umbraco.Web.Editors /// Returns the allowed child content type objects for the content item id passed in - based on a GUID id /// /// - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] public IEnumerable GetAllowedChildren(Guid contentId) { var entity = Current.Services.EntityService.Get(contentId); @@ -278,7 +278,7 @@ namespace Umbraco.Web.Editors /// Returns the allowed child content type objects for the content item id passed in - based on a UDI id /// /// - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] public IEnumerable GetAllowedChildren(Udi contentId) { var guidUdi = contentId as GuidUdi; diff --git a/src/Umbraco.Web/Editors/MemberController.cs b/src/Umbraco.Web/Editors/MemberController.cs index 477dced7d0..88c4a19c2b 100644 --- a/src/Umbraco.Web/Editors/MemberController.cs +++ b/src/Umbraco.Web/Editors/MemberController.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Editors /// access to ALL of the methods on this controller will need access to the member application. /// [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorizeAttribute(Constants.Applications.Members)] + [UmbracoApplicationAuthorizeAttribute(ConstantsCore.Applications.Members)] [OutgoingNoHyphenGuidFormat] public class MemberController : ContentControllerBase { @@ -139,7 +139,7 @@ namespace Umbraco.Web.Editors var name = foundType != null ? foundType.Name : listName; var apps = new List(); - apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, listName, "member", Core.Constants.DataTypes.DefaultMembersListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, listName, "member", Core.ConstantsCore.DataTypes.DefaultMembersListView)); apps[0].Active = true; var display = new MemberListDisplay diff --git a/src/Umbraco.Web/Editors/MemberGroupController.cs b/src/Umbraco.Web/Editors/MemberGroupController.cs index 67bd126e6e..bcdadc75ea 100644 --- a/src/Umbraco.Web/Editors/MemberGroupController.cs +++ b/src/Umbraco.Web/Editors/MemberGroupController.cs @@ -4,13 +4,14 @@ using System.Net; using System.Net.Http; using System.Web.Http; using System.Web.Security; +using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Security; using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; +using Constants = Umbraco.Core.ConstantsCore; namespace Umbraco.Web.Editors { diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs index fffead9155..f57b5d4208 100644 --- a/src/Umbraco.Web/Editors/MemberTypeController.cs +++ b/src/Umbraco.Web/Editors/MemberTypeController.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Editors /// An API controller used for dealing with member types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(new string[] { Constants.Trees.MemberTypes, Constants.Trees.Members})] + [UmbracoTreeAuthorize(new string[] { ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members})] public class MemberTypeController : ContentTypeControllerBase { public MemberTypeController(ICultureDictionaryFactory cultureDictionaryFactory, IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) @@ -36,7 +36,7 @@ namespace Umbraco.Web.Editors private readonly MembershipProvider _provider = Core.Security.MembershipProviderExtensions.GetMembersMembershipProvider(); - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] public MemberTypeDisplay GetById(int id) { var ct = Services.MemberTypeService.Get(id); @@ -56,7 +56,7 @@ namespace Umbraco.Web.Editors /// [HttpDelete] [HttpPost] - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] public HttpResponseMessage DeleteById(int id) { var foundType = Services.MemberTypeService.Get(id); @@ -84,7 +84,7 @@ namespace Umbraco.Web.Editors /// /// - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] public HttpResponseMessage GetAvailableCompositeMemberTypes(int contentTypeId, [FromUri]string[] filterContentTypes, [FromUri]string[] filterPropertyTypes) @@ -98,11 +98,11 @@ namespace Umbraco.Web.Editors return Request.CreateResponse(result); } - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] public MemberTypeDisplay GetEmpty() { var ct = new MemberType(-1); - ct.Icon = Constants.Icons.Member; + ct.Icon = ConstantsCore.Icons.Member; var dto = Mapper.Map(ct); return dto; @@ -122,7 +122,7 @@ namespace Umbraco.Web.Editors return Enumerable.Empty(); } - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] public MemberTypeDisplay PostSave(MemberTypeSave contentTypeSave) { //get the persisted member type diff --git a/src/Umbraco.Web/Editors/PackageController.cs b/src/Umbraco.Web/Editors/PackageController.cs index dd0b286a42..e2b30943f7 100644 --- a/src/Umbraco.Web/Editors/PackageController.cs +++ b/src/Umbraco.Web/Editors/PackageController.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Editors /// [PluginController("UmbracoApi")] [SerializeVersion] - [UmbracoApplicationAuthorize(Core.Constants.Applications.Packages)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Packages)] public class PackageController : UmbracoAuthorizedJsonController { public IEnumerable GetCreatedPackages() @@ -65,7 +65,7 @@ namespace Umbraco.Web.Editors Services.PackagingService.ExportCreatedPackage(model); - //the packagePath will be on the model + //the packagePath will be on the model return model; } diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs index 6b2bd07fbd..309eca8a7e 100644 --- a/src/Umbraco.Web/Editors/PackageInstallController.cs +++ b/src/Umbraco.Web/Editors/PackageInstallController.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.Editors /// A controller used for installing packages and managing all of the data in the packages section in the back office /// [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Core.Constants.Applications.Packages)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Packages)] public class PackageInstallController : UmbracoAuthorizedJsonController { public PackageInstallController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, diff --git a/src/Umbraco.Web/Editors/PasswordChanger.cs b/src/Umbraco.Web/Editors/PasswordChanger.cs index 2698a68b40..8d6b05369c 100644 --- a/src/Umbraco.Web/Editors/PasswordChanger.cs +++ b/src/Umbraco.Web/Editors/PasswordChanger.cs @@ -79,7 +79,7 @@ namespace Umbraco.Web.Editors } //if the current user has access to reset/manually change the password - if (currentUser.HasSectionAccess(Umbraco.Core.Constants.Applications.Users) == false) + if (currentUser.HasSectionAccess(Umbraco.Core.ConstantsCore.Applications.Users) == false) { return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("The current user is not authorized", new[] { "resetPassword" }) }); } @@ -246,7 +246,7 @@ namespace Umbraco.Web.Editors return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Cannot set an empty password", new[] { "value" }) }); } - //without being able to retrieve the original password, + //without being able to retrieve the original password, //we cannot arbitrarily change the password without knowing the old one and no old password was supplied - need to return an error if (passwordModel.OldPassword.IsNullOrWhiteSpace() && membershipProvider.EnablePasswordRetrieval == false) { diff --git a/src/Umbraco.Web/Editors/PreviewController.cs b/src/Umbraco.Web/Editors/PreviewController.cs index c1848419dc..2cb68c3ec3 100644 --- a/src/Umbraco.Web/Editors/PreviewController.cs +++ b/src/Umbraco.Web/Editors/PreviewController.cs @@ -84,7 +84,7 @@ namespace Umbraco.Web.Editors var previewToken = _publishedSnapshotService.EnterPreview(user, id); - Response.Cookies.Set(new HttpCookie(Constants.Web.PreviewCookieName, previewToken)); + Response.Cookies.Set(new HttpCookie(ConstantsCore.Web.PreviewCookieName, previewToken)); // use a numeric url because content may not be in cache and so .Url would fail var query = culture.IsNullOrWhiteSpace() ? string.Empty : $"?culture={culture}"; @@ -99,7 +99,7 @@ namespace Umbraco.Web.Editors var service = Current.PublishedSnapshotService; service.ExitPreview(previewToken); - System.Web.HttpContext.Current.ExpireCookie(Constants.Web.PreviewCookieName); + System.Web.HttpContext.Current.ExpireCookie(ConstantsCore.Web.PreviewCookieName); if (Uri.IsWellFormedUriString(redir, UriKind.Relative) && redir.StartsWith("//") == false diff --git a/src/Umbraco.Web/Editors/RelationController.cs b/src/Umbraco.Web/Editors/RelationController.cs index b7f9baba55..509275d0e5 100644 --- a/src/Umbraco.Web/Editors/RelationController.cs +++ b/src/Umbraco.Web/Editors/RelationController.cs @@ -13,7 +13,7 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Constants.Applications.Content)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Content)] public class RelationController : UmbracoAuthorizedJsonController { public RelationDisplay GetById(int id) diff --git a/src/Umbraco.Web/Editors/RelationTypeController.cs b/src/Umbraco.Web/Editors/RelationTypeController.cs index faafbb79f1..404ee346d8 100644 --- a/src/Umbraco.Web/Editors/RelationTypeController.cs +++ b/src/Umbraco.Web/Editors/RelationTypeController.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.Editors /// The API controller for editing relation types. /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.RelationTypes)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.RelationTypes)] [EnableOverrideAuthorization] public class RelationTypeController : BackOfficeNotificationsController { diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs index 8da5e80f2e..dca1afcc03 100644 --- a/src/Umbraco.Web/Editors/TemplateController.cs +++ b/src/Umbraco.Web/Editors/TemplateController.cs @@ -19,7 +19,7 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(Constants.Trees.Templates)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Templates)] public class TemplateController : BackOfficeNotificationsController { public TemplateController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper) diff --git a/src/Umbraco.Web/Editors/TinyMceController.cs b/src/Umbraco.Web/Editors/TinyMceController.cs index c6c1acd048..2f64a4ff98 100644 --- a/src/Umbraco.Web/Editors/TinyMceController.cs +++ b/src/Umbraco.Web/Editors/TinyMceController.cs @@ -20,9 +20,9 @@ namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] [UmbracoApplicationAuthorize( - Constants.Applications.Content, - Constants.Applications.Media, - Constants.Applications.Members)] + ConstantsCore.Applications.Content, + ConstantsCore.Applications.Media, + ConstantsCore.Applications.Members)] public class TinyMceController : UmbracoAuthorizedApiController { private IMediaService _mediaService; diff --git a/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs b/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs index 320580aaf9..7498f81816 100644 --- a/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs +++ b/src/Umbraco.Web/Editors/UserEditorAuthorizationHelper.cs @@ -112,9 +112,9 @@ namespace Umbraco.Web.Editors { foreach (var contentId in startContentIds) { - if (contentId == Constants.System.Root) + if (contentId == ConstantsCore.System.Root) { - var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateContentStartNodeIds(_entityService), Constants.System.RecycleBinContent); + var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateContentStartNodeIds(_entityService), ConstantsCore.System.RecycleBinContent); if (hasAccess == false) return Attempt.Fail("The current user does not have access to the content root"); } @@ -133,9 +133,9 @@ namespace Umbraco.Web.Editors { foreach (var mediaId in startMediaIds) { - if (mediaId == Constants.System.Root) + if (mediaId == ConstantsCore.System.Root) { - var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateMediaStartNodeIds(_entityService), Constants.System.RecycleBinMedia); + var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateMediaStartNodeIds(_entityService), ConstantsCore.System.RecycleBinMedia); if (hasAccess == false) return Attempt.Fail("The current user does not have access to the media root"); } diff --git a/src/Umbraco.Web/Editors/UserGroupsController.cs b/src/Umbraco.Web/Editors/UserGroupsController.cs index b081ca6137..3a68c80eb7 100644 --- a/src/Umbraco.Web/Editors/UserGroupsController.cs +++ b/src/Umbraco.Web/Editors/UserGroupsController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; +using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; @@ -17,7 +18,7 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Constants.Applications.Users)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Users)] [PrefixlessBodyModelValidator] public class UserGroupsController : UmbracoAuthorizedJsonController { @@ -123,7 +124,7 @@ namespace Umbraco.Web.Editors if (onlyCurrentUserGroups == false) { //this user is not an admin so in that case we need to exclude all admin users - allGroups.RemoveAt(allGroups.IndexOf(allGroups.Find(basic => basic.Alias == Constants.Security.AdminGroupAlias))); + allGroups.RemoveAt(allGroups.IndexOf(allGroups.Find(basic => basic.Alias == ConstantsCore.Security.AdminGroupAlias))); return allGroups; } diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs index 15e5b9404f..36223c4edf 100644 --- a/src/Umbraco.Web/Editors/UsersController.cs +++ b/src/Umbraco.Web/Editors/UsersController.cs @@ -37,7 +37,7 @@ using Task = System.Threading.Tasks.Task; namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(Constants.Applications.Users)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Users)] [PrefixlessBodyModelValidator] [IsCurrentUserModelFilter] public class UsersController : UmbracoAuthorizedJsonController @@ -208,7 +208,7 @@ namespace Umbraco.Web.Editors if (isAdmin == false) { //this user is not an admin so in that case we need to exclude all admin users - excludeUserGroups = new[] {Constants.Security.AdminGroupAlias}; + excludeUserGroups = new[] {ConstantsCore.Security.AdminGroupAlias}; } var filterQuery = Current.SqlContext.Query(); @@ -217,7 +217,7 @@ namespace Umbraco.Web.Editors { // only super can see super - but don't use IsSuper, cannot be mapped to SQL //filterQuery.Where(x => !x.IsSuper()); - filterQuery.Where(x => x.Id != Constants.Security.SuperUserId); + filterQuery.Where(x => x.Id != ConstantsCore.Security.SuperUserId); } if (filter.IsNullOrWhiteSpace() == false) diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs index 2f72b946de..eca225f093 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.HealthCheck /// /// The API controller used to display the health check info and execute any actions /// - [UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Settings)] public class HealthCheckController : UmbracoAuthorizedJsonController { private readonly HealthCheckCollection _checks; diff --git a/src/Umbraco.Web/HttpCookieExtensions.cs b/src/Umbraco.Web/HttpCookieExtensions.cs index 5f520653f5..c0e9561ca0 100644 --- a/src/Umbraco.Web/HttpCookieExtensions.cs +++ b/src/Umbraco.Web/HttpCookieExtensions.cs @@ -86,12 +86,12 @@ namespace Umbraco.Web public static string GetPreviewCookieValue(this HttpRequestMessage request) { - var cookie = request.Headers.GetCookies(Constants.Web.PreviewCookieName).FirstOrDefault(); + var cookie = request.Headers.GetCookies(ConstantsCore.Web.PreviewCookieName).FirstOrDefault(); if (cookie != null) { - if (cookie[Constants.Web.PreviewCookieName] != null) + if (cookie[ConstantsCore.Web.PreviewCookieName] != null) { - return cookie[Constants.Web.PreviewCookieName].Value; + return cookie[ConstantsCore.Web.PreviewCookieName].Value; } } return null; @@ -99,7 +99,7 @@ namespace Umbraco.Web public static string GetPreviewCookieValue(this HttpRequestBase request) { - return request.GetCookieValue(Constants.Web.PreviewCookieName); + return request.GetCookieValue(ConstantsCore.Web.PreviewCookieName); } public static string GetPreviewCookieValue(this HttpRequest request) @@ -114,7 +114,7 @@ namespace Umbraco.Web /// public static bool HasPreviewCookie(this HttpRequestBase request) { - return request.Cookies[Constants.Web.PreviewCookieName] != null; + return request.Cookies[ConstantsCore.Web.PreviewCookieName] != null; } /// @@ -134,7 +134,7 @@ namespace Umbraco.Web /// public static bool HasPreviewCookie(this IOwinRequest request) { - return request.Cookies[Constants.Web.PreviewCookieName] != null; + return request.Cookies[ConstantsCore.Web.PreviewCookieName] != null; } /// diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index effb46c9b7..45199012a0 100644 --- a/src/Umbraco.Web/Install/InstallHelper.cs +++ b/src/Umbraco.Web/Install/InstallHelper.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.Install // Check for current install Id var installId = Guid.NewGuid(); - var installCookie = _httpContext.Request.GetCookieValue(Constants.Web.InstallerCookieName); + var installCookie = _httpContext.Request.GetCookieValue(ConstantsCore.Web.InstallerCookieName); if (string.IsNullOrEmpty(installCookie) == false) { if (Guid.TryParse(installCookie, out installId)) @@ -60,7 +60,7 @@ namespace Umbraco.Web.Install installId = Guid.NewGuid(); } } - _httpContext.Response.Cookies.Set(new HttpCookie(Constants.Web.InstallerCookieName, "1")); + _httpContext.Response.Cookies.Set(new HttpCookie(ConstantsCore.Web.InstallerCookieName, "1")); var dbProvider = string.Empty; if (IsBrandNewInstall == false) @@ -113,7 +113,7 @@ namespace Umbraco.Web.Install { get { - var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; if (_globalSettings.ConfigurationStatus.IsNullOrWhiteSpace() && _databaseBuilder.IsConnectionStringConfigured(databaseSettings) == false) { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs index d119759488..4629376309 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseConfigureStep.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.Install.InstallSteps private bool ShouldDisplayView() { //If the connection string is already present in web.config we don't need to show the settings page and we jump to installing/upgrading. - var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; if (_databaseBuilder.IsConnectionStringConfigured(databaseSettings)) { diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs index c680b6e41a..a5703ded89 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseInstallStep.cs @@ -53,13 +53,13 @@ namespace Umbraco.Web.Install.InstallSteps internal static void HandleConnectionStrings(ILogger logger) { // Remove legacy umbracoDbDsn configuration setting if it exists and connectionstring also exists - if (ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName] != null) + if (ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName] != null) { - GlobalSettings.RemoveSetting(Constants.System.UmbracoConnectionName); + GlobalSettings.RemoveSetting(ConstantsCore.System.UmbracoConnectionName); } else { - var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", Constants.System.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); + var ex = new ArgumentNullException(string.Format("ConfigurationManager.ConnectionStrings[{0}]", ConstantsCore.System.UmbracoConnectionName), "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); logger.Error(ex, "Install / upgrade did not complete successfully, umbracoDbDSN was not set in the connectionStrings section"); throw ex; } diff --git a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs index 4e8068c4c5..be84c50a9e 100644 --- a/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/DatabaseUpgradeStep.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.Install.InstallSteps return false; } - var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; if (_databaseBuilder.IsConnectionStringConfigured(databaseSettings)) { diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index 151265f394..1802fcc823 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -54,16 +54,16 @@ namespace Umbraco.Web.Install.InstallSteps public override Task ExecuteAsync(UserModel user) { - var admin = _userService.GetUserById(Constants.Security.SuperUserId); + var admin = _userService.GetUserById(ConstantsCore.Security.SuperUserId); if (admin == null) { throw new InvalidOperationException("Could not find the super user!"); } - var membershipUser = CurrentProvider.GetUser(Constants.Security.SuperUserId, true); + var membershipUser = CurrentProvider.GetUser(ConstantsCore.Security.SuperUserId, true); if (membershipUser == null) { - throw new InvalidOperationException($"No user found in membership provider with id of {Constants.Security.SuperUserId}."); + throw new InvalidOperationException($"No user found in membership provider with id of {ConstantsCore.Security.SuperUserId}."); } try @@ -135,7 +135,7 @@ namespace Umbraco.Web.Install.InstallSteps public override bool RequiresExecution(UserModel model) { //now we have to check if this is really a new install, the db might be configured and might contain data - var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; //if there's already a version then there should def be a user but in some cases someone may have // left a version number in there but cleared out their db conn string, in that case, it's really a new install. diff --git a/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs b/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs index b5fdea32b7..77f420a057 100644 --- a/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs @@ -51,13 +51,13 @@ namespace Umbraco.Web.Install.InstallSteps if (userIdAttempt && userIdAttempt.Result == 0) { security.ClearCurrentLogin(); - security.PerformLogin(Constants.Security.SuperUserId); + security.PerformLogin(ConstantsCore.Security.SuperUserId); } } else if (_globalSettings.ConfigurationStatus.IsNullOrWhiteSpace()) { // for installs, we need to log the super user in - security.PerformLogin(Constants.Security.SuperUserId); + security.PerformLogin(ConstantsCore.Security.SuperUserId); } // Update configurationStatus diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index 44ee77507b..ef296dbf71 100644 --- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs +++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs @@ -73,7 +73,7 @@ namespace Umbraco.Web.Macros var routeVals = new RouteData(); routeVals.Values.Add("controller", "PartialViewMacro"); routeVals.Values.Add("action", "Index"); - routeVals.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); //required for UmbracoViewPage + routeVals.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); //required for UmbracoViewPage //lets render this controller as a child action var viewContext = new ViewContext { ViewData = new ViewDataDictionary() }; diff --git a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs index 7bf4a94b1c..d99ec22236 100644 --- a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs @@ -51,7 +51,7 @@ namespace Umbraco.Web.Models.Mapping // TODO: We can resolve the UmbracoContext from the IValueResolver options! // OMG if (HttpContext.Current != null && Composing.Current.UmbracoContext != null && Composing.Current.UmbracoContext.Security.CurrentUser != null - && Composing.Current.UmbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) + && Composing.Current.UmbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(ConstantsCore.Applications.Settings))) { var contentType = _contentTypeBaseServiceProvider.GetContentTypeOf(source); var contentTypeBasic = context.Map(contentType); diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs index 528d5f6de5..9f757c3b4b 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeMapDefinition.cs @@ -541,7 +541,7 @@ namespace Umbraco.Web.Models.Mapping private IEnumerable MapLockedCompositions(IContentTypeComposition source) { // get ancestor ids from path of parent if not root - if (source.ParentId == Constants.System.Root) + if (source.ParentId == ConstantsCore.System.Root) return Enumerable.Empty(); var parent = _contentTypeService.Get(source.ParentId); diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs index 6b5797e05b..29909e3837 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/DataTypeMapDefinition.cs @@ -24,9 +24,9 @@ namespace Umbraco.Web.Models.Mapping private static readonly int[] SystemIds = { - Constants.DataTypes.DefaultContentListView, - Constants.DataTypes.DefaultMediaListView, - Constants.DataTypes.DefaultMembersListView + ConstantsCore.DataTypes.DefaultContentListView, + ConstantsCore.DataTypes.DefaultMediaListView, + ConstantsCore.DataTypes.DefaultMembersListView }; public void DefineMaps(UmbracoMapper mapper) @@ -150,7 +150,7 @@ namespace Umbraco.Web.Models.Mapping return fields; } - + private void MapConfigurationFields(IDataType dataType, List fields, IDictionary configuration) { if (fields == null) throw new ArgumentNullException(nameof(fields)); @@ -160,7 +160,7 @@ namespace Umbraco.Web.Models.Mapping foreach (var field in fields.ToList()) { //filter out the not-supported pre-values for built-in data types - if (dataType != null && dataType.IsBuildInDataType() && field.Key.InvariantEquals(Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes)) + if (dataType != null && dataType.IsBuildInDataType() && field.Key.InvariantEquals(ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes)) { fields.Remove(field); continue; diff --git a/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs index 2e44f1327b..db223194e2 100644 --- a/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/EntityMapDefinition.cs @@ -95,7 +95,7 @@ namespace Umbraco.Web.Models.Mapping private static void Map(IUser source, EntityBasic target, MapperContext context) { target.Alias = source.Username; - target.Icon = Constants.Icons.User; + target.Icon = ConstantsCore.Icons.User; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; @@ -107,7 +107,7 @@ namespace Umbraco.Web.Models.Mapping private static void Map(ITemplate source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; - target.Icon = Constants.Icons.Template; + target.Icon = ConstantsCore.Icons.Template; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; @@ -149,16 +149,16 @@ namespace Umbraco.Web.Models.Mapping if (target.Icon.IsNullOrWhiteSpace()) { - if (source.NodeObjectType == Constants.ObjectTypes.Member) - target.Icon = Constants.Icons.Member; - else if (source.NodeObjectType == Constants.ObjectTypes.DataType) - target.Icon = Constants.Icons.DataType; - else if (source.NodeObjectType == Constants.ObjectTypes.DocumentType) - target.Icon = Constants.Icons.ContentType; - else if (source.NodeObjectType == Constants.ObjectTypes.MediaType) - target.Icon = Constants.Icons.MediaType; - else if (source.NodeObjectType == Constants.ObjectTypes.TemplateType) - target.Icon = Constants.Icons.Template; + if (source.NodeObjectType == ConstantsCore.ObjectTypes.Member) + target.Icon = ConstantsCore.Icons.Member; + else if (source.NodeObjectType == ConstantsCore.ObjectTypes.DataType) + target.Icon = ConstantsCore.Icons.DataType; + else if (source.NodeObjectType == ConstantsCore.ObjectTypes.DocumentType) + target.Icon = ConstantsCore.Icons.ContentType; + else if (source.NodeObjectType == ConstantsCore.ObjectTypes.MediaType) + target.Icon = ConstantsCore.Icons.MediaType; + else if (source.NodeObjectType == ConstantsCore.ObjectTypes.TemplateType) + target.Icon = ConstantsCore.Icons.Template; } } @@ -173,7 +173,7 @@ namespace Umbraco.Web.Models.Mapping //get the icon if there is one target.Icon = source.Values.ContainsKey(UmbracoExamineIndex.IconFieldName) ? source.Values[UmbracoExamineIndex.IconFieldName] - : Constants.Icons.DefaultIcon; + : ConstantsCore.Icons.DefaultIcon; target.Name = source.Values.ContainsKey("nodeName") ? source.Values["nodeName"] : "[no name]"; @@ -230,7 +230,7 @@ namespace Umbraco.Web.Models.Mapping // NOTE: this case covers both content and media entities return contentEntity.ContentTypeIcon; case MemberEntitySlim memberEntity: - return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(Constants.Icons.Member); + return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(ConstantsCore.Icons.Member); } return null; diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs index e5bca22287..64ac5162c2 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.Mapping private static void Map(IMacro source, EntityBasic target, MapperContext context) { target.Alias = source.Alias; - target.Icon = Constants.Icons.Macro; + target.Icon = ConstantsCore.Icons.Macro; target.Id = source.Id; target.Key = source.Key; target.Name = source.Name; diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs index 8671bfe538..8c888ffa38 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs @@ -128,7 +128,7 @@ namespace Umbraco.Web.Models.Mapping { target.CreateDate = source.CreationDate; target.Email = source.Email; - target.Icon = Constants.Icons.Member; + target.Icon = ConstantsCore.Icons.Member; target.Id = int.MaxValue; target.Key = source.ProviderUserKey.TryConvertTo().Result; target.Name = source.UserName; diff --git a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs index 8744b068a7..7958525eaa 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesMapper.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Models.Mapping var umbracoContext = _umbracoContextAccessor.UmbracoContext; if (umbracoContext != null && umbracoContext.Security.CurrentUser != null - && umbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) + && umbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(ConstantsCore.Applications.Settings))) { var memberTypeLink = string.Format("#/member/memberTypes/edit/{0}", source.ContentTypeId); @@ -96,7 +96,7 @@ namespace Umbraco.Web.Models.Mapping linkText = source.ContentType.Name, url = memberTypeLink, target = "_self", - icon = Constants.Icons.ContentType + icon = ConstantsCore.Icons.ContentType } }; docTypeProperty.View = "urllist"; diff --git a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs index 88960fb189..bd187dc286 100644 --- a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs +++ b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs @@ -183,7 +183,7 @@ namespace Umbraco.Web.Models.Mapping target.DefaultPermissions = MapUserGroupDefaultPermissions(source); if (target.Icon.IsNullOrWhiteSpace()) - target.Icon = Constants.Icons.UserGroup; + target.Icon = ConstantsCore.Icons.UserGroup; } // Umbraco.Code.MapAll -Trashed -Alias -AssignedPermissions @@ -197,8 +197,8 @@ namespace Umbraco.Web.Models.Mapping target.Path = source.Path; target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key); - if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace()) - target.Icon = Constants.Icons.Member; + if (source.NodeObjectType == ConstantsCore.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace()) + target.Icon = ConstantsCore.Icons.Member; } // Umbraco.Code.MapAll -ContentStartNode -MediaStartNode -Sections -Notifications -Udi @@ -355,7 +355,7 @@ namespace Umbraco.Web.Models.Mapping target.ContentStartNode = CreateRootNode(_textService.Localize("content/contentRoot")); if (target.Icon.IsNullOrWhiteSpace()) - target.Icon = Constants.Icons.UserGroup; + target.Icon = ConstantsCore.Icons.UserGroup; } private IDictionary> MapUserGroupDefaultPermissions(IUserGroup source) diff --git a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs b/src/Umbraco.Web/Models/Trees/TreeRootNode.cs index e26dffe5e4..a5b4c6042b 100644 --- a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs +++ b/src/Umbraco.Web/Models/Trees/TreeRootNode.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Models.Trees [DataContract(Name = "node", Namespace = "")] public sealed class TreeRootNode : TreeNode { - private static readonly string RootId = Core.Constants.System.RootString; + private static readonly string RootId = Core.ConstantsCore.System.RootString; private bool _isGroup; private bool _isSingleNodeTree; @@ -95,7 +95,7 @@ namespace Umbraco.Web.Models.Trees return new TreeRootNode(nodeId, getChildNodesUrl, menuUrl) { Children = children, - Name = title, + Name = title, _isSingleNodeTree = isSingleNodeTree }; } diff --git a/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs b/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs index 882cb5624c..23c9b887c0 100644 --- a/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.Mvc private static string GetAuthHeaderVal(IUserService userService) { - var admin = userService.GetUserById(Core.Constants.Security.SuperUserId); + var admin = userService.GetUserById(Core.ConstantsCore.Security.SuperUserId); var token = $"{admin.Email}u____u{admin.Username}u____u{admin.RawPasswordValue}"; @@ -94,7 +94,7 @@ namespace Umbraco.Web.Mvc if (keyVal.Count != 1) return false; if (keyVal[0].Groups.Count != 2) return false; - var admin = UserService.GetUserById(Core.Constants.Security.SuperUserId); + var admin = UserService.GetUserById(Core.ConstantsCore.Security.SuperUserId); if (admin == null) return false; try diff --git a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs index 61a659615f..4a8f2a0445 100644 --- a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs +++ b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs @@ -124,7 +124,7 @@ namespace Umbraco.Web.Mvc //match this area controllerPluginRoute.DataTokens.Add("area", area.AreaName); - controllerPluginRoute.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, umbracoTokenValue); //ensure the umbraco token is set + controllerPluginRoute.DataTokens.Add(Core.ConstantsCore.Web.UmbracoDataToken, umbracoTokenValue); //ensure the umbraco token is set return controllerPluginRoute; } diff --git a/src/Umbraco.Web/Mvc/ContentModelBinder.cs b/src/Umbraco.Web/Mvc/ContentModelBinder.cs index 052938807a..f27b9d21ab 100644 --- a/src/Umbraco.Web/Mvc/ContentModelBinder.cs +++ b/src/Umbraco.Web/Mvc/ContentModelBinder.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.Mvc public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { object model; - if (controllerContext.RouteData.DataTokens.TryGetValue(Core.Constants.Web.UmbracoDataToken, out model) == false) + if (controllerContext.RouteData.DataTokens.TryGetValue(Core.ConstantsCore.Web.UmbracoDataToken, out model) == false) return null; // this model binder deals with IContentModel and IPublishedContent by extracting the model from the route's diff --git a/src/Umbraco.Web/Mvc/ControllerContextExtensions.cs b/src/Umbraco.Web/Mvc/ControllerContextExtensions.cs index 393b6882c9..31960a406d 100644 --- a/src/Umbraco.Web/Mvc/ControllerContextExtensions.cs +++ b/src/Umbraco.Web/Mvc/ControllerContextExtensions.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.Mvc /// The Umbraco context. public static UmbracoContext GetUmbracoContext(this ControllerContext controllerContext) { - var o = controllerContext.GetDataTokenInViewContextHierarchy(Core.Constants.Web.UmbracoContextDataToken); + var o = controllerContext.GetDataTokenInViewContextHierarchy(Core.ConstantsCore.Web.UmbracoContextDataToken); return o != null ? o as UmbracoContext : Current.UmbracoContext; } diff --git a/src/Umbraco.Web/Mvc/RenderMvcController.cs b/src/Umbraco.Web/Mvc/RenderMvcController.cs index 64c9ad52c4..5e0f81a672 100644 --- a/src/Umbraco.Web/Mvc/RenderMvcController.cs +++ b/src/Umbraco.Web/Mvc/RenderMvcController.cs @@ -50,11 +50,11 @@ namespace Umbraco.Web.Mvc { if (_publishedRequest != null) return _publishedRequest; - if (RouteData.DataTokens.ContainsKey(Core.Constants.Web.PublishedDocumentRequestDataToken) == false) + if (RouteData.DataTokens.ContainsKey(Core.ConstantsCore.Web.PublishedDocumentRequestDataToken) == false) { throw new InvalidOperationException("DataTokens must contain an 'umbraco-doc-request' key with a PublishedRequest object"); } - _publishedRequest = (PublishedRequest)RouteData.DataTokens[Core.Constants.Web.PublishedDocumentRequestDataToken]; + _publishedRequest = (PublishedRequest)RouteData.DataTokens[Core.ConstantsCore.Web.PublishedDocumentRequestDataToken]; return _publishedRequest; } } diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index c30f83170b..3b766fe923 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -86,9 +86,9 @@ namespace Umbraco.Web.Mvc internal void SetupRouteDataForRequest(ContentModel contentModel, RequestContext requestContext, PublishedRequest frequest) { //put essential data into the data tokens, the 'umbraco' key is required to be there for the view engine - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, contentModel); //required for the ContentModelBinder and view engine - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.PublishedDocumentRequestDataToken, frequest); //required for RenderMvcController - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, UmbracoContext); //required for UmbracoViewPage + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoDataToken, contentModel); //required for the ContentModelBinder and view engine + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.PublishedDocumentRequestDataToken, frequest); //required for RenderMvcController + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, UmbracoContext); //required for UmbracoViewPage } private void UpdateRouteDataForRequest(ContentModel contentModel, RequestContext requestContext) @@ -96,7 +96,7 @@ namespace Umbraco.Web.Mvc if (contentModel == null) throw new ArgumentNullException(nameof(contentModel)); if (requestContext == null) throw new ArgumentNullException(nameof(requestContext)); - requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoDataToken] = contentModel; + requestContext.RouteData.DataTokens[Core.ConstantsCore.Web.UmbracoDataToken] = contentModel; // the rest should not change -- it's only the published content that has changed } @@ -155,7 +155,7 @@ namespace Umbraco.Web.Mvc }; } - + /// /// Handles a posted form to an Umbraco Url and ensures the correct controller is routed to and that @@ -298,7 +298,7 @@ namespace Umbraco.Web.Mvc } //store the route definition - requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken] = def; + requestContext.RouteData.DataTokens[Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken] = def; return def; } diff --git a/src/Umbraco.Web/Mvc/RenderViewEngine.cs b/src/Umbraco.Web/Mvc/RenderViewEngine.cs index f8a636c87b..ce6b95d2ea 100644 --- a/src/Umbraco.Web/Mvc/RenderViewEngine.cs +++ b/src/Umbraco.Web/Mvc/RenderViewEngine.cs @@ -86,7 +86,7 @@ namespace Umbraco.Web.Mvc /// private static bool ShouldFindView(ControllerContext controllerContext, bool isPartial) { - var umbracoToken = controllerContext.GetDataTokenInViewContextHierarchy(Core.Constants.Web.UmbracoDataToken); + var umbracoToken = controllerContext.GetDataTokenInViewContextHierarchy(Core.ConstantsCore.Web.UmbracoDataToken); // first check if we're rendering a partial view for the back office, or surface controller, etc... // anything that is not ContentModel as this should only pertain to Umbraco views. diff --git a/src/Umbraco.Web/Mvc/SurfaceController.cs b/src/Umbraco.Web/Mvc/SurfaceController.cs index 4fc53de4ae..d32dea150c 100644 --- a/src/Umbraco.Web/Mvc/SurfaceController.cs +++ b/src/Umbraco.Web/Mvc/SurfaceController.cs @@ -170,8 +170,8 @@ namespace Umbraco.Web.Mvc while (currentContext != null) { var currentRouteData = currentContext.RouteData; - if (currentRouteData.DataTokens.ContainsKey(Core.Constants.Web.UmbracoRouteDefinitionDataToken)) - return Attempt.Succeed((RouteDefinition)currentRouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken]); + if (currentRouteData.DataTokens.ContainsKey(Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken)) + return Attempt.Succeed((RouteDefinition)currentRouteData.DataTokens[Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken]); currentContext = currentContext.IsChildAction ? currentContext.ParentActionViewContext diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index 75804b47bb..19d9b82470 100644 --- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Mvc ValidateRouteData(context.RouteData); - var routeDef = (RouteDefinition)context.RouteData.DataTokens[Umbraco.Core.Constants.Web.UmbracoRouteDefinitionDataToken]; + var routeDef = (RouteDefinition)context.RouteData.DataTokens[Umbraco.Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken]; var factory = ControllerBuilder.Current.GetControllerFactory(); context.RouteData.Values["action"] = routeDef.ActionName; @@ -71,7 +71,7 @@ namespace Umbraco.Web.Mvc /// private static void ValidateRouteData(RouteData routeData) { - if (routeData.DataTokens.ContainsKey(Umbraco.Core.Constants.Web.UmbracoRouteDefinitionDataToken) == false) + if (routeData.DataTokens.ContainsKey(Umbraco.Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken) == false) { throw new InvalidOperationException("Can only use " + typeof(UmbracoPageResult).Name + " in the context of an Http POST when using a SurfaceController form"); diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs index 5ac4037fdb..f73658bab9 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Mvc { get { - const string token = Core.Constants.Web.PublishedDocumentRequestDataToken; + const string token = Core.ConstantsCore.Web.PublishedDocumentRequestDataToken; // we should always try to return the object from the data tokens just in case its a custom object and not // the one from UmbracoContext. Fallback to UmbracoContext if necessary. @@ -94,7 +94,7 @@ namespace Umbraco.Web.Mvc if (content != null) _helper.AssignedContentItem = content; - + return _helper; } } diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs index 6f5dcab45f..31c7a6f155 100644 --- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs @@ -61,12 +61,12 @@ namespace Umbraco.Web.Mvc var renderModel = new ContentModel(umbracoContext.PublishedRequest.PublishedContent); // assigns the required tokens to the request - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, renderModel); - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.PublishedDocumentRequestDataToken, umbracoContext.PublishedRequest); - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbracoContext); + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoDataToken, renderModel); + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.PublishedDocumentRequestDataToken, umbracoContext.PublishedRequest); + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbracoContext); // this is used just for a flag that this is an umbraco custom route - requestContext.RouteData.DataTokens.Add(Core.Constants.Web.CustomRouteDataToken, true); + requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.CustomRouteDataToken, true); // Here we need to detect if a SurfaceController has posted var formInfo = RenderRouteHandler.GetFormInfo(requestContext); @@ -80,7 +80,7 @@ namespace Umbraco.Web.Mvc }; // set the special data token to the current route definition - requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken] = def; + requestContext.RouteData.DataTokens[Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken] = def; return RenderRouteHandler.HandlePostedValues(requestContext, formInfo); } diff --git a/src/Umbraco.Web/Profiling/WebProfilingController.cs b/src/Umbraco.Web/Profiling/WebProfilingController.cs index b3d580bc38..2db8de1e21 100644 --- a/src/Umbraco.Web/Profiling/WebProfilingController.cs +++ b/src/Umbraco.Web/Profiling/WebProfilingController.cs @@ -6,7 +6,7 @@ namespace Umbraco.Web.Profiling /// /// The API controller used to display the state of the web profiler /// - [UmbracoApplicationAuthorize(Core.Constants.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.ConstantsCore.Applications.Settings)] public class WebProfilingController : UmbracoAuthorizedJsonController { public object GetStatus() diff --git a/src/Umbraco.Web/PropertyEditors/ContentPickerConfiguration.cs b/src/Umbraco.Web/PropertyEditors/ContentPickerConfiguration.cs index 021d416781..320e37e1ed 100644 --- a/src/Umbraco.Web/PropertyEditors/ContentPickerConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/ContentPickerConfiguration.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("startNodeId", "Start node", "treepicker")] // + config in configuration editor ctor public Udi StartNodeId { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs index 7c9a549aef..e52209489a 100644 --- a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("rte", "Rich text editor", "views/propertyeditors/rte/rte.prevalues.html", Description = "Rich text editor configuration")] public JObject Rte { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs index 24e2fc29a5..39b60f61e3 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs @@ -89,7 +89,7 @@ namespace Umbraco.Web.PropertyEditors var grid = DeserializeGridValue(rawJson, out var rtes); - var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? Constants.Security.SuperUserId; + var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? ConstantsCore.Security.SuperUserId; // Process the rte values foreach (var rte in rtes) diff --git a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs index 53f9cb94ef..e030fcb631 100644 --- a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.PropertyEditors "listview", HideLabel = true, Group = Constants.PropertyEditors.Groups.Lists, - Icon = Constants.Icons.ListView)] + Icon = ConstantsCore.Icons.ListView)] public class ListViewPropertyEditor : DataEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs index b8b9476184..e7a2450141 100644 --- a/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("startNodeId", "Start node", "mediapicker")] public Udi StartNodeId { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs index dd755ee0ba..8633b6dd22 100644 --- a/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.PropertyEditors "mediapicker", ValueType = ValueTypes.Text, Group = Constants.PropertyEditors.Groups.Media, - Icon = Constants.Icons.MediaImage)] + Icon = ConstantsCore.Icons.MediaImage)] public class MediaPickerPropertyEditor : DataEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs index b8e67c863c..ebf29afa40 100644 --- a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.PropertyEditors "membergrouppicker", ValueType = ValueTypes.Text, Group = Constants.PropertyEditors.Groups.People, - Icon = Constants.Icons.MemberGroup)] + Icon = ConstantsCore.Icons.MemberGroup)] public class MemberGroupPickerPropertyEditor : DataEditor { public MemberGroupPickerPropertyEditor(ILogger logger) diff --git a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs index 69020ba350..793d12f93e 100644 --- a/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MemberPickerPropertyEditor.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.PropertyEditors "memberpicker", ValueType = ValueTypes.String, Group = Constants.PropertyEditors.Groups.People, - Icon = Constants.Icons.Member)] + Icon = ConstantsCore.Icons.Member)] public class MemberPickerPropertyEditor : DataEditor { public MemberPickerPropertyEditor(ILogger logger) diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfiguration.cs b/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfiguration.cs index 81a96b5ad7..80ea55842f 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfiguration.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("showOpenButton", "Show open button", "boolean", Description = "Opens the node in a dialog")] public bool ShowOpen { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs index 16aff6e0bf..498cec3490 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs @@ -11,11 +11,11 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("maxNumber", "Maximum number of items", "number")] public int MaxNumber { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } - + } } diff --git a/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs b/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs index c6d4e3ce70..aa8b5c9f7b 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("hideLabel", "Hide Label", "boolean")] public bool HideLabel { get; set; } - [ConfigurationField(Core.Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, "Ignore User Start Nodes", "boolean", Description = "Selecting this option allows a user to choose nodes that they normally don't have access to.")] public bool IgnoreUserStartNodes { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index 5743e9c1d5..475fd0de8f 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -114,7 +114,7 @@ namespace Umbraco.Web.PropertyEditors if (editorValue.Value == null) return null; - var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? Constants.Security.SuperUserId; + var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? ConstantsCore.Security.SuperUserId; var config = editorValue.DataTypeConfiguration as RichTextConfiguration; var mediaParent = config?.MediaParentId; diff --git a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs index daf574719a..06ca4d652f 100644 --- a/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/UserPickerPropertyEditor.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.PropertyEditors "entitypicker", ValueType = ValueTypes.Integer, Group = Constants.PropertyEditors.Groups.People, - Icon = Constants.Icons.User)] + Icon = ConstantsCore.Icons.User)] public class UserPickerPropertyEditor : DataEditor { public UserPickerPropertyEditor(ILogger logger) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs index 1edb20633f..9ad2effe17 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public ContentNodeKit GetContentSource(IScope scope, int id) { var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && x.NodeId == id && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Document && x.NodeId == id && !x.Trashed) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); var dto = scope.Database.Fetch(sql).FirstOrDefault(); @@ -76,7 +76,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetAllContentSources(IScope scope) { var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Document && !x.Trashed) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); return scope.Database.Query(sql).Select(CreateContentNodeKit); @@ -89,7 +89,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource .InnerJoin("x").On((left, right) => left.NodeId == right.NodeId || SqlText(left.Path, right.Path, (lp, rp) => $"({lp} LIKE {syntax.GetConcat(rp, "',%'")})"), aliasRight: "x")) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Document && !x.Trashed) .Where(x => x.NodeId == id, "x") .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); @@ -101,7 +101,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource if (!ids.Any()) return Enumerable.Empty(); var sql = ContentSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Document && !x.Trashed) .WhereIn(x => x.ContentTypeId, ids) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); @@ -139,7 +139,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public ContentNodeKit GetMediaSource(IScope scope, int id) { var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && x.NodeId == id && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Media && x.NodeId == id && !x.Trashed) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); var dto = scope.Database.Fetch(sql).FirstOrDefault(); @@ -149,7 +149,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public IEnumerable GetAllMediaSources(IScope scope) { var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Media && !x.Trashed) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); return scope.Database.Query(sql).Select(CreateMediaNodeKit); @@ -162,7 +162,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource .InnerJoin("x").On((left, right) => left.NodeId == right.NodeId || SqlText(left.Path, right.Path, (lp, rp) => $"({lp} LIKE {syntax.GetConcat(rp, "',%'")})"), aliasRight: "x")) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Media && !x.Trashed) .Where(x => x.NodeId == id, "x") .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); @@ -174,7 +174,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource if (!ids.Any()) return Enumerable.Empty(); var sql = MediaSourcesSelect(scope) - .Where(x => x.NodeObjectType == Constants.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == ConstantsCore.ObjectTypes.Media && !x.Trashed) .WhereIn(x => x.ContentTypeId, ids) .OrderBy(x => x.Level, x => x.ParentId, x => x.SortOrder); diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 80662f5db0..7a9fde8b5a 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -142,7 +142,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _domainStore = new SnapDictionary(); - LoadCachesOnStartup(); + LoadCachesOnStartup(); } Guid GetUid(ContentStore store, int id) => store.LiveSnapshot.Get(id)?.Uid ?? default; @@ -163,7 +163,7 @@ namespace Umbraco.Web.PublishedCache.NuCache /// to not run if MainDom wasn't acquired. /// If MainDom was not acquired, then _localContentDb and _localMediaDb will remain null which means this appdomain /// will load in published content via the DB and in that case this appdomain will probably not exist long enough to - /// serve more than a page of content. + /// serve more than a page of content. /// private void MainDomRegister() { @@ -972,7 +972,7 @@ namespace Umbraco.Web.PublishedCache.NuCache } } - //Methods used to prevent allocations of lists + //Methods used to prevent allocations of lists private void AddToList(ref List list, int val) => GetOrCreateList(ref list).Add(val); private List GetOrCreateList(ref List list) => list ?? (list = new List()); @@ -1456,7 +1456,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private void RebuildContentDbCacheLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var contentObjectType = Constants.ObjectTypes.Document; + var contentObjectType = ConstantsCore.ObjectTypes.Document; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1528,7 +1528,7 @@ WHERE cmsContentNu.nodeId IN ( public void RebuildMediaDbCacheLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var mediaObjectType = Constants.ObjectTypes.Media; + var mediaObjectType = ConstantsCore.ObjectTypes.Media; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1587,7 +1587,7 @@ WHERE cmsContentNu.nodeId IN ( public void RebuildMemberDbCacheLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var memberObjectType = Constants.ObjectTypes.Member; + var memberObjectType = ConstantsCore.ObjectTypes.Member; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1648,7 +1648,7 @@ WHERE cmsContentNu.nodeId IN ( // every document should have a corresponding row for edited properties // and if published, may have a corresponding row for published properties - var contentObjectType = Constants.ObjectTypes.Document; + var contentObjectType = ConstantsCore.ObjectTypes.Document; var db = scope.Database; var count = db.ExecuteScalar($@"SELECT COUNT(*) @@ -1679,7 +1679,7 @@ AND nuEdited.nodeId IS NULL OR ({Constants.DatabaseSchema.Tables.Document}.publi { // every media item should have a corresponding row for edited properties - var mediaObjectType = Constants.ObjectTypes.Media; + var mediaObjectType = ConstantsCore.ObjectTypes.Media; var db = scope.Database; var count = db.ExecuteScalar(@"SELECT COUNT(*) @@ -1708,7 +1708,7 @@ AND cmsContentNu.nodeId IS NULL { // every member item should have a corresponding row for edited properties - var memberObjectType = Constants.ObjectTypes.Member; + var memberObjectType = ConstantsCore.ObjectTypes.Member; var db = scope.Database; var count = db.ExecuteScalar(@"SELECT COUNT(*) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 75eb6adbcb..745e167c51 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -196,7 +196,7 @@ namespace Umbraco.Web { // TODO: inject examine manager - indexName = string.IsNullOrEmpty(indexName) ? Constants.UmbracoIndexes.ExternalIndexName : indexName; + indexName = string.IsNullOrEmpty(indexName) ? ConstantsCore.UmbracoIndexes.ExternalIndexName : indexName; if (!ExamineManager.Instance.TryGetIndex(indexName, out var index)) throw new InvalidOperationException("No index found with name " + indexName); @@ -217,7 +217,7 @@ namespace Umbraco.Web { // TODO: inject examine manager - indexName = string.IsNullOrEmpty(indexName) ? Constants.UmbracoIndexes.ExternalIndexName : indexName; + indexName = string.IsNullOrEmpty(indexName) ? ConstantsCore.UmbracoIndexes.ExternalIndexName : indexName; if (!ExamineManager.Instance.TryGetIndex(indexName, out var index)) throw new InvalidOperationException("No index found with name " + indexName); diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Web/PublishedContentQuery.cs index 2dbe4de4c5..10b989d030 100644 --- a/src/Umbraco.Web/PublishedContentQuery.cs +++ b/src/Umbraco.Web/PublishedContentQuery.cs @@ -192,7 +192,7 @@ namespace Umbraco.Web public IEnumerable Search(string term, int skip, int take, out long totalRecords, string culture = "*", string indexName = null) { indexName = string.IsNullOrEmpty(indexName) - ? Constants.UmbracoIndexes.ExternalIndexName + ? ConstantsCore.UmbracoIndexes.ExternalIndexName : indexName; if (!_examineManager.TryGetIndex(indexName, out var index) || !(index is IUmbracoIndex umbIndex)) diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs index ac813d7196..877549be7e 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComponent.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComponent.cs @@ -213,7 +213,7 @@ namespace Umbraco.Web.Runtime new[] { meta.ControllerNamespace }); if (route.DataTokens == null) // web api routes don't set the data tokens object route.DataTokens = new RouteValueDictionary(); - route.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, "api"); //ensure the umbraco token is set + route.DataTokens.Add(Core.ConstantsCore.Web.UmbracoDataToken, "api"); //ensure the umbraco token is set } private static void RouteLocalSurfaceController(Type controller, string umbracoPath) @@ -225,7 +225,7 @@ namespace Umbraco.Web.Runtime url, // url to match new { controller = meta.ControllerName, action = "Index", id = UrlParameter.Optional }, new[] { meta.ControllerNamespace }); // look in this namespace to create the controller - route.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, "surface"); // ensure the umbraco token is set + route.DataTokens.Add(Core.ConstantsCore.Web.UmbracoDataToken, "surface"); // ensure the umbraco token is set route.DataTokens.Add("UseNamespaceFallback", false); // don't look anywhere else except this namespace! // make it use our custom/special SurfaceMvcHandler route.RouteHandler = new SurfaceRouteHandler(); diff --git a/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs b/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs index ec536b9d75..c2422f60ab 100644 --- a/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs +++ b/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs @@ -52,8 +52,8 @@ namespace Umbraco.Web.Search private IIndex CreateInternalIndex() { var index = new UmbracoContentIndex( - Constants.UmbracoIndexes.InternalIndexName, - CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.InternalIndexPath), + ConstantsCore.UmbracoIndexes.InternalIndexName, + CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.InternalIndexPath), new UmbracoFieldDefinitionCollection(), new CultureInvariantWhitespaceAnalyzer(), ProfilingLogger, @@ -66,8 +66,8 @@ namespace Umbraco.Web.Search private IIndex CreateExternalIndex() { var index = new UmbracoContentIndex( - Constants.UmbracoIndexes.ExternalIndexName, - CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.ExternalIndexPath), + ConstantsCore.UmbracoIndexes.ExternalIndexName, + CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.ExternalIndexPath), new UmbracoFieldDefinitionCollection(), new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30), ProfilingLogger, @@ -79,9 +79,9 @@ namespace Umbraco.Web.Search private IIndex CreateMemberIndex() { var index = new UmbracoMemberIndex( - Constants.UmbracoIndexes.MembersIndexName, + ConstantsCore.UmbracoIndexes.MembersIndexName, new UmbracoFieldDefinitionCollection(), - CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.MembersIndexPath), + CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.MembersIndexPath), new CultureInvariantWhitespaceAnalyzer(), ProfilingLogger, GetMemberValueSetValidator() diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs index b351cca972..65a46d10e5 100644 --- a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs +++ b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.Search var sb = new StringBuilder(); string type; - var indexName = Constants.UmbracoIndexes.InternalIndexName; + var indexName = ConstantsCore.UmbracoIndexes.InternalIndexName; var fields = new[] { "id", "__NodeId", "__Key" }; // TODO: WE should try to allow passing in a lucene raw query, however we will still need to do some manual string @@ -85,7 +85,7 @@ namespace Umbraco.Web.Search switch (entityType) { case UmbracoEntityTypes.Member: - indexName = Constants.UmbracoIndexes.MembersIndexName; + indexName = ConstantsCore.UmbracoIndexes.MembersIndexName; type = "member"; fields = new[] { "id", "__NodeId", "__Key", "email", "loginName" }; if (searchFrom != null && searchFrom != Constants.Conventions.MemberTypes.AllMembersListId && searchFrom.Trim() != "-1") @@ -389,9 +389,9 @@ namespace Umbraco.Web.Search var m = _mapper.Map(result); //if no icon could be mapped, it will be set to document, so change it to picture - if (m.Icon == Constants.Icons.DefaultIcon) + if (m.Icon == ConstantsCore.Icons.DefaultIcon) { - m.Icon = Constants.Icons.Member; + m.Icon = ConstantsCore.Icons.Member; } if (result.Values.ContainsKey("email") && result.Values["email"] != null) diff --git a/src/Umbraco.Web/Sections/ContentSection.cs b/src/Umbraco.Web/Sections/ContentSection.cs index a93c3040f8..b786d5dc48 100644 --- a/src/Umbraco.Web/Sections/ContentSection.cs +++ b/src/Umbraco.Web/Sections/ContentSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class ContentSection : ISection { /// - public string Alias => Constants.Applications.Content; + public string Alias => ConstantsCore.Applications.Content; /// public string Name => "Content"; diff --git a/src/Umbraco.Web/Sections/FormsSection.cs b/src/Umbraco.Web/Sections/FormsSection.cs index 98ca2d1eb5..2c0d59bf19 100644 --- a/src/Umbraco.Web/Sections/FormsSection.cs +++ b/src/Umbraco.Web/Sections/FormsSection.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Sections /// public class FormsSection : ISection { - public string Alias => Constants.Applications.Forms; + public string Alias => ConstantsCore.Applications.Forms; public string Name => "Forms"; } } diff --git a/src/Umbraco.Web/Sections/MediaSection.cs b/src/Umbraco.Web/Sections/MediaSection.cs index 3d6b16125a..79c6fec43b 100644 --- a/src/Umbraco.Web/Sections/MediaSection.cs +++ b/src/Umbraco.Web/Sections/MediaSection.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Sections /// public class MediaSection : ISection { - public string Alias => Constants.Applications.Media; + public string Alias => ConstantsCore.Applications.Media; public string Name => "Media"; } } diff --git a/src/Umbraco.Web/Sections/MembersSection.cs b/src/Umbraco.Web/Sections/MembersSection.cs index 1f82d31131..fdf4f83562 100644 --- a/src/Umbraco.Web/Sections/MembersSection.cs +++ b/src/Umbraco.Web/Sections/MembersSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class MembersSection : ISection { /// - public string Alias => Constants.Applications.Members; + public string Alias => ConstantsCore.Applications.Members; /// public string Name => "Members"; diff --git a/src/Umbraco.Web/Sections/PackagesSection.cs b/src/Umbraco.Web/Sections/PackagesSection.cs index 265b440195..879b243add 100644 --- a/src/Umbraco.Web/Sections/PackagesSection.cs +++ b/src/Umbraco.Web/Sections/PackagesSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class PackagesSection : ISection { /// - public string Alias => Constants.Applications.Packages; + public string Alias => ConstantsCore.Applications.Packages; /// public string Name => "Packages"; diff --git a/src/Umbraco.Web/Sections/SettingsSection.cs b/src/Umbraco.Web/Sections/SettingsSection.cs index 4185cd123a..1a246a5d1d 100644 --- a/src/Umbraco.Web/Sections/SettingsSection.cs +++ b/src/Umbraco.Web/Sections/SettingsSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class SettingsSection : ISection { /// - public string Alias => Constants.Applications.Settings; + public string Alias => ConstantsCore.Applications.Settings; /// public string Name => "Settings"; diff --git a/src/Umbraco.Web/Sections/TranslationSection.cs b/src/Umbraco.Web/Sections/TranslationSection.cs index b23dbde93b..4cbc366b4a 100644 --- a/src/Umbraco.Web/Sections/TranslationSection.cs +++ b/src/Umbraco.Web/Sections/TranslationSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class TranslationSection : ISection { /// - public string Alias => Constants.Applications.Translation; + public string Alias => ConstantsCore.Applications.Translation; /// public string Name => "Translation"; diff --git a/src/Umbraco.Web/Sections/UsersSection.cs b/src/Umbraco.Web/Sections/UsersSection.cs index ac4255ac96..01842d0d1d 100644 --- a/src/Umbraco.Web/Sections/UsersSection.cs +++ b/src/Umbraco.Web/Sections/UsersSection.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Sections public class UsersSection : ISection { /// - public string Alias => Constants.Applications.Users; + public string Alias => ConstantsCore.Applications.Users; /// public string Name => "Users"; diff --git a/src/Umbraco.Web/Security/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/AppBuilderExtensions.cs index 0a3e57c4fd..e9dd3b4590 100644 --- a/src/Umbraco.Web/Security/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/AppBuilderExtensions.cs @@ -310,9 +310,9 @@ namespace Umbraco.Web.Security app.UseCookieAuthentication(new CookieAuthenticationOptions { - AuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType, + AuthenticationType = ConstantsCore.Security.BackOfficeExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, - CookieName = Constants.Security.BackOfficeExternalCookieName, + CookieName = ConstantsCore.Security.BackOfficeExternalCookieName, ExpireTimeSpan = TimeSpan.FromMinutes(5), //Custom cookie manager so we can filter requests CookieManager = new BackOfficeCookieManager(umbracoContextAccessor, runtimeState, globalSettings), @@ -400,7 +400,7 @@ namespace Umbraco.Web.Security //this is how aspnet wires up the default AuthenticationTicket protector so we'll use the same code var ticketDataFormat = new TicketDataFormat( app.CreateDataProtector(typeof (CookieAuthenticationMiddleware).FullName, - Constants.Security.BackOfficeAuthenticationType, + ConstantsCore.Security.BackOfficeAuthenticationType, "v1")); var authOptions = new UmbracoBackOfficeCookieAuthOptions( diff --git a/src/Umbraco.Web/Security/AuthenticationExtensions.cs b/src/Umbraco.Web/Security/AuthenticationExtensions.cs index 1fa75a214b..68244e9205 100644 --- a/src/Umbraco.Web/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Web/Security/AuthenticationExtensions.cs @@ -166,7 +166,7 @@ namespace Umbraco.Web.Security public static bool RenewUmbracoAuthTicket(this HttpContextBase http) { if (http == null) throw new ArgumentNullException("http"); - http.Items[Constants.Security.ForceReAuthFlag] = true; + http.Items[ConstantsCore.Security.ForceReAuthFlag] = true; return true; } @@ -178,7 +178,7 @@ namespace Umbraco.Web.Security internal static bool RenewUmbracoAuthTicket(this HttpContext http) { if (http == null) throw new ArgumentNullException("http"); - http.Items[Constants.Security.ForceReAuthFlag] = true; + http.Items[ConstantsCore.Security.ForceReAuthFlag] = true; return true; } @@ -244,7 +244,7 @@ namespace Umbraco.Web.Security var claimsIdentity = http.User.Identity as ClaimsIdentity; if (claimsIdentity != null) { - var sessionId = claimsIdentity.FindFirstValue(Constants.Security.SessionIdClaimType); + var sessionId = claimsIdentity.FindFirstValue(ConstantsCore.Security.SessionIdClaimType); Guid guidSession; if (sessionId.IsNullOrWhiteSpace() == false && Guid.TryParse(sessionId, out guidSession)) { @@ -255,7 +255,7 @@ namespace Umbraco.Web.Security if (http == null) throw new ArgumentNullException("http"); // clear the preview cookie and external login - var cookies = new[] { cookieName, Constants.Web.PreviewCookieName, Constants.Security.BackOfficeExternalCookieName }; + var cookies = new[] { cookieName, ConstantsCore.Web.PreviewCookieName, ConstantsCore.Security.BackOfficeExternalCookieName }; foreach (var c in cookies) { // remove from the request @@ -296,8 +296,8 @@ namespace Umbraco.Web.Security catch (Exception) { owinCtx.Authentication.SignOut( - Constants.Security.BackOfficeAuthenticationType, - Constants.Security.BackOfficeExternalAuthenticationType); + ConstantsCore.Security.BackOfficeAuthenticationType, + ConstantsCore.Security.BackOfficeExternalAuthenticationType); return null; } } diff --git a/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs b/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs index b1b2755f4c..08373fd6ce 100644 --- a/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs +++ b/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs @@ -78,9 +78,9 @@ namespace Umbraco.Web.Security if (string.IsNullOrEmpty(options.AuthenticationType)) throw new ArgumentNullOrEmptyException("options.AuthenticationType"); //Ensure the prefix is set - if (options.AuthenticationType.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix) == false) + if (options.AuthenticationType.StartsWith(ConstantsCore.Security.BackOfficeExternalAuthenticationTypePrefix) == false) { - options.AuthenticationType = Constants.Security.BackOfficeExternalAuthenticationTypePrefix + options.AuthenticationType; + options.AuthenticationType = ConstantsCore.Security.BackOfficeExternalAuthenticationTypePrefix + options.AuthenticationType; } options.Description.Properties["SocialStyle"] = style; diff --git a/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs b/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs index fbc24d2cd9..1eaf762030 100644 --- a/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs +++ b/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Identity; +using Umbraco.Core; using Umbraco.Core.Models.Identity; using Umbraco.Core.Security; using Constants = Umbraco.Core.Constants; @@ -14,7 +15,7 @@ namespace Umbraco.Web.Security { public BackOfficeClaimsIdentityFactory() { - SecurityStampClaimType = Constants.Security.SessionIdClaimType; + SecurityStampClaimType = ConstantsCore.Security.SessionIdClaimType; UserNameClaimType = ClaimTypes.Name; } @@ -26,7 +27,7 @@ namespace Umbraco.Web.Security public override async Task CreateAsync(UserManager manager, T user, string authenticationType) { var baseIdentity = await base.CreateAsync(manager, user, authenticationType); - + var umbracoIdentity = new UmbracoBackOfficeIdentity(baseIdentity, user.Id, user.UserName, diff --git a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs index e7aef4be03..2b55fb81f4 100644 --- a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs +++ b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Security if (context?.OwinContext?.Authentication?.User?.Identity != null) { var claimsIdentity = context.OwinContext.Authentication.User.Identity as ClaimsIdentity; - var sessionId = claimsIdentity.FindFirstValue(Core.Constants.Security.SessionIdClaimType); + var sessionId = claimsIdentity.FindFirstValue(Core.ConstantsCore.Security.SessionIdClaimType); if (sessionId.IsNullOrWhiteSpace() == false && Guid.TryParse(sessionId, out var guidSession)) { _userService.ClearLoginSession(guidSession); @@ -72,12 +72,12 @@ namespace Umbraco.Web.Security Expires = DateTime.Now.AddYears(-1), Path = "/" }); - context.Response.Cookies.Append(Core.Constants.Web.PreviewCookieName, "", new CookieOptions + context.Response.Cookies.Append(Core.ConstantsCore.Web.PreviewCookieName, "", new CookieOptions { Expires = DateTime.Now.AddYears(-1), Path = "/" }); - context.Response.Cookies.Append(Core.Constants.Security.BackOfficeExternalCookieName, "", new CookieOptions + context.Response.Cookies.Append(Core.ConstantsCore.Security.BackOfficeExternalCookieName, "", new CookieOptions { Expires = DateTime.Now.AddYears(-1), Path = "/" diff --git a/src/Umbraco.Web/Security/BackOfficeCookieManager.cs b/src/Umbraco.Web/Security/BackOfficeCookieManager.cs index 5da86204f3..6b3a66d9b4 100644 --- a/src/Umbraco.Web/Security/BackOfficeCookieManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeCookieManager.cs @@ -98,8 +98,8 @@ namespace Umbraco.Web.Security if (request.Uri.AbsolutePath.InvariantEquals(_getRemainingSecondsPath)) return false; if (//check the explicit flag - (checkForceAuthTokens && owinContext.Get(Constants.Security.ForceReAuthFlag) != null) - || (checkForceAuthTokens && httpContext.Success && httpContext.Result.Items[Constants.Security.ForceReAuthFlag] != null) + (checkForceAuthTokens && owinContext.Get(ConstantsCore.Security.ForceReAuthFlag) != null) + || (checkForceAuthTokens && httpContext.Success && httpContext.Result.Items[ConstantsCore.Security.ForceReAuthFlag] != null) //check back office || request.Uri.IsBackOfficeRequest(HttpRuntime.AppDomainAppVirtualPath, _globalSettings) //check installer diff --git a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs index b33487bc8d..e32155960e 100644 --- a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs @@ -7,6 +7,7 @@ using Microsoft.AspNet.Identity.Owin; using Microsoft.Owin; using Microsoft.Owin.Logging; using Microsoft.Owin.Security; +using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Models.Identity; using Umbraco.Core.Security; @@ -29,7 +30,7 @@ namespace Umbraco.Web.Security _logger = logger; _request = request; _globalSettings = globalSettings; - AuthenticationType = Constants.Security.BackOfficeAuthenticationType; + AuthenticationType = ConstantsCore.Security.BackOfficeAuthenticationType; } public override Task CreateUserIdentityAsync(BackOfficeIdentityUser user) @@ -159,7 +160,7 @@ namespace Umbraco.Web.Security if (await UserManager.GetTwoFactorEnabledAsync(user.Id) && (await UserManager.GetValidTwoFactorProvidersAsync(user.Id)).Count > 0) { - var identity = new ClaimsIdentity(Constants.Security.BackOfficeTwoFactorAuthenticationType); + var identity = new ClaimsIdentity(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, id)); identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, user.UserName)); AuthenticationManager.SignIn(identity); @@ -182,8 +183,8 @@ namespace Umbraco.Web.Security // Clear any partial cookies from external or two factor partial sign ins AuthenticationManager.SignOut( - Constants.Security.BackOfficeExternalAuthenticationType, - Constants.Security.BackOfficeTwoFactorAuthenticationType); + ConstantsCore.Security.BackOfficeExternalAuthenticationType, + ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); var nowUtc = DateTime.Now.ToUniversalTime(); @@ -235,7 +236,7 @@ namespace Umbraco.Web.Security /// public new async Task GetVerifiedUserIdAsync() { - var result = await AuthenticationManager.AuthenticateAsync(Constants.Security.BackOfficeTwoFactorAuthenticationType); + var result = await AuthenticationManager.AuthenticateAsync(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); if (result != null && result.Identity != null && string.IsNullOrEmpty(result.Identity.GetUserId()) == false) { return ConvertIdFromString(result.Identity.GetUserId()); @@ -249,7 +250,7 @@ namespace Umbraco.Web.Security /// public async Task GetVerifiedUserNameAsync() { - var result = await AuthenticationManager.AuthenticateAsync(Constants.Security.BackOfficeTwoFactorAuthenticationType); + var result = await AuthenticationManager.AuthenticateAsync(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); if (result != null && result.Identity != null && string.IsNullOrEmpty(result.Identity.GetUserName()) == false) { return result.Identity.GetUserName(); diff --git a/src/Umbraco.Web/Security/BackOfficeUserManager.cs b/src/Umbraco.Web/Security/BackOfficeUserManager.cs index 6205c1705c..2965a63440 100644 --- a/src/Umbraco.Web/Security/BackOfficeUserManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeUserManager.cs @@ -158,7 +158,7 @@ namespace Umbraco.Web.Security { // NOTE the authenticationType must match the umbraco one // defined in CookieAuthenticationOptions.AuthenticationType - var userIdentity = await CreateIdentityAsync(user, Core.Constants.Security.BackOfficeAuthenticationType); + var userIdentity = await CreateIdentityAsync(user, Core.ConstantsCore.Security.BackOfficeAuthenticationType); return userIdentity; } diff --git a/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs b/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs index 896a0ca63e..a88cfd19ef 100644 --- a/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs +++ b/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web.Security var httpCtx = Context.TryGetHttpContext(); //check for the special flag in either the owin or http context - var shouldRenew = Context.Get(Constants.Security.ForceReAuthFlag) != null || (httpCtx.Success && httpCtx.Result.Items[Constants.Security.ForceReAuthFlag] != null); + var shouldRenew = Context.Get(ConstantsCore.Security.ForceReAuthFlag) != null || (httpCtx.Success && httpCtx.Result.Items[ConstantsCore.Security.ForceReAuthFlag] != null); if (shouldRenew) { diff --git a/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs index f3aa5dd838..c148cdf5e5 100644 --- a/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs +++ b/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.Security.Providers private volatile bool _hasDefaultMember = false; private static readonly object Locker = new object(); - public override string ProviderName => Constants.Security.UserMembershipProviderName; + public override string ProviderName => ConstantsCore.Security.UserMembershipProviderName; protected override MembershipUser ConvertToMembershipUser(IUser entity) { diff --git a/src/Umbraco.Web/Security/SessionIdValidator.cs b/src/Umbraco.Web/Security/SessionIdValidator.cs index 58b6c6ad1c..fb9990326b 100644 --- a/src/Umbraco.Web/Security/SessionIdValidator.cs +++ b/src/Umbraco.Web/Security/SessionIdValidator.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Security /// Static helper class used to configure a CookieAuthenticationProvider to validate a cookie against a user's session id /// /// - /// This uses another cookie to track the last checked time which is done for a few reasons: + /// This uses another cookie to track the last checked time which is done for a few reasons: /// * We can't use the user's auth ticket to do this because we'd be re-issuing the auth ticket all of the time and it would never expire /// plus the auth ticket size is much larger than this small value /// * This will execute quite often (every minute per user) and in some cases there might be several requests that end up re-issuing the cookie so the cookie value should be small @@ -27,12 +27,12 @@ namespace Umbraco.Web.Security internal static class SessionIdValidator { public const string CookieName = "UMB_UCONTEXT_C"; - + public static async Task ValidateSessionAsync(TimeSpan validateInterval, CookieValidateIdentityContext context, IGlobalSettings globalSettings) { if (context.Request.Uri.IsBackOfficeRequest(HttpRuntime.AppDomainAppVirtualPath, globalSettings) == false) return; - + var valid = await ValidateSessionAsync(validateInterval, context.OwinContext, context.Options.CookieManager, context.Options.SystemClock, context.Properties.IssuedUtc, context.Identity, globalSettings); if (valid == false) @@ -65,7 +65,7 @@ namespace Umbraco.Web.Security { DateTimeOffset parsed; if (DateTimeOffset.TryParse(lastCheckedCookie, out parsed)) - { + { issuedUtc = parsed; } } @@ -87,7 +87,7 @@ namespace Umbraco.Web.Security if (validate == false) return true; - var manager = owinCtx.GetUserManager(); + var manager = owinCtx.GetUserManager(); if (manager == null) return false; @@ -96,7 +96,7 @@ namespace Umbraco.Web.Security if (user == null) return false; - var sessionId = currentIdentity.FindFirstValue(Constants.Security.SessionIdClaimType); + var sessionId = currentIdentity.FindFirstValue(ConstantsCore.Security.SessionIdClaimType); if (await manager.ValidateSessionIdAsync(userId, sessionId) == false) return false; @@ -114,6 +114,6 @@ namespace Umbraco.Web.Security return true; } - + } } diff --git a/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs b/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs index b15be9ec9a..d73b0bf77b 100644 --- a/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs +++ b/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.Security public sealed class UmbracoBackOfficeCookieAuthOptions : CookieAuthenticationOptions { public int LoginTimeoutMinutes { get; } - + public UmbracoBackOfficeCookieAuthOptions( string[] explicitPaths, IUmbracoContextAccessor umbracoContextAccessor, @@ -25,8 +25,8 @@ namespace Umbraco.Web.Security { var secureDataFormat1 = secureDataFormat ?? throw new ArgumentNullException(nameof(secureDataFormat)); LoginTimeoutMinutes = globalSettings.TimeOutInMinutes; - AuthenticationType = Constants.Security.BackOfficeAuthenticationType; - + AuthenticationType = ConstantsCore.Security.BackOfficeAuthenticationType; + SlidingExpiration = true; ExpireTimeSpan = TimeSpan.FromMinutes(LoginTimeoutMinutes); CookieDomain = securitySection.AuthCookieDomain; @@ -40,7 +40,7 @@ namespace Umbraco.Web.Security //Custom cookie manager so we can filter requests CookieManager = new BackOfficeCookieManager(umbracoContextAccessor, runtimeState, globalSettings, explicitPaths); } - + /// /// Creates the cookie options for saving the auth cookie /// diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 55ac421b92..1b47d85cb3 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -33,7 +33,7 @@ namespace Umbraco.Web.Security _userService = userService; _globalSettings = globalSettings; } - + private IUser _currentUser; /// @@ -86,17 +86,17 @@ namespace Umbraco.Web.Security { var owinCtx = _httpContext.GetOwinContext(); //ensure it's done for owin too - owinCtx.Authentication.SignOut(Constants.Security.BackOfficeExternalAuthenticationType); + owinCtx.Authentication.SignOut(ConstantsCore.Security.BackOfficeExternalAuthenticationType); var user = UserManager.FindByIdAsync(userId).Result; SignInManager.SignInAsync(user, isPersistent: true, rememberBrowser: false).Wait(); - + _httpContext.SetPrincipalForRequest(owinCtx.Request.User); - + return TimeSpan.FromMinutes(_globalSettings.TimeOutInMinutes).TotalSeconds; } - + /// /// Clears the current login for the currently logged in user /// @@ -104,8 +104,8 @@ namespace Umbraco.Web.Security { _httpContext.UmbracoLogout(); _httpContext.GetOwinContext().Authentication.SignOut( - Core.Constants.Security.BackOfficeAuthenticationType, - Core.Constants.Security.BackOfficeExternalAuthenticationType); + Core.ConstantsCore.Security.BackOfficeAuthenticationType, + Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); } /// @@ -131,7 +131,7 @@ namespace Umbraco.Web.Security var user = UserManager.FindByNameAsync(username).Result; return user != null && UserManager.CheckPasswordAsync(user, password).Result; } - + /// /// Validates the current user to see if they have access to the specified app /// @@ -166,7 +166,7 @@ namespace Umbraco.Web.Security var identity = _httpContext.GetCurrentIdentity(false); return identity?.SessionId; } - + /// /// Validates the currently logged in user and ensures they are not timed out /// @@ -263,6 +263,6 @@ namespace Umbraco.Web.Security { return _httpContext.User != null && _httpContext.User.Identity.IsAuthenticated && _httpContext.GetCurrentIdentity(false) != null; } - + } } diff --git a/src/Umbraco.Web/Services/DashboardService.cs b/src/Umbraco.Web/Services/DashboardService.cs index 794c6fa671..0e25325874 100644 --- a/src/Umbraco.Web/Services/DashboardService.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.Services internal class DashboardService : IDashboardService { // TODO: Unit test all this!!! :/ - + private readonly ISectionService _sectionService; private readonly DashboardCollection _dashboardCollection; private readonly ILocalizedTextService _localizedText; @@ -67,7 +67,7 @@ namespace Umbraco.Web.Services private bool CheckUserAccessByRules(IUser user, ISectionService sectionService, IEnumerable rules) { - if (user.Id == Constants.Security.SuperUserId) + if (user.Id == ConstantsCore.Security.SuperUserId) return true; var (denyRules, grantRules, grantBySectionRules) = GroupRules(rules); diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs index 58d3ed341e..f889e94acb 100644 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ b/src/Umbraco.Web/Templates/TemplateUtilities.cs @@ -214,7 +214,7 @@ namespace Umbraco.Web.Templates if (string.IsNullOrEmpty(tmpImgPath)) continue; - + var absoluteTempImagePath = IOHelper.MapPath(tmpImgPath); var fileName = Path.GetFileName(absoluteTempImagePath); var safeFileName = fileName.ToSafeFileName(); @@ -226,7 +226,7 @@ namespace Umbraco.Web.Templates if (uploadedImages.ContainsKey(tmpImgPath) == false) { if (mediaParentFolder == Guid.Empty) - mediaFile = mediaService.CreateMedia(mediaItemName, Constants.System.Root, Constants.Conventions.MediaTypes.Image, userId); + mediaFile = mediaService.CreateMedia(mediaItemName, ConstantsCore.System.Root, Constants.Conventions.MediaTypes.Image, userId); else mediaFile = mediaService.CreateMedia(mediaItemName, mediaParentFolder, Constants.Conventions.MediaTypes.Image, userId); @@ -247,7 +247,7 @@ namespace Umbraco.Web.Templates { // Already been uploaded & we have it's UDI udi = uploadedImages[tmpImgPath]; - } + } // Add the UDI to the img element as new data attribute img.SetAttributeValue("data-udi", udi.ToString()); @@ -264,7 +264,7 @@ namespace Umbraco.Web.Templates { location = $"{location}?width={width}&height={height}&mode=max"; } - + img.SetAttributeValue("src", location); // Remove the data attribute (so we do not re-process this) diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index f0a860496e..b3d3c670a8 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -71,7 +71,7 @@ namespace Umbraco.Web.Trees //if there are no trees defined for this section but the section is defined then we can have a simple //full screen section without trees var name = Services.TextService.Localize("sections/" + application); - return TreeRootNode.CreateSingleTreeRoot(Constants.System.RootString, null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(ConstantsCore.System.RootString, null, null, name, TreeNodeCollection.Empty, true); } // handle request for a specific tree / or when there is only one tree @@ -84,7 +84,7 @@ namespace Umbraco.Web.Trees if (t == null) throw new HttpResponseException(HttpStatusCode.NotFound); - var treeRootNode = await GetTreeRootNode(t, Constants.System.Root, queryStrings); + var treeRootNode = await GetTreeRootNode(t, ConstantsCore.System.Root, queryStrings); if (treeRootNode != null) return treeRootNode; @@ -114,7 +114,7 @@ namespace Umbraco.Web.Trees // otherwise it's a section with all empty trees, aka a fullscreen section // todo is this true? what if we just failed to TryGetRootNode on all of them? SD: Yes it's true but we should check the result of TryGetRootNode and throw? - return TreeRootNode.CreateSingleTreeRoot(Constants.System.RootString, null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(ConstantsCore.System.RootString, null, null, name, TreeNodeCollection.Empty, true); } // for many groups @@ -180,7 +180,7 @@ namespace Umbraco.Web.Trees var rootNode = await GetRootNode(tree, querystring); var sectionRoot = TreeRootNode.CreateSingleTreeRoot( - Constants.System.RootString, + ConstantsCore.System.RootString, rootNode.ChildNodesUrl, rootNode.MenuUrl, rootNode.Name, diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index ac75fd831d..413d0ed5d1 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -17,8 +17,8 @@ namespace Umbraco.Web.Trees /// /// This authorizes based on access to the content section even though it exists in the settings /// - [UmbracoApplicationAuthorize(Constants.Applications.Content)] - [Tree(Constants.Applications.Settings, Constants.Trees.ContentBlueprints, SortOrder = 12, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoApplicationAuthorize(ConstantsCore.Applications.Content)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.ContentBlueprints, SortOrder = 12, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class ContentBlueprintTreeController : TreeController @@ -29,7 +29,7 @@ namespace Umbraco.Web.Trees var root = base.CreateRootNode(queryStrings); //this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = $"{Constants.Applications.Settings}/{Constants.Trees.ContentBlueprints}/intro"; + root.RoutePath = $"{ConstantsCore.Applications.Settings}/{ConstantsCore.Trees.ContentBlueprints}/intro"; //check if there are any content blueprints root.HasChildren = Services.ContentService.GetBlueprintsForContentTypes().Any(); @@ -41,10 +41,10 @@ namespace Umbraco.Web.Trees var nodes = new TreeNodeCollection(); //get all blueprints - var entities = Services.EntityService.GetChildren(Constants.System.Root, UmbracoObjectTypes.DocumentBlueprint).ToArray(); + var entities = Services.EntityService.GetChildren(ConstantsCore.System.Root, UmbracoObjectTypes.DocumentBlueprint).ToArray(); //check if we're rendering the root in which case we'll render the content types that have blueprints - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //get all blueprint content types var contentTypeAliases = entities.Select(x => ((ContentEntitySlim) x).ContentTypeAlias).Distinct(); @@ -59,7 +59,7 @@ namespace Umbraco.Web.Trees nodes.AddRange(docTypeEntities .Select(entity => { - var treeNode = CreateTreeNode(entity, Constants.ObjectTypes.DocumentBlueprint, id, queryStrings, Constants.Icons.ContentType, true); + var treeNode = CreateTreeNode(entity, ConstantsCore.ObjectTypes.DocumentBlueprint, id, queryStrings, ConstantsCore.Icons.ContentType, true); treeNode.Path = $"-1,{entity.Id}"; treeNode.NodeType = "document-type-blueprints"; // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. @@ -79,7 +79,7 @@ namespace Umbraco.Web.Trees nodes.AddRange(blueprintsForDocType .Select(entity => { - var treeNode = CreateTreeNode(entity, Constants.ObjectTypes.DocumentBlueprint, id, queryStrings, "icon-blueprint", false); + var treeNode = CreateTreeNode(entity, ConstantsCore.ObjectTypes.DocumentBlueprint, id, queryStrings, "icon-blueprint", false); treeNode.Path = $"-1,{ct.Id},{entity.Id}"; return treeNode; })); @@ -91,7 +91,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { // root actions menu.Items.Add(Services.TextService, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index 3373a6fa8b..223cda53ad 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -25,13 +25,13 @@ namespace Umbraco.Web.Trees //We will not allow the tree to render unless the user has access to any of the sections that the tree gets rendered // this is not ideal but until we change permissions to be tree based (not section) there's not much else we can do here. [UmbracoApplicationAuthorize( - Constants.Applications.Content, - Constants.Applications.Media, - Constants.Applications.Users, - Constants.Applications.Settings, - Constants.Applications.Packages, - Constants.Applications.Members)] - [Tree(Constants.Applications.Content, Constants.Trees.Content)] + ConstantsCore.Applications.Content, + ConstantsCore.Applications.Media, + ConstantsCore.Applications.Users, + ConstantsCore.Applications.Settings, + ConstantsCore.Applications.Packages, + ConstantsCore.Applications.Members)] + [Tree(ConstantsCore.Applications.Content, ConstantsCore.Trees.Content)] [PluginController("UmbracoTrees")] [CoreTree] [SearchableTree("searchResultFormatter", "configureContentResult", 10)] @@ -40,7 +40,7 @@ namespace Umbraco.Web.Trees private readonly UmbracoTreeSearcher _treeSearcher; private readonly ActionCollection _actions; - protected override int RecycleBinId => Constants.System.RecycleBinContent; + protected override int RecycleBinId => ConstantsCore.System.RecycleBinContent; protected override bool RecycleBinSmells => Services.ContentService.RecycleBinSmells(); @@ -68,7 +68,7 @@ namespace Umbraco.Web.Trees var node = CreateTreeNode( entity, - Constants.ObjectTypes.Document, + ConstantsCore.ObjectTypes.Document, parentId, queryStrings, entity.HasChildren); @@ -114,12 +114,12 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings) { - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { var menu = new MenuItemCollection(); // if the user's start node is not the root then the only menu item to display is refresh - if (UserStartNodes.Contains(Constants.System.Root) == false) + if (UserStartNodes.Contains(ConstantsCore.System.Root) == false) { menu.Items.Add(new RefreshNode(Services.TextService, true)); return menu; @@ -129,7 +129,7 @@ namespace Umbraco.Web.Trees menu.DefaultMenuAlias = ActionNew.ActionAlias; // we need to get the default permissions as you can't set permissions on the very root node - var permission = Services.UserService.GetPermissions(Security.CurrentUser, Constants.System.Root).First(); + var permission = Services.UserService.GetPermissions(Security.CurrentUser, ConstantsCore.System.Root).First(); var nodeActions = _actions.FromEntityPermission(permission) .Select(x => new MenuItem(x)); @@ -172,8 +172,8 @@ namespace Umbraco.Web.Trees return menu; } - var nodeMenu = GetAllNodeMenuItems(item); - + var nodeMenu = GetAllNodeMenuItems(item); + //if the content node is in the recycle bin, don't have a default menu, just show the regular menu if (item.Path.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString())) { @@ -274,7 +274,7 @@ namespace Umbraco.Web.Trees return menu; } - + /// /// set name according to variations /// diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index c3458f93a2..cc18d9e161 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -81,7 +81,7 @@ namespace Umbraco.Web.Trees { var node = base.CreateRootNode(queryStrings); - if (IsDialog(queryStrings) && UserStartNodes.Contains(Constants.System.Root) == false && IgnoreUserStartNodes(queryStrings) == false) + if (IsDialog(queryStrings) && UserStartNodes.Contains(ConstantsCore.System.Root) == false && IgnoreUserStartNodes(queryStrings) == false) { node.AdditionalData["noAccess"] = true; } @@ -125,11 +125,11 @@ namespace Umbraco.Web.Trees { switch (RecycleBinId) { - case Constants.System.RecycleBinMedia: + case ConstantsCore.System.RecycleBinMedia: startNodeIds = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); startNodePaths = Security.CurrentUser.GetMediaStartNodePaths(Services.EntityService); break; - case Constants.System.RecycleBinContent: + case ConstantsCore.System.RecycleBinContent: startNodeIds = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService); startNodePaths = Security.CurrentUser.GetContentStartNodePaths(Services.EntityService); break; @@ -157,8 +157,8 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - var rootIdString = Constants.System.RootString; - var hasAccessToRoot = UserStartNodes.Contains(Constants.System.Root); + var rootIdString = ConstantsCore.System.RootString; + var hasAccessToRoot = UserStartNodes.Contains(ConstantsCore.System.Root); var startNodeId = queryStrings.HasKey(TreeQueryStringParameters.StartNodeId) ? queryStrings.GetValue(TreeQueryStringParameters.StartNodeId) @@ -245,7 +245,7 @@ namespace Umbraco.Web.Trees // if a request is made for the root node but user has no access to // root node, return start nodes instead - if (!ignoreUserStartNodes && entityId == Constants.System.Root && UserStartNodes.Contains(Constants.System.Root) == false) + if (!ignoreUserStartNodes && entityId == ConstantsCore.System.Root && UserStartNodes.Contains(ConstantsCore.System.Root) == false) { result = UserStartNodes.Length > 0 ? Services.EntityService.GetAll(UmbracoObjectType, UserStartNodes).ToArray() @@ -280,7 +280,7 @@ namespace Umbraco.Web.Trees protected bool HasPathAccess(IUmbracoEntity entity, FormDataCollection queryStrings) { if (entity == null) return false; - return RecycleBinId == Constants.System.RecycleBinContent + return RecycleBinId == ConstantsCore.System.RecycleBinContent ? Security.CurrentUser.HasContentPathAccess(entity, Services.EntityService) : Security.CurrentUser.HasMediaPathAccess(entity, Services.EntityService); } @@ -297,7 +297,7 @@ namespace Umbraco.Web.Trees protected sealed override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { //check if we're rendering the root - if (id == Constants.System.RootString && UserStartNodes.Contains(Constants.System.Root)) + if (id == ConstantsCore.System.RootString && UserStartNodes.Contains(ConstantsCore.System.Root)) { var altStartId = string.Empty; @@ -305,7 +305,7 @@ namespace Umbraco.Web.Trees altStartId = queryStrings.GetValue(TreeQueryStringParameters.StartNodeId); //check if a request has been made to render from a specific start node - if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.System.RootString) + if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != ConstantsCore.System.RootString) { id = altStartId; } @@ -313,7 +313,7 @@ namespace Umbraco.Web.Trees var nodes = GetTreeNodesInternal(id, queryStrings); //only render the recycle bin if we are not in dialog and the start id id still the root - if (IsDialog(queryStrings) == false && id == Constants.System.RootString) + if (IsDialog(queryStrings) == false && id == ConstantsCore.System.RootString) { nodes.Add(CreateTreeNode( RecycleBinId.ToInvariantString(), @@ -349,7 +349,7 @@ namespace Umbraco.Web.Trees //Here we need to figure out if the node is a container and if so check if the user has a custom start node, then check if that start node is a child // of this container node. If that is true, the HasChildren must be true so that the tree node still renders even though this current node is a container/list view. - if (isContainer && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.System.Root) == false) + if (isContainer && UserStartNodes.Length > 0 && UserStartNodes.Contains(ConstantsCore.System.Root) == false) { var startNodes = Services.EntityService.GetAll(UmbracoObjectType, UserStartNodes); //if any of these start nodes' parent is current, then we need to render children normally so we need to switch some logic and tell @@ -403,7 +403,7 @@ namespace Umbraco.Web.Trees var deleteAction = Current.Actions.FirstOrDefault(y => y.Letter == ActionDelete.ActionLetter); if (deleteAction != null) { - var perms = Security.CurrentUser.GetPermissions(Constants.System.RecycleBinContentString, Services.UserService); + var perms = Security.CurrentUser.GetPermissions(ConstantsCore.System.RecycleBinContentString, Services.UserService); deleteAllowed = perms.FirstOrDefault(x => x.Contains(deleteAction.Letter)) != null; } @@ -541,7 +541,7 @@ namespace Umbraco.Web.Trees private bool? _ignoreUserStartNodes; - + /// /// If the request should allows a user to choose nodes that they normally don't have access to diff --git a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs index e8f8fb9f75..d65ee9a4cf 100644 --- a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs @@ -18,8 +18,8 @@ using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)] - [Tree(Constants.Applications.Settings, Constants.Trees.DocumentTypes, SortOrder = 0, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.DocumentTypes)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.DocumentTypes, SortOrder = 0, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [Mvc.PluginController("UmbracoTrees")] [CoreTree] public class ContentTypeTreeController : TreeController, ISearchableTree @@ -72,7 +72,7 @@ namespace Umbraco.Web.Trees // since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to. // need this check to keep supporting sites where children have already been created. var hasChildren = dt.HasChildren; - var node = CreateTreeNode(dt, Constants.ObjectTypes.DocumentType, id, queryStrings, Constants.Icons.ContentType, hasChildren); + var node = CreateTreeNode(dt, ConstantsCore.ObjectTypes.DocumentType, id, queryStrings, ConstantsCore.Icons.ContentType, hasChildren); node.Path = dt.Path; @@ -91,7 +91,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/DataTypeTreeController.cs b/src/Umbraco.Web/Trees/DataTypeTreeController.cs index 4e5b1df631..d60fc5c4a5 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -20,8 +20,8 @@ using Umbraco.Web.Search; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.DataTypes)] - [Tree(Constants.Applications.Settings, Constants.Trees.DataTypes, SortOrder = 3, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.DataTypes)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.DataTypes, SortOrder = 3, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class DataTypeTreeController : TreeController, ISearchableTree @@ -46,7 +46,7 @@ namespace Umbraco.Web.Trees .OrderBy(entity => entity.Name) .Select(dt => { - var node = CreateTreeNode(dt, Constants.ObjectTypes.DataType, id, queryStrings, "icon-folder", dt.HasChildren); + var node = CreateTreeNode(dt, ConstantsCore.ObjectTypes.DataType, id, queryStrings, "icon-folder", dt.HasChildren); node.Path = dt.Path; node.NodeType = "container"; // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. @@ -65,11 +65,11 @@ namespace Umbraco.Web.Trees .OrderBy(entity => entity.Name) .Select(dt => { - var node = CreateTreeNode(dt.Id.ToInvariantString(), id, queryStrings, dt.Name, Constants.Icons.DataType, false); + var node = CreateTreeNode(dt.Id.ToInvariantString(), id, queryStrings, dt.Name, ConstantsCore.Icons.DataType, false); node.Path = dt.Path; if (systemListViewDataTypeIds.Contains(dt.Id)) { - node.Icon = Constants.Icons.ListView; + node.Icon = ConstantsCore.Icons.ListView; } return node; })); @@ -84,15 +84,15 @@ namespace Umbraco.Web.Trees { var systemIds = new[] { - Constants.DataTypes.Boolean, // Used by the Member Type: "Member" - Constants.DataTypes.Textarea, // Used by the Member Type: "Member" - Constants.DataTypes.LabelBigint, // Used by the Media Type: "Image"; Used by the Media Type: "File" - Constants.DataTypes.LabelDateTime, // Used by the Member Type: "Member" - Constants.DataTypes.LabelDecimal, // Used by the Member Type: "Member" - Constants.DataTypes.LabelInt, // Used by the Media Type: "Image"; Used by the Member Type: "Member" - Constants.DataTypes.LabelString, // Used by the Media Type: "Image"; Used by the Media Type: "File" - Constants.DataTypes.ImageCropper, // Used by the Media Type: "Image" - Constants.DataTypes.Upload, // Used by the Media Type: "File" + ConstantsCore.DataTypes.Boolean, // Used by the Member Type: "Member" + ConstantsCore.DataTypes.Textarea, // Used by the Member Type: "Member" + ConstantsCore.DataTypes.LabelBigint, // Used by the Media Type: "Image"; Used by the Media Type: "File" + ConstantsCore.DataTypes.LabelDateTime, // Used by the Member Type: "Member" + ConstantsCore.DataTypes.LabelDecimal, // Used by the Member Type: "Member" + ConstantsCore.DataTypes.LabelInt, // Used by the Media Type: "Image"; Used by the Member Type: "Member" + ConstantsCore.DataTypes.LabelString, // Used by the Media Type: "Image"; Used by the Media Type: "File" + ConstantsCore.DataTypes.ImageCropper, // Used by the Media Type: "Image" + ConstantsCore.DataTypes.Upload, // Used by the Media Type: "File" }; return systemIds.Concat(GetNonDeletableSystemListViewDataTypeIds()); @@ -105,9 +105,9 @@ namespace Umbraco.Web.Trees { return new[] { - Constants.DataTypes.DefaultContentListView, - Constants.DataTypes.DefaultMediaListView, - Constants.DataTypes.DefaultMembersListView + ConstantsCore.DataTypes.DefaultContentListView, + ConstantsCore.DataTypes.DefaultMediaListView, + ConstantsCore.DataTypes.DefaultMembersListView }; } @@ -115,7 +115,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/DictionaryTreeController.cs b/src/Umbraco.Web/Trees/DictionaryTreeController.cs index 3f7b89bcdf..c627ec3b16 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -11,14 +11,14 @@ namespace Umbraco.Web.Trees { [UmbracoTreeAuthorize( - Constants.Trees.Dictionary, - Constants.Trees.Templates + ConstantsCore.Trees.Dictionary, + ConstantsCore.Trees.Templates // We are allowed to see the dictionary tree, if we are allowed to manage templates, such that se can use the // dictionary items in templates, even when we dont have authorization to manage the dictionary items )] [Mvc.PluginController("UmbracoTrees")] [CoreTree] - [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, TreeGroup = Constants.Trees.Groups.Settings)] + [Tree(ConstantsCore.Applications.Translation, ConstantsCore.Trees.Dictionary, TreeGroup = ConstantsCore.Trees.Groups.Settings)] public class DictionaryTreeController : TreeController { protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -27,12 +27,12 @@ namespace Umbraco.Web.Trees // the default section is settings, falling back to this if we can't // figure out where we are from the querystring parameters - var section = Constants.Applications.Translation; + var section = ConstantsCore.Applications.Translation; if (queryStrings["application"] != null) section = queryStrings["application"]; // this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = $"{section}/{Constants.Trees.Dictionary}/list"; + root.RoutePath = $"{section}/{ConstantsCore.Trees.Dictionary}/list"; return root; } @@ -58,7 +58,7 @@ namespace Umbraco.Web.Trees Func ItemSort() => item => item.ItemKey; - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { nodes.AddRange( Services.LocalizationService.GetRootDictionaryItems().OrderBy(ItemSort()).Select( @@ -104,7 +104,7 @@ namespace Umbraco.Web.Trees menu.Items.Add(Services.TextService, opensDialog: true); - if (id != Constants.System.RootString) + if (id != ConstantsCore.System.RootString) menu.Items.Add(Services.TextService, true, opensDialog: true); menu.Items.Add(new RefreshNode(Services.TextService, true)); diff --git a/src/Umbraco.Web/Trees/FileSystemTreeController.cs b/src/Umbraco.Web/Trees/FileSystemTreeController.cs index 6e21c8114f..69167fca02 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.Trees protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { - var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString + var path = string.IsNullOrEmpty(id) == false && id != ConstantsCore.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; @@ -61,7 +61,7 @@ namespace Umbraco.Web.Trees if (Extensions.Contains("*")) return true; - + return extension != null && Extensions.Contains(extension.Trim('.'), StringComparer.InvariantCultureIgnoreCase); }); @@ -84,7 +84,7 @@ namespace Umbraco.Web.Trees { var root = base.CreateRootNode(queryStrings); //check if there are any children - root.HasChildren = GetTreeNodes(Constants.System.RootString, queryStrings).Any(); + root.HasChildren = GetTreeNodes(ConstantsCore.System.RootString, queryStrings).Any(); return root; } @@ -139,14 +139,14 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) { //if root node no need to visit the filesystem so lets just create the menu and return it - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { return GetMenuForRootNode(queryStrings); } var menu = new MenuItemCollection(); - var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString + var path = string.IsNullOrEmpty(id) == false && id != ConstantsCore.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; diff --git a/src/Umbraco.Web/Trees/FilesTreeController.cs b/src/Umbraco.Web/Trees/FilesTreeController.cs index ae951bebf4..8feb183805 100644 --- a/src/Umbraco.Web/Trees/FilesTreeController.cs +++ b/src/Umbraco.Web/Trees/FilesTreeController.cs @@ -4,7 +4,7 @@ using Umbraco.Web.Models.Trees; namespace Umbraco.Web.Trees { - [Tree(Constants.Applications.Settings, "files", TreeTitle = "Files", TreeUse = TreeUse.Dialog)] + [Tree(ConstantsCore.Applications.Settings, "files", TreeTitle = "Files", TreeUse = TreeUse.Dialog)] [CoreTree] public class FilesTreeController : FileSystemTreeController { @@ -14,6 +14,6 @@ namespace Umbraco.Web.Trees protected override string[] Extensions => ExtensionsStatic; - protected override string FileIcon => Constants.Icons.MediaFile; + protected override string FileIcon => ConstantsCore.Icons.MediaFile; } } diff --git a/src/Umbraco.Web/Trees/LanguageTreeController.cs b/src/Umbraco.Web/Trees/LanguageTreeController.cs index ac2c0571e0..9c932ccf34 100644 --- a/src/Umbraco.Web/Trees/LanguageTreeController.cs +++ b/src/Umbraco.Web/Trees/LanguageTreeController.cs @@ -1,8 +1,9 @@ using System.Net.Http.Formatting; +using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; +using Constants = Umbraco.Core.ConstantsCore; namespace Umbraco.Web.Trees { @@ -33,7 +34,7 @@ namespace Umbraco.Web.Trees var root = base.CreateRootNode(queryStrings); //this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = $"{Constants.Applications.Settings}/{Constants.Trees.Languages}/overview"; + root.RoutePath = $"{ConstantsCore.Applications.Settings}/{ConstantsCore.Trees.Languages}/overview"; root.Icon = "icon-globe"; root.HasChildren = false; root.MenuUrl = null; diff --git a/src/Umbraco.Web/Trees/LogViewerTreeController.cs b/src/Umbraco.Web/Trees/LogViewerTreeController.cs index 7452828d00..f7da2a48be 100644 --- a/src/Umbraco.Web/Trees/LogViewerTreeController.cs +++ b/src/Umbraco.Web/Trees/LogViewerTreeController.cs @@ -1,4 +1,5 @@ using System.Net.Http.Formatting; +using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; @@ -6,8 +7,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.LogViewer)] - [Tree(Constants.Applications.Settings, Constants.Trees.LogViewer, SortOrder= 9, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.LogViewer)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.LogViewer, SortOrder= 9, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class LogViewerTreeController : TreeController @@ -33,7 +34,7 @@ namespace Umbraco.Web.Trees var root = base.CreateRootNode(queryStrings); //this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = string.Format("{0}/{1}/{2}", Constants.Applications.Settings, Constants.Trees.LogViewer, "overview"); + root.RoutePath = string.Format("{0}/{1}/{2}", ConstantsCore.Applications.Settings, ConstantsCore.Trees.LogViewer, "overview"); root.Icon = "icon-box-alt"; root.HasChildren = false; root.MenuUrl = null; diff --git a/src/Umbraco.Web/Trees/MacrosTreeController.cs b/src/Umbraco.Web/Trees/MacrosTreeController.cs index cbe1946779..f18bf9a5cf 100644 --- a/src/Umbraco.Web/Trees/MacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/MacrosTreeController.cs @@ -9,8 +9,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.Macros)] - [Tree(Constants.Applications.Settings, Constants.Trees.Macros, TreeTitle = "Macros", SortOrder = 4, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Macros)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Macros, TreeTitle = "Macros", SortOrder = 4, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class MacrosTreeController : TreeController @@ -27,7 +27,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { foreach (var macro in Services.MacroService.GetAll().OrderBy(m => m.Name)) { @@ -36,7 +36,7 @@ namespace Umbraco.Web.Trees id, queryStrings, macro.Name, - Constants.Icons.Macro, + ConstantsCore.Icons.Macro, false)); } } @@ -48,7 +48,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //Create the normal create action menu.Items.Add(Services.TextService); diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index df44a809c9..4b854fa8f0 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -26,12 +26,12 @@ namespace Umbraco.Web.Trees //We will not allow the tree to render unless the user has access to any of the sections that the tree gets rendered // this is not ideal but until we change permissions to be tree based (not section) there's not much else we can do here. [UmbracoApplicationAuthorize( - Constants.Applications.Content, - Constants.Applications.Media, - Constants.Applications.Settings, - Constants.Applications.Packages, - Constants.Applications.Members)] - [Tree(Constants.Applications.Media, Constants.Trees.Media)] + ConstantsCore.Applications.Content, + ConstantsCore.Applications.Media, + ConstantsCore.Applications.Settings, + ConstantsCore.Applications.Packages, + ConstantsCore.Applications.Members)] + [Tree(ConstantsCore.Applications.Media, ConstantsCore.Trees.Media)] [PluginController("UmbracoTrees")] [CoreTree] [SearchableTree("searchResultFormatter", "configureMediaResult", 20)] @@ -44,7 +44,7 @@ namespace Umbraco.Web.Trees _treeSearcher = treeSearcher; } - protected override int RecycleBinId => Constants.System.RecycleBinMedia; + protected override int RecycleBinId => ConstantsCore.System.RecycleBinMedia; protected override bool RecycleBinSmells => Services.MediaService.RecycleBinSmells(); @@ -63,7 +63,7 @@ namespace Umbraco.Web.Trees { var node = CreateTreeNode( entity, - Constants.ObjectTypes.Media, + ConstantsCore.ObjectTypes.Media, parentId, queryStrings, entity.HasChildren); @@ -90,10 +90,10 @@ namespace Umbraco.Web.Trees //set the default menu.DefaultMenuAlias = ActionNew.ActionAlias; - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { // if the user's start node is not the root then the only menu item to display is refresh - if (UserStartNodes.Contains(Constants.System.Root) == false) + if (UserStartNodes.Contains(ConstantsCore.System.Root) == false) { menu.Items.Add(new RefreshNode(Services.TextService, true)); return menu; @@ -133,7 +133,7 @@ namespace Umbraco.Web.Trees menu.Items.Add(new RefreshNode(Services.TextService, true)); menu.DefaultMenuAlias = null; - + } else { @@ -170,6 +170,6 @@ namespace Umbraco.Web.Trees { return _treeSearcher.ExamineSearch(query, UmbracoEntityTypes.Media, pageSize, pageIndex, out totalFound, searchFrom); } - + } } diff --git a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs index f85aefcace..3cb25eff5b 100644 --- a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs @@ -18,8 +18,8 @@ using Umbraco.Web.Search; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.MediaTypes)] - [Tree(Constants.Applications.Settings, Constants.Trees.MediaTypes, SortOrder = 1, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.MediaTypes, SortOrder = 1, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [Mvc.PluginController("UmbracoTrees")] [CoreTree] public class MediaTypeTreeController : TreeController, ISearchableTree @@ -62,7 +62,7 @@ namespace Umbraco.Web.Trees // since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to. // need this check to keep supporting sites where children have already been created. var hasChildren = dt.HasChildren; - var node = CreateTreeNode(dt, Constants.ObjectTypes.MediaType, id, queryStrings, Constants.Icons.MediaType, hasChildren); + var node = CreateTreeNode(dt, ConstantsCore.ObjectTypes.MediaType, id, queryStrings, ConstantsCore.Icons.MediaType, hasChildren); node.Path = dt.Path; return node; @@ -75,7 +75,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; diff --git a/src/Umbraco.Web/Trees/MemberGroupTreeController.cs b/src/Umbraco.Web/Trees/MemberGroupTreeController.cs index 54c499d717..fd783a9065 100644 --- a/src/Umbraco.Web/Trees/MemberGroupTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberGroupTreeController.cs @@ -7,8 +7,8 @@ using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.MemberGroups)] - [Tree(Constants.Applications.Members, Constants.Trees.MemberGroups, SortOrder = 1)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberGroups)] + [Tree(ConstantsCore.Applications.Members, ConstantsCore.Trees.MemberGroups, SortOrder = 1)] [Mvc.PluginController("UmbracoTrees")] [CoreTree] public class MemberGroupTreeController : MemberTypeAndGroupTreeControllerBase @@ -17,7 +17,7 @@ namespace Umbraco.Web.Trees { return Services.MemberGroupService.GetAll() .OrderBy(x => x.Name) - .Select(dt => CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, Constants.Icons.MemberGroup, false)); + .Select(dt => CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, ConstantsCore.Icons.MemberGroup, false)); } protected override TreeNode CreateRootNode(FormDataCollection queryStrings) diff --git a/src/Umbraco.Web/Trees/MemberTreeController.cs b/src/Umbraco.Web/Trees/MemberTreeController.cs index c0a9d15cfa..3284fdc964 100644 --- a/src/Umbraco.Web/Trees/MemberTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberTreeController.cs @@ -24,10 +24,10 @@ namespace Umbraco.Web.Trees //We will not allow the tree to render unless the user has access to any of the sections that the tree gets rendered // this is not ideal but until we change permissions to be tree based (not section) there's not much else we can do here. [UmbracoApplicationAuthorize( - Constants.Applications.Content, - Constants.Applications.Media, - Constants.Applications.Members)] - [Tree(Constants.Applications.Members, Constants.Trees.Members, SortOrder = 0)] + ConstantsCore.Applications.Content, + ConstantsCore.Applications.Media, + ConstantsCore.Applications.Members)] + [Tree(ConstantsCore.Applications.Members, ConstantsCore.Trees.Members, SortOrder = 0)] [PluginController("UmbracoTrees")] [CoreTree] [SearchableTree("searchResultFormatter", "configureMemberResult")] @@ -80,10 +80,10 @@ namespace Umbraco.Web.Trees "-1", queryStrings, member.Name, - Constants.Icons.Member, + ConstantsCore.Icons.Member, false, "", - Udi.Create(ObjectTypes.GetUdiType(Constants.ObjectTypes.Member), member.Key)); + Udi.Create(ObjectTypes.GetUdiType(ConstantsCore.ObjectTypes.Member), member.Key)); node.AdditionalData.Add("contentType", member.ContentTypeAlias); node.AdditionalData.Add("isContainer", true); @@ -110,7 +110,7 @@ namespace Umbraco.Web.Trees "-1", queryStrings, member.UserName, - Constants.Icons.Member, + ConstantsCore.Icons.Member, false); return node; @@ -121,17 +121,17 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { nodes.Add( - CreateTreeNode(Constants.Conventions.MemberTypes.AllMembersListId, id, queryStrings, Services.TextService.Localize("member/allMembers"), Constants.Icons.MemberType, true, + CreateTreeNode(Constants.Conventions.MemberTypes.AllMembersListId, id, queryStrings, Services.TextService.Localize("member/allMembers"), ConstantsCore.Icons.MemberType, true, queryStrings.GetRequiredValue("application") + TreeAlias.EnsureStartsWith('/') + "/list/" + Constants.Conventions.MemberTypes.AllMembersListId)); if (_isUmbracoProvider) { nodes.AddRange(Services.MemberTypeService.GetAll() .Select(memberType => - CreateTreeNode(memberType.Alias, id, queryStrings, memberType.Name, memberType.Icon.IfNullOrWhiteSpace(Constants.Icons.Member), true, + CreateTreeNode(memberType.Alias, id, queryStrings, memberType.Name, memberType.Icon.IfNullOrWhiteSpace(ConstantsCore.Icons.Member), true, queryStrings.GetRequiredValue("application") + TreeAlias.EnsureStartsWith('/') + "/list/" + memberType.Alias))); } } @@ -148,7 +148,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { // root actions if (_provider.IsUmbracoMembershipProvider()) diff --git a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs index 5e71266bca..cbf48fd394 100644 --- a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { // root actions menu.Items.Add(new CreateChildEntity(Services.TextService)); diff --git a/src/Umbraco.Web/Trees/MemberTypeTreeController.cs b/src/Umbraco.Web/Trees/MemberTypeTreeController.cs index bd80f63897..1363c4af1c 100644 --- a/src/Umbraco.Web/Trees/MemberTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberTypeTreeController.cs @@ -8,8 +8,8 @@ using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web.Trees { [CoreTree] - [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] - [Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, SortOrder = 2, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.MemberTypes, SortOrder = 2, TreeGroup = ConstantsCore.Trees.Groups.Settings)] public class MemberTypeTreeController : MemberTypeAndGroupTreeControllerBase { protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -23,7 +23,7 @@ namespace Umbraco.Web.Trees { return Services.MemberTypeService.GetAll() .OrderBy(x => x.Name) - .Select(dt => CreateTreeNode(dt, Constants.ObjectTypes.MemberType, id, queryStrings, Constants.Icons.MemberType, false)); + .Select(dt => CreateTreeNode(dt, ConstantsCore.ObjectTypes.MemberType, id, queryStrings, ConstantsCore.Icons.MemberType, false)); } } } diff --git a/src/Umbraco.Web/Trees/PackagesTreeController.cs b/src/Umbraco.Web/Trees/PackagesTreeController.cs index 9b1bf98823..a41b030edb 100644 --- a/src/Umbraco.Web/Trees/PackagesTreeController.cs +++ b/src/Umbraco.Web/Trees/PackagesTreeController.cs @@ -1,9 +1,10 @@ using System.Net.Http.Formatting; +using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; +using Constants = Umbraco.Core.ConstantsCore; namespace Umbraco.Web.Trees { @@ -22,7 +23,7 @@ namespace Umbraco.Web.Trees var root = base.CreateRootNode(queryStrings); //this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = $"{Constants.Applications.Packages}/{Constants.Trees.Packages}/repo"; + root.RoutePath = $"{ConstantsCore.Applications.Packages}/{ConstantsCore.Trees.Packages}/repo"; root.Icon = "icon-box"; root.HasChildren = false; diff --git a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs index e7d9972589..22e249a71c 100644 --- a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs @@ -1,9 +1,10 @@ -using Umbraco.Core.IO; +using Umbraco.Core; +using Umbraco.Core.IO; using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; +using Constants = Umbraco.Core.ConstantsCore; namespace Umbraco.Web.Trees { diff --git a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs index 908e29b38a..74f4ae88e9 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs @@ -3,7 +3,7 @@ using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; +using Constants = Umbraco.Core.ConstantsCore; namespace Umbraco.Web.Trees { diff --git a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs index ab6dd39820..7a0bff5997 100644 --- a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs @@ -8,8 +8,8 @@ using Umbraco.Web.Actions; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.RelationTypes)] - [Tree(Constants.Applications.Settings, Constants.Trees.RelationTypes, SortOrder = 5, TreeGroup = Constants.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.RelationTypes)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.RelationTypes, SortOrder = 5, TreeGroup = ConstantsCore.Trees.Groups.Settings)] [Mvc.PluginController("UmbracoTrees")] [CoreTree] public class RelationTypeTreeController : TreeController @@ -18,7 +18,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //Create the normal create action menu.Items.Add(Services.TextService.Localize("actions", ActionNew.ActionAlias)); @@ -41,7 +41,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { nodes.AddRange(Services.RelationService.GetAllRelationTypes() .Select(rt => CreateTreeNode(rt.Id.ToString(), id, queryStrings, rt.Name, diff --git a/src/Umbraco.Web/Trees/ScriptsTreeController.cs b/src/Umbraco.Web/Trees/ScriptsTreeController.cs index 7c00d085b7..22da0a2796 100644 --- a/src/Umbraco.Web/Trees/ScriptsTreeController.cs +++ b/src/Umbraco.Web/Trees/ScriptsTreeController.cs @@ -6,7 +6,7 @@ using Umbraco.Web.Models.Trees; namespace Umbraco.Web.Trees { [CoreTree] - [Tree(Constants.Applications.Settings, Constants.Trees.Scripts, TreeTitle = "Scripts", SortOrder = 10, TreeGroup = Constants.Trees.Groups.Templating)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Scripts, TreeTitle = "Scripts", SortOrder = 10, TreeGroup = ConstantsCore.Trees.Groups.Templating)] public class ScriptsTreeController : FileSystemTreeController { protected override IFileSystem FileSystem => Current.FileSystems.ScriptsFileSystem; // TODO: inject diff --git a/src/Umbraco.Web/Trees/StylesheetsTreeController.cs b/src/Umbraco.Web/Trees/StylesheetsTreeController.cs index f96a83018d..15bd6e637a 100644 --- a/src/Umbraco.Web/Trees/StylesheetsTreeController.cs +++ b/src/Umbraco.Web/Trees/StylesheetsTreeController.cs @@ -5,7 +5,7 @@ using Umbraco.Web.Composing; namespace Umbraco.Web.Trees { [CoreTree] - [Tree(Constants.Applications.Settings, Constants.Trees.Stylesheets, TreeTitle = "Stylesheets", SortOrder = 9, TreeGroup = Constants.Trees.Groups.Templating)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Stylesheets, TreeTitle = "Stylesheets", SortOrder = 9, TreeGroup = ConstantsCore.Trees.Groups.Templating)] public class StylesheetsTreeController : FileSystemTreeController { protected override IFileSystem FileSystem => Current.FileSystems.StylesheetsFileSystem; // TODO: inject diff --git a/src/Umbraco.Web/Trees/TemplatesTreeController.cs b/src/Umbraco.Web/Trees/TemplatesTreeController.cs index d0ca8d1b2e..13ca08bfc9 100644 --- a/src/Umbraco.Web/Trees/TemplatesTreeController.cs +++ b/src/Umbraco.Web/Trees/TemplatesTreeController.cs @@ -20,8 +20,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.Templates)] - [Tree(Constants.Applications.Settings, Constants.Trees.Templates, SortOrder = 6, TreeGroup = Constants.Trees.Groups.Templating)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Templates)] + [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Templates, SortOrder = 6, TreeGroup = ConstantsCore.Trees.Groups.Templating)] [PluginController("UmbracoTrees")] [CoreTree] public class TemplatesTreeController : TreeController, ISearchableTree @@ -56,7 +56,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - var found = id == Constants.System.RootString + var found = id == ConstantsCore.System.RootString ? Services.FileService.GetTemplates(-1) : Services.FileService.GetTemplates(int.Parse(id)); @@ -69,7 +69,7 @@ namespace Umbraco.Web.Trees template.IsMasterTemplate ? "icon-newspaper" : "icon-newspaper-alt", template.IsMasterTemplate, null, - Udi.Create(ObjectTypes.GetUdiType(Constants.ObjectTypes.TemplateType), template.Key) + Udi.Create(ObjectTypes.GetUdiType(ConstantsCore.ObjectTypes.TemplateType), template.Key) ))); return nodes; @@ -89,7 +89,7 @@ namespace Umbraco.Web.Trees var item = menu.Items.Add(Services.TextService, opensDialog: true); item.NavigateToRoute($"{queryStrings.GetRequiredValue("application")}/templates/edit/{id}?create=true"); - if (id == Constants.System.RootString) + if (id == ConstantsCore.System.RootString) { //refresh action menu.Items.Add(new RefreshNode(Services.TextService, true)); @@ -123,7 +123,7 @@ namespace Umbraco.Web.Trees Id = template.Id, Key = template.Key, Name = template.Name, - NodeObjectType = Constants.ObjectTypes.Template, + NodeObjectType = ConstantsCore.ObjectTypes.Template, // TODO: Fix parent/paths on templates ParentId = -1, Path = template.Path, diff --git a/src/Umbraco.Web/Trees/TreeControllerBase.cs b/src/Umbraco.Web/Trees/TreeControllerBase.cs index 77e5ebef62..25c59cbd5e 100644 --- a/src/Umbraco.Web/Trees/TreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/TreeControllerBase.cs @@ -174,7 +174,7 @@ namespace Umbraco.Web.Trees /// protected virtual TreeNode CreateRootNode(FormDataCollection queryStrings) { - var rootNodeAsString = Constants.System.RootString; + var rootNodeAsString = ConstantsCore.System.RootString; var currApp = queryStrings.GetValue(TreeQueryStringParameters.Application); var node = new TreeNode( diff --git a/src/Umbraco.Web/Trees/UserTreeController.cs b/src/Umbraco.Web/Trees/UserTreeController.cs index 55d98def86..41109d57ce 100644 --- a/src/Umbraco.Web/Trees/UserTreeController.cs +++ b/src/Umbraco.Web/Trees/UserTreeController.cs @@ -1,4 +1,5 @@ using System.Net.Http.Formatting; +using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; @@ -6,8 +7,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(Constants.Trees.Users)] - [Tree(Constants.Applications.Users, Constants.Trees.Users, SortOrder = 0, IsSingleNodeTree = true)] + [UmbracoTreeAuthorize(ConstantsCore.Trees.Users)] + [Tree(ConstantsCore.Applications.Users, ConstantsCore.Trees.Users, SortOrder = 0, IsSingleNodeTree = true)] [PluginController("UmbracoTrees")] [CoreTree] public class UserTreeController : TreeController @@ -21,8 +22,8 @@ namespace Umbraco.Web.Trees var root = base.CreateRootNode(queryStrings); //this will load in a custom UI instead of the dashboard for the root node - root.RoutePath = $"{Constants.Applications.Users}/{Constants.Trees.Users}/users"; - root.Icon = Constants.Icons.UserGroup; + root.RoutePath = $"{ConstantsCore.Applications.Users}/{ConstantsCore.Trees.Users}/users"; + root.Icon = ConstantsCore.Icons.UserGroup; root.HasChildren = false; return root; diff --git a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs index 31e0b22ce1..36be5b8a8f 100644 --- a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs @@ -83,7 +83,7 @@ namespace Umbraco.Web.WebApi.Filters protected override int RecycleBinId { - get { return Constants.System.RecycleBinContent; } + get { return ConstantsCore.System.RecycleBinContent; } } internal void FilterBasedOnPermissions(IList items, IUser user) @@ -110,7 +110,7 @@ namespace Umbraco.Web.WebApi.Filters if (nodePermission.Contains(_permissionToCheck.ToString(CultureInfo.InvariantCulture)) == false) { toRemove.Add(item); - } + } } foreach (var item in toRemove) { diff --git a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs index 21dc60e6cc..b5a49d9b73 100644 --- a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.WebApi.Filters return user.CalculateMediaStartNodeIds(Current.Services.EntityService); } - protected virtual int RecycleBinId => Constants.System.RecycleBinMedia; + protected virtual int RecycleBinId => ConstantsCore.System.RecycleBinMedia; public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) {