diff --git a/src/Umbraco.Abstractions/Constants-AppSettings.cs b/src/Umbraco.Abstractions/Constants-AppSettings.cs index c9725317f3..509be46b61 100644 --- a/src/Umbraco.Abstractions/Constants-AppSettings.cs +++ b/src/Umbraco.Abstractions/Constants-AppSettings.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Specific web.config AppSetting keys for Umbraco.Core application diff --git a/src/Umbraco.Abstractions/Constants-Applications.cs b/src/Umbraco.Abstractions/Constants-Applications.cs index bb9f57a2a1..cf4f80d87b 100644 --- a/src/Umbraco.Abstractions/Constants-Applications.cs +++ b/src/Umbraco.Abstractions/Constants-Applications.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the alias identifiers for Umbraco's core application sections. diff --git a/src/Umbraco.Abstractions/Constants-Composing.cs b/src/Umbraco.Abstractions/Constants-Composing.cs index c286fd0af6..e65629a278 100644 --- a/src/Umbraco.Abstractions/Constants-Composing.cs +++ b/src/Umbraco.Abstractions/Constants-Composing.cs @@ -3,7 +3,7 @@ /// /// Defines constants. /// - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines constants for composition. diff --git a/src/Umbraco.Core/Constants-Conventions.cs b/src/Umbraco.Abstractions/Constants-Conventions.cs similarity index 75% rename from src/Umbraco.Core/Constants-Conventions.cs rename to src/Umbraco.Abstractions/Constants-Conventions.cs index 6c9407667a..82572fa60e 100644 --- a/src/Umbraco.Core/Constants-Conventions.cs +++ b/src/Umbraco.Abstractions/Constants-Conventions.cs @@ -11,7 +11,7 @@ namespace Umbraco.Core /// public static class Conventions { - internal static class PermissionCategories + public static class PermissionCategories { public const string ContentCategory = "content"; public const string AdministrationCategory = "administration"; @@ -204,77 +204,7 @@ namespace Umbraco.Core /// /// Group name to put the membership properties on /// - internal const string StandardPropertiesGroupName = "Membership"; - - public static Dictionary GetStandardPropertyTypeStubs() - { - return new Dictionary - { - { - Comments, - new PropertyType(PropertyEditors.Aliases.TextArea, ValueStorageType.Ntext, true, Comments) - { - Name = CommentsLabel - } - }, - { - FailedPasswordAttempts, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Integer, true, FailedPasswordAttempts) - { - Name = FailedPasswordAttemptsLabel - } - }, - { - IsApproved, - new PropertyType(PropertyEditors.Aliases.Boolean, ValueStorageType.Integer, true, IsApproved) - { - Name = IsApprovedLabel - } - }, - { - IsLockedOut, - new PropertyType(PropertyEditors.Aliases.Boolean, ValueStorageType.Integer, true, IsLockedOut) - { - Name = IsLockedOutLabel - } - }, - { - LastLockoutDate, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLockoutDate) - { - Name = LastLockoutDateLabel - } - }, - { - LastLoginDate, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastLoginDate) - { - Name = LastLoginDateLabel - } - }, - { - LastPasswordChangeDate, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Date, true, LastPasswordChangeDate) - { - Name = LastPasswordChangeDateLabel - } - }, - { - PasswordAnswer, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordAnswer) - { - Name = PasswordAnswerLabel - } - }, - { - PasswordQuestion, - new PropertyType(PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, PasswordQuestion) - { - Name = PasswordQuestionLabel - } - } - }; - } + public const string StandardPropertiesGroupName = "Membership"; } /// diff --git a/src/Umbraco.Abstractions/Constants-DataTypes.cs b/src/Umbraco.Abstractions/Constants-DataTypes.cs index 84c680f98a..c6f6c6478e 100644 --- a/src/Umbraco.Abstractions/Constants-DataTypes.cs +++ b/src/Umbraco.Abstractions/Constants-DataTypes.cs @@ -2,7 +2,7 @@ using System; namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { public static class DataTypes { diff --git a/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs b/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs index f8a25c28e6..e93e524bbc 100644 --- a/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs +++ b/src/Umbraco.Abstractions/Constants-DatabaseProviders.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { public static class DatabaseProviders { diff --git a/src/Umbraco.Abstractions/Constants-DeploySelector.cs b/src/Umbraco.Abstractions/Constants-DeploySelector.cs index 6ab5d7e3c6..f6f3f5fbae 100644 --- a/src/Umbraco.Abstractions/Constants-DeploySelector.cs +++ b/src/Umbraco.Abstractions/Constants-DeploySelector.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Contains the valid selector values. diff --git a/src/Umbraco.Abstractions/Constants-Icons.cs b/src/Umbraco.Abstractions/Constants-Icons.cs index 7309292aef..05213ed1c4 100644 --- a/src/Umbraco.Abstractions/Constants-Icons.cs +++ b/src/Umbraco.Abstractions/Constants-Icons.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { public static class Icons { diff --git a/src/Umbraco.Abstractions/Constants-Indexes.cs b/src/Umbraco.Abstractions/Constants-Indexes.cs index b294bb5f3b..1add0f721b 100644 --- a/src/Umbraco.Abstractions/Constants-Indexes.cs +++ b/src/Umbraco.Abstractions/Constants-Indexes.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { public static class UmbracoIndexes { diff --git a/src/Umbraco.Abstractions/Constants-ObjectTypes.cs b/src/Umbraco.Abstractions/Constants-ObjectTypes.cs index 0ef51a7003..51adc69963 100644 --- a/src/Umbraco.Abstractions/Constants-ObjectTypes.cs +++ b/src/Umbraco.Abstractions/Constants-ObjectTypes.cs @@ -2,7 +2,7 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the Umbraco object type unique identifiers. diff --git a/src/Umbraco.Abstractions/Constants-PackageRepository.cs b/src/Umbraco.Abstractions/Constants-PackageRepository.cs index dbf7692ec0..42cf61f982 100644 --- a/src/Umbraco.Abstractions/Constants-PackageRepository.cs +++ b/src/Umbraco.Abstractions/Constants-PackageRepository.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the constants used for the Umbraco package repository diff --git a/src/Umbraco.Core/Constants-PropertyEditors.cs b/src/Umbraco.Abstractions/Constants-PropertyEditors.cs similarity index 99% rename from src/Umbraco.Core/Constants-PropertyEditors.cs rename to src/Umbraco.Abstractions/Constants-PropertyEditors.cs index eb2b3525a7..4374f284ff 100644 --- a/src/Umbraco.Core/Constants-PropertyEditors.cs +++ b/src/Umbraco.Abstractions/Constants-PropertyEditors.cs @@ -85,7 +85,7 @@ namespace Umbraco.Core /// ListView. /// public const string ListView = "Umbraco.ListView"; - + /// /// Media Picker. /// diff --git a/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs b/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs index 60b3a84233..d3402e69f8 100644 --- a/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs +++ b/src/Umbraco.Abstractions/Constants-PropertyTypeGroups.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the identifiers for property-type groups conventions that are used within the Umbraco core. diff --git a/src/Umbraco.Abstractions/Constants-Security.cs b/src/Umbraco.Abstractions/Constants-Security.cs index b01ba83fa5..ae5741f0ef 100644 --- a/src/Umbraco.Abstractions/Constants-Security.cs +++ b/src/Umbraco.Abstractions/Constants-Security.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { public static class Security { diff --git a/src/Umbraco.Abstractions/Constants-System.cs b/src/Umbraco.Abstractions/Constants-System.cs index 3b1db0be09..abb92298f4 100644 --- a/src/Umbraco.Abstractions/Constants-System.cs +++ b/src/Umbraco.Abstractions/Constants-System.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the identifiers for Umbraco system nodes. diff --git a/src/Umbraco.Abstractions/Constants-UdiEntityType.cs b/src/Umbraco.Abstractions/Constants-UdiEntityType.cs new file mode 100644 index 0000000000..3bf6467060 --- /dev/null +++ b/src/Umbraco.Abstractions/Constants-UdiEntityType.cs @@ -0,0 +1,73 @@ +namespace Umbraco.Core +{ + public static partial class Constants + { + /// + /// Defines well-known entity types. + /// + /// Well-known entity types are those that Deploy already knows about, + /// but entity types are strings and so can be extended beyond what is defined here. + public static class UdiEntityType + { + // note: const fields in this class MUST be consistent with what GetTypes returns + // this is validated by UdiTests.ValidateUdiEntityType + // also, this is used exclusively in Udi static ctor, only once, so there is no + // need to keep it around in a field nor to make it readonly + + + public const string Unknown = "unknown"; + + // guid entity types + + public const string AnyGuid = "any-guid"; // that one is for tests + + public const string Document = "document"; + + public const string DocumentBlueprint = "document-blueprint"; + + public const string Media = "media"; + public const string Member = "member"; + + public const string DictionaryItem = "dictionary-item"; + public const string Macro = "macro"; + public const string Template = "template"; + + public const string DocumentType = "document-type"; + public const string DocumentTypeContainer = "document-type-container"; + + // TODO: What is this? This alias is only used for the blue print tree to render the blueprint's document type, it's not a real udi type + public const string DocumentTypeBluePrints = "document-type-blueprints"; + public const string MediaType = "media-type"; + public const string MediaTypeContainer = "media-type-container"; + public const string DataType = "data-type"; + public const string DataTypeContainer = "data-type-container"; + public const string MemberType = "member-type"; + public const string MemberGroup = "member-group"; + + public const string RelationType = "relation-type"; + + // forms + + public const string FormsForm = "forms-form"; + public const string FormsPreValue = "forms-prevalue"; + public const string FormsDataSource = "forms-datasource"; + + // string entity types + + public const string AnyString = "any-string"; // that one is for tests + + public const string Language = "language"; + public const string MacroScript = "macroscript"; + public const string MediaFile = "media-file"; + public const string TemplateFile = "template-file"; + public const string Script = "script"; + public const string Stylesheet = "stylesheet"; + public const string PartialView = "partial-view"; + public const string PartialViewMacro = "partial-view-macro"; + + + + + } + } +} diff --git a/src/Umbraco.Abstractions/Constants-Web.cs b/src/Umbraco.Abstractions/Constants-Web.cs index eb55385838..64216ba571 100644 --- a/src/Umbraco.Abstractions/Constants-Web.cs +++ b/src/Umbraco.Abstractions/Constants-Web.cs @@ -1,6 +1,6 @@ namespace Umbraco.Core { - public static partial class ConstantsCore + public static partial class Constants { /// /// Defines the identifiers for Umbraco system nodes. diff --git a/src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs b/src/Umbraco.Abstractions/Persistence/Constants-DatabaseSchema.cs similarity index 100% rename from src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs rename to src/Umbraco.Abstractions/Persistence/Constants-DatabaseSchema.cs diff --git a/src/Umbraco.Core/Persistence/Constants-DbProviderNames.cs b/src/Umbraco.Abstractions/Persistence/Constants-DbProviderNames.cs similarity index 100% rename from src/Umbraco.Core/Persistence/Constants-DbProviderNames.cs rename to src/Umbraco.Abstractions/Persistence/Constants-DbProviderNames.cs diff --git a/src/Umbraco.Core/Persistence/Constants-Locks.cs b/src/Umbraco.Abstractions/Persistence/Constants-Locks.cs similarity index 100% rename from src/Umbraco.Core/Persistence/Constants-Locks.cs rename to src/Umbraco.Abstractions/Persistence/Constants-Locks.cs diff --git a/src/Umbraco.Core/Compose/AuditEventsComponent.cs b/src/Umbraco.Core/Compose/AuditEventsComponent.cs index 8f78213107..453fd6314a 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 = ConstantsCore.Security.UnknownUserId, Name = ConstantsCore.Security.UnknownUserName, Email = "" }; + internal static IUser UnknownUser => new User { Id = Constants.Security.UnknownUserId, Name = Constants.Security.UnknownUserName, Email = "" }; private IUser CurrentPerformingUser { diff --git a/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs b/src/Umbraco.Core/Compose/RelateOnCopyComponent.cs index d20191ad5d..63a7e170da 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(ConstantsCore.ObjectTypes.Document, - ConstantsCore.ObjectTypes.Document, + relationType = new RelationType(Constants.ObjectTypes.Document, + Constants.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 2a0616eda3..8371f9b279 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(ConstantsCore.System.RecycleBinContentString))) + foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.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(ConstantsCore.System.RecycleBinMediaString))) + foreach (var item in e.MoveInfoCollection.Where(x => x.OriginalPath.Contains(Constants.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 = ConstantsCore.ObjectTypes.Document; + var documentObjectType = Constants.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]) - : ConstantsCore.System.Root; + : Constants.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 = ConstantsCore.ObjectTypes.Document; + var documentObjectType = Constants.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]) - : ConstantsCore.System.Root; + : Constants.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 31b7dd9113..ea25d6a135 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[ConstantsCore.AppSettings.RegisterType]; + var configuredTypeName = ConfigurationManager.AppSettings[Constants.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 97f7ad965c..5ad1e43580 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[ConstantsCore.AppSettings.AssembliesAcceptingLoadExceptions]; + var s = ConfigurationManager.AppSettings[Constants.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 9f8e8c4861..b24e8a3329 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[ConstantsCore.AppSettings.Debug.LogUncompletedScopes], StringComparison.OrdinalIgnoreCase); - DumpOnTimeoutThreadAbort = string.Equals("true", appSettings[ConstantsCore.AppSettings.Debug.DumpOnTimeoutThreadAbort], StringComparison.OrdinalIgnoreCase); + LogUncompletedScopes = string.Equals("true", appSettings[Constants.AppSettings.Debug.LogUncompletedScopes], StringComparison.OrdinalIgnoreCase); + DumpOnTimeoutThreadAbort = string.Equals("true", appSettings[Constants.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 3cc9d05052..a888e3c42b 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(ConstantsCore.AppSettings.ReservedUrls) - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ReservedUrls] + var urls = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedUrls) + ? ConfigurationManager.AppSettings[Constants.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(ConstantsCore.AppSettings.Path) && !ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path].IsNullOrWhiteSpace() - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path] + var umbPath = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.Path) && !ConfigurationManager.AppSettings[Constants.AppSettings.Path].IsNullOrWhiteSpace() + ? ConfigurationManager.AppSettings[Constants.AppSettings.Path] : "~/umbraco"; //always add the umbraco path to the list reservedPaths += umbPath.EnsureEndsWith(','); - var allPaths = ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ReservedPaths) - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ReservedPaths] + var allPaths = ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ReservedPaths) + ? ConfigurationManager.AppSettings[Constants.AppSettings.ReservedPaths] : string.Empty; _reservedPaths = reservedPaths + allPaths; @@ -125,8 +125,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ContentXML) - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ContentXML] + return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ContentXML) + ? ConfigurationManager.AppSettings[Constants.AppSettings.ContentXML] : "~/App_Data/umbraco.config"; } } @@ -139,8 +139,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.Path) - ? IOHelper.ResolveUrl(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.Path]) + return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.Path) + ? IOHelper.ResolveUrl(ConfigurationManager.AppSettings[Constants.AppSettings.Path]) : string.Empty; } } @@ -153,13 +153,13 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.ConfigurationStatus) - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.ConfigurationStatus] + return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.ConfigurationStatus) + ? ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus] : string.Empty; } set { - SaveSetting(ConstantsCore.AppSettings.ConfigurationStatus, value); + SaveSetting(Constants.AppSettings.ConfigurationStatus, value); } } @@ -241,7 +241,7 @@ namespace Umbraco.Core.Configuration { try { - return int.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.TimeOutInMinutes]); + return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.TimeOutInMinutes]); } catch { @@ -260,7 +260,7 @@ namespace Umbraco.Core.Configuration { try { - return int.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.VersionCheckPeriod]); + return int.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.VersionCheckPeriod]); } catch { @@ -274,7 +274,7 @@ namespace Umbraco.Core.Configuration { get { - var setting = ConfigurationManager.AppSettings[ConstantsCore.AppSettings.LocalTempStorage]; + var setting = ConfigurationManager.AppSettings[Constants.AppSettings.LocalTempStorage]; if (!string.IsNullOrWhiteSpace(setting)) return Enum.Parse(setting); @@ -333,8 +333,8 @@ namespace Umbraco.Core.Configuration { get { - return ConfigurationManager.AppSettings.ContainsKey(ConstantsCore.AppSettings.DefaultUILanguage) - ? ConfigurationManager.AppSettings[ConstantsCore.AppSettings.DefaultUILanguage] + return ConfigurationManager.AppSettings.ContainsKey(Constants.AppSettings.DefaultUILanguage) + ? ConfigurationManager.AppSettings[Constants.AppSettings.DefaultUILanguage] : string.Empty; } } @@ -351,7 +351,7 @@ namespace Umbraco.Core.Configuration { try { - return bool.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.HideTopLevelNodeFromPath]); + return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.HideTopLevelNodeFromPath]); } catch { @@ -369,7 +369,7 @@ namespace Umbraco.Core.Configuration { try { - return bool.Parse(ConfigurationManager.AppSettings[ConstantsCore.AppSettings.UseHttps]); + return bool.Parse(ConfigurationManager.AppSettings[Constants.AppSettings.UseHttps]); } catch { diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 371e7e0516..2f615d26b3 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[ConstantsCore.AppSettings.ConfigurationStatus]; + var value = ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus]; return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null; } catch diff --git a/src/Umbraco.Core/Constants.cs b/src/Umbraco.Core/Constants.cs deleted file mode 100644 index ba12d11197..0000000000 --- a/src/Umbraco.Core/Constants.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Umbraco.Core -{ - /// - /// Constants all the identifiers within the Umbraco core. - /// - public static partial class Constants - { - // generic constants can go here - } -} diff --git a/src/Umbraco.Core/ConventionsHelper.cs b/src/Umbraco.Core/ConventionsHelper.cs new file mode 100644 index 0000000000..16ad95b95e --- /dev/null +++ b/src/Umbraco.Core/ConventionsHelper.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using Umbraco.Core.Models; + +namespace Umbraco.Core +{ + public static class ConventionsHelper + { + public static Dictionary GetStandardPropertyTypeStubs() => + new Dictionary + { + { + Constants.Conventions.Member.Comments, + new PropertyType(Constants.PropertyEditors.Aliases.TextArea, ValueStorageType.Ntext, true, + Constants.Conventions.Member.Comments) + { + Name = Constants.Conventions.Member.CommentsLabel + } + }, + { + Constants.Conventions.Member.FailedPasswordAttempts, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Integer, true, + Constants.Conventions.Member.FailedPasswordAttempts) + { + Name = Constants.Conventions.Member.FailedPasswordAttemptsLabel + } + }, + { + Constants.Conventions.Member.IsApproved, + new PropertyType(Constants.PropertyEditors.Aliases.Boolean, ValueStorageType.Integer, true, + Constants.Conventions.Member.IsApproved) + { + Name = Constants.Conventions.Member.IsApprovedLabel + } + }, + { + Constants.Conventions.Member.IsLockedOut, + new PropertyType(Constants.PropertyEditors.Aliases.Boolean, ValueStorageType.Integer, true, + Constants.Conventions.Member.IsLockedOut) + { + Name = Constants.Conventions.Member.IsLockedOutLabel + } + }, + { + Constants.Conventions.Member.LastLockoutDate, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, true, + Constants.Conventions.Member.LastLockoutDate) + { + Name = Constants.Conventions.Member.LastLockoutDateLabel + } + }, + { + Constants.Conventions.Member.LastLoginDate, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, true, + Constants.Conventions.Member.LastLoginDate) + { + Name = Constants.Conventions.Member.LastLoginDateLabel + } + }, + { + Constants.Conventions.Member.LastPasswordChangeDate, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Date, true, + Constants.Conventions.Member.LastPasswordChangeDate) + { + Name = Constants.Conventions.Member.LastPasswordChangeDateLabel + } + }, + { + Constants.Conventions.Member.PasswordAnswer, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, + Constants.Conventions.Member.PasswordAnswer) + { + Name = Constants.Conventions.Member.PasswordAnswerLabel + } + }, + { + Constants.Conventions.Member.PasswordQuestion, + new PropertyType(Constants.PropertyEditors.Aliases.Label, ValueStorageType.Nvarchar, true, + Constants.Conventions.Member.PasswordQuestion) + { + Name = Constants.Conventions.Member.PasswordQuestionLabel + } + } + }; + } +} diff --git a/src/Umbraco.Core/Events/RecycleBinEventArgs.cs b/src/Umbraco.Core/Events/RecycleBinEventArgs.cs index 22265d8d7b..796952de98 100644 --- a/src/Umbraco.Core/Events/RecycleBinEventArgs.cs +++ b/src/Umbraco.Core/Events/RecycleBinEventArgs.cs @@ -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 == ConstantsCore.ObjectTypes.Document; + public bool IsContentRecycleBin => NodeObjectType == Constants.ObjectTypes.Document; /// /// Boolean indicating whether this event was fired for the Media's Recycle Bin. /// - public bool IsMediaRecycleBin => NodeObjectType == ConstantsCore.ObjectTypes.Media; + public bool IsMediaRecycleBin => NodeObjectType == Constants.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 7a4f3efbcb..d86c682bd5 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 == ConstantsCore.Security.SuperUserId && x.Password == "default"); + .Where(x => x.Id == Constants.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 == ConstantsCore.System.UmbracoConnectionName); + var setting = connectionStrings.Descendants("add").FirstOrDefault(s => s.Attribute("name")?.Value == Constants.System.UmbracoConnectionName); if (setting == null) { connectionStrings.Add(new XElement("add", - new XAttribute("name", ConstantsCore.System.UmbracoConnectionName), + new XAttribute("name", Constants.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 bc85824abc..94d8cfbc62 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 = ConstantsCore.ObjectTypes.DataType, + NodeObjectType = Constants.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 = 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 }); + _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 }); //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 = 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 }); + _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 }); } 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 = 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 }); + _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 }); } private void CreateUserData() { - _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 }); + _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 }); } private void CreateUserGroupData() { - _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 = 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 = 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 = 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" }); + _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" }); } private void CreateUser2UserGroupData() { - _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 + _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 } private void CreateUserGroup2AppData() { - _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 = 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 = 2, AppAlias = ConstantsCore.Applications.Content }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 2, AppAlias = Constants.Applications.Content }); - _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 = 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 = 4, AppAlias = ConstantsCore.Applications.Translation }); + _database.Insert(new UserGroup2AppDto { UserGroupId = 4, AppAlias = Constants.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(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) }); + _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) }); //membership property group - _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(ConstantsCore.PropertyTypeGroups.Membership) }); + _database.Insert(Constants.DatabaseSchema.Tables.PropertyTypeGroup, "id", false, new PropertyTypeGroupDto { Id = 11, ContentTypeNodeId = 1044, Text = "Membership", SortOrder = 1, UniqueId = new Guid(Constants.PropertyTypeGroups.Membership) }); } private void CreatePropertyTypeData() { - _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 = 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 = 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 = 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 = 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 = 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 = 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 }); + _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 }); //membership property types - _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 }); + _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 }); } @@ -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 = ConstantsCore.DataTypes.Boolean, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" }); + _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 = -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 = 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 = 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 = -37, EditorAlias = Constants.PropertyEditors.Aliases.ColorPicker, DbType = "Nvarchar" }); - InsertDataTypeDto(ConstantsCore.DataTypes.DropDownSingle, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":false}"); + InsertDataTypeDto(Constants.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(ConstantsCore.DataTypes.DropDownMultiple, Constants.PropertyEditors.Aliases.DropDownListFlexible, "Nvarchar", "{\"multiple\":true}"); + InsertDataTypeDto(Constants.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 = ConstantsCore.DataTypes.Tags, EditorAlias = Constants.PropertyEditors.Aliases.Tags, DbType = "Ntext", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.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 = 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", + _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", 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 = ConstantsCore.DataTypes.DefaultMediaListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.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 = ConstantsCore.DataTypes.DefaultMembersListView, EditorAlias = Constants.PropertyEditors.Aliases.ListView, DbType = "Nvarchar", + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = Constants.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 = ConstantsCore.ObjectTypes.Document, ParentObjectType = ConstantsCore.ObjectTypes.Document, Dual = true, Name = Constants.Conventions.RelationTypes.RelateDocumentOnCopyName }; + 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 }; 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 = ConstantsCore.ObjectTypes.Document, ParentObjectType = ConstantsCore.ObjectTypes.Document, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentDocumentOnDeleteName }; + 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.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 = ConstantsCore.ObjectTypes.Media, ParentObjectType = ConstantsCore.ObjectTypes.Media, Dual = false, Name = Constants.Conventions.RelationTypes.RelateParentMediaFolderOnDeleteName }; + 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.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 3eeaa28f1e..e8fd3414ec 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(ConstantsCore.System.UmbracoUpgradePlanName) + : base(Constants.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[ConstantsCore.AppSettings.ConfigurationStatus], out var currentVersion)) - throw new InvalidOperationException($"Could not get current version from web.config {ConstantsCore.AppSettings.ConfigurationStatus} appSetting."); + 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."); // 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 d3dbf66b44..309f8acbc3 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 = ConstantsCore.ObjectTypes.DataType, + NodeObjectType = Constants.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(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)"); + 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)"); 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(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\"}"); + 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\"}"); // flip known property types var labelPropertyTypes = Database.Fetch(Sql() .Select(x => x.Id, x => x.Alias) .From() - .Where(x => x.DataTypeId == ConstantsCore.DataTypes.LabelString) + .Where(x => x.DataTypeId == Constants.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, 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)); + 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)); // 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/AddVariationTables1A.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs index 34648d402a..a60e8c149c 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/AddVariationTables1A.cs @@ -37,7 +37,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 // name, languageId are now non-nullable AlterColumn(Constants.DatabaseSchema.Tables.ContentVersionCultureVariation, "name"); - AlterColumn(Constants.DatabaseSchema.Tables.ContentVersionCultureVariation, "languageId"); + AlterColumn(Constants.DatabaseSchema.Tables.ContentVersionCultureVariation, "languageId"); Create.Table().Do(); } diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs index 87a1fd6504..a8ebc768fc 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/MarkdownEditorPreValueMigrator.cs @@ -7,7 +7,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes { public override bool CanMigrate(string editorAlias) => editorAlias == Constants.PropertyEditors.Aliases.MarkdownEditor; - + protected override object GetPreValueValue(PreValueDto preValue) { if (preValue.Alias == "preview") diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs index 3670c52c64..a5c037c859 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/DataTypes/RichTextPreValueMigrator.cs @@ -18,4 +18,4 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes return preValue.Value.DetectIsJson() ? JsonConvert.DeserializeObject(preValue.Value) : preValue.Value; } } -} \ No newline at end of file +} 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 643550f2a3..2f22a8edf7 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 @@ -13,7 +13,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 Rename.Table("cmsMedia").To(Constants.DatabaseSchema.Tables.MediaVersion).Do(); // that is not supported on SqlCE - //Rename.Column("versionId").OnTable(Constants.DatabaseSchema.Tables.MediaVersion).To("id").Do(); + //Rename.Column("versionId").OnTable(ConstantsCore.DatabaseSchema.Tables.MediaVersion).To("id").Do(); AddColumn("id", out var sqls); @@ -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='{ConstantsCore.ObjectTypes.Media}'"); +WHERE n.nodeObjectType='{Constants.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/Migrations/Upgrade/V_8_0_0/SuperZero.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/SuperZero.cs index 9026f15fc1..8791cdc208 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/SuperZero.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/SuperZero.cs @@ -18,13 +18,13 @@ insert into umbracoUser (id, userDisabled, userNoConsole, userName, userLogin, userPassword, passwordConfig, userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate, - lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate, + lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate, createDate, updateDate, avatar, tourData) select -1 id, userDisabled, userNoConsole, userName, substring(userLogin, 1, len(userLogin) - 2) userLogin, userPassword, passwordConfig, userEmail, userLanguage, securityStampToken, failedLoginAttempts, lastLockoutDate, - lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate, + lastPasswordChangeDate, lastLoginDate, emailConfirmedDate, invitedDate, createDate, updateDate, avatar, tourData from umbracoUser where id=0;"); Database.Execute("set identity_insert umbracoUser off;"); diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/TagsMigrationFix.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/TagsMigrationFix.cs index 4ee95c9f58..057715269d 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/TagsMigrationFix.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/TagsMigrationFix.cs @@ -13,4 +13,4 @@ Delete.Column("ParentId").FromTable(Constants.DatabaseSchema.Tables.Tag).Do(); } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Core/Models/DataTypeExtensions.cs b/src/Umbraco.Core/Models/DataTypeExtensions.cs index 84e9932ef2..c2116c6c45 100644 --- a/src/Umbraco.Core/Models/DataTypeExtensions.cs +++ b/src/Umbraco.Core/Models/DataTypeExtensions.cs @@ -38,36 +38,36 @@ namespace Umbraco.Core.Models private static readonly ISet IdsOfBuildInDataTypes = new HashSet() { - 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, + 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, }; /// diff --git a/src/Umbraco.Core/Models/EntityContainer.cs b/src/Umbraco.Core/Models/EntityContainer.cs index 54182a0aae..70f6cbd878 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 { - { ConstantsCore.ObjectTypes.DataType, ConstantsCore.ObjectTypes.DataTypeContainer }, - { ConstantsCore.ObjectTypes.DocumentType, ConstantsCore.ObjectTypes.DocumentTypeContainer }, - { ConstantsCore.ObjectTypes.MediaType, ConstantsCore.ObjectTypes.MediaTypeContainer } + { Constants.ObjectTypes.DataType, Constants.ObjectTypes.DataTypeContainer }, + { Constants.ObjectTypes.DocumentType, Constants.ObjectTypes.DocumentTypeContainer }, + { Constants.ObjectTypes.MediaType, Constants.ObjectTypes.MediaTypeContainer } }; /// diff --git a/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs b/src/Umbraco.Core/Models/Identity/IdentityMapDefinition.cs index b43f0bf81a..57e1c9ee5c 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(ConstantsCore.Security.EmptyPasswordPrefix) ? null : storedPass; + return storedPass.StartsWith(Constants.Security.EmptyPasswordPrefix) ? null : storedPass; } } } diff --git a/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs b/src/Umbraco.Core/Models/Membership/UserGroupExtensions.cs index 46f132e2ea..b1d0189c56 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 == ConstantsCore.Security.AdminGroupAlias - || groupAlias == ConstantsCore.Security.SensitiveDataGroupAlias - || groupAlias == ConstantsCore.Security.TranslatorGroupAlias; + return groupAlias == Constants.Security.AdminGroupAlias + || groupAlias == Constants.Security.SensitiveDataGroupAlias + || groupAlias == Constants.Security.TranslatorGroupAlias; } } } diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs index 40af478ab8..401803bdec 100644 --- a/src/Umbraco.Core/Models/PropertyType.cs +++ b/src/Umbraco.Core/Models/PropertyType.cs @@ -381,7 +381,7 @@ namespace Umbraco.Core.Models private static string SanitizeAlias(string value) { //NOTE: WE are doing this because we don't want to do a ToSafeAlias when the alias is the special case of - // being prefixed with Constants.PropertyEditors.InternalGenericPropertiesPrefix + // being prefixed with ConstantsCore.PropertyEditors.InternalGenericPropertiesPrefix // which is used internally return value.StartsWith(Constants.PropertyEditors.InternalGenericPropertiesPrefix) diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs index e39d917517..b11e991118 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", 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 }, + { "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 }, }; #region Content type diff --git a/src/Umbraco.Core/Models/UmbracoObjectTypes.cs b/src/Umbraco.Core/Models/UmbracoObjectTypes.cs index dd3b5d9aca..5449318e7a 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(ConstantsCore.ObjectTypes.Strings.SystemRoot)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.SystemRoot)] [FriendlyName("Root")] ROOT, /// /// Document /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Document, typeof(IContent))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Document, typeof(IContent))] [FriendlyName("Document")] [UmbracoUdiType(Constants.UdiEntityType.Document)] Document, @@ -33,7 +33,7 @@ namespace Umbraco.Core.Models /// /// Media /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Media, typeof(IMedia))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Media, typeof(IMedia))] [FriendlyName("Media")] [UmbracoUdiType(Constants.UdiEntityType.Media)] Media, @@ -41,7 +41,7 @@ namespace Umbraco.Core.Models /// /// Member Type /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MemberType, typeof(IMemberType))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.MemberType, typeof(IMemberType))] [FriendlyName("Member Type")] [UmbracoUdiType(Constants.UdiEntityType.MemberType)] MemberType, @@ -49,7 +49,7 @@ namespace Umbraco.Core.Models /// /// Template /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Template, typeof(ITemplate))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Template, typeof(ITemplate))] [FriendlyName("Template")] [UmbracoUdiType(Constants.UdiEntityType.Template)] Template, @@ -57,7 +57,7 @@ namespace Umbraco.Core.Models /// /// Member Group /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MemberGroup)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.MemberGroup)] [FriendlyName("Member Group")] [UmbracoUdiType(Constants.UdiEntityType.MemberGroup)] MemberGroup, @@ -65,7 +65,7 @@ namespace Umbraco.Core.Models /// /// "Media Type /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MediaType, typeof(IMediaType))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.MediaType, typeof(IMediaType))] [FriendlyName("Media Type")] [UmbracoUdiType(Constants.UdiEntityType.MediaType)] MediaType, @@ -73,7 +73,7 @@ namespace Umbraco.Core.Models /// /// Document Type /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DocumentType, typeof(IContentType))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentType, typeof(IContentType))] [FriendlyName("Document Type")] [UmbracoUdiType(Constants.UdiEntityType.DocumentType)] DocumentType, @@ -81,14 +81,14 @@ namespace Umbraco.Core.Models /// /// Recycle Bin /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.ContentRecycleBin)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.ContentRecycleBin)] [FriendlyName("Recycle Bin")] RecycleBin, /// /// Stylesheet /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Stylesheet)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Stylesheet)] [FriendlyName("Stylesheet")] [UmbracoUdiType(Constants.UdiEntityType.Stylesheet)] Stylesheet, @@ -96,7 +96,7 @@ namespace Umbraco.Core.Models /// /// Member /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Member, typeof(IMember))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Member, typeof(IMember))] [FriendlyName("Member")] [UmbracoUdiType(Constants.UdiEntityType.Member)] Member, @@ -104,7 +104,7 @@ namespace Umbraco.Core.Models /// /// Data Type /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DataType, typeof(IDataType))] + [UmbracoObjectType(Constants.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(ConstantsCore.ObjectTypes.Strings.DocumentTypeContainer)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentTypeContainer)] [FriendlyName("Document Type Container")] [UmbracoUdiType(Constants.UdiEntityType.DocumentTypeContainer)] DocumentTypeContainer, @@ -120,7 +120,7 @@ namespace Umbraco.Core.Models /// /// Media type container /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.MediaTypeContainer)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.MediaTypeContainer)] [FriendlyName("Media Type Container")] [UmbracoUdiType(Constants.UdiEntityType.MediaTypeContainer)] MediaTypeContainer, @@ -128,7 +128,7 @@ namespace Umbraco.Core.Models /// /// Media type container /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DataTypeContainer)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.DataTypeContainer)] [FriendlyName("Data Type Container")] [UmbracoUdiType(Constants.UdiEntityType.DataTypeContainer)] DataTypeContainer, @@ -136,7 +136,7 @@ namespace Umbraco.Core.Models /// /// Relation type /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.RelationType)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.RelationType)] [FriendlyName("Relation Type")] [UmbracoUdiType(Constants.UdiEntityType.RelationType)] RelationType, @@ -144,35 +144,35 @@ namespace Umbraco.Core.Models /// /// Forms Form /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsForm)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsForm)] [FriendlyName("Form")] FormsForm, /// /// Forms PreValue /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsPreValue)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsPreValue)] [FriendlyName("PreValue")] FormsPreValue, /// /// Forms DataSource /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.FormsDataSource)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.FormsDataSource)] [FriendlyName("DataSource")] FormsDataSource, /// /// Language /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.Language)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.Language)] [FriendlyName("Language")] Language, /// /// Document Blueprint /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.DocumentBlueprint, typeof(IContent))] + [UmbracoObjectType(Constants.ObjectTypes.Strings.DocumentBlueprint, typeof(IContent))] [FriendlyName("DocumentBlueprint")] [UmbracoUdiType(Constants.UdiEntityType.DocumentBlueprint)] DocumentBlueprint, @@ -180,7 +180,7 @@ namespace Umbraco.Core.Models /// /// Reserved Identifier /// - [UmbracoObjectType(ConstantsCore.ObjectTypes.Strings.IdReservation)] + [UmbracoObjectType(Constants.ObjectTypes.Strings.IdReservation)] [FriendlyName("Identifier Reservation")] IdReservation diff --git a/src/Umbraco.Core/Models/UserExtensions.cs b/src/Umbraco.Core/Models/UserExtensions.cs index 0b1ffad587..6e77ee456d 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 == ConstantsCore.Security.SuperUserId; + return user.Id == Constants.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 == ConstantsCore.Security.AdminGroupAlias); + return user.Groups != null && user.Groups.Any(x => x.Alias == Constants.Security.AdminGroupAlias); } /// @@ -151,46 +151,46 @@ namespace Umbraco.Core.Models internal static bool HasContentRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RootString, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); } internal static bool HasContentBinAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RecycleBinContentString, user.CalculateContentStartNodeIds(entityService), ConstantsCore.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinContentString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent); } internal static bool HasMediaRootAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RootString, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia); } internal static bool HasMediaBinAccess(this IUser user, IEntityService entityService) { - return ContentPermissionsHelper.HasPathAccess(ConstantsCore.System.RecycleBinMediaString, user.CalculateMediaStartNodeIds(entityService), ConstantsCore.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinMediaString, user.CalculateMediaStartNodeIds(entityService), Constants.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), ConstantsCore.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(content.Path, user.CalculateContentStartNodeIds(entityService), Constants.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), ConstantsCore.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(media.Path, user.CalculateMediaStartNodeIds(entityService), Constants.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), ConstantsCore.System.RecycleBinContent); + return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateContentStartNodeIds(entityService), Constants.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), ConstantsCore.System.RecycleBinMedia); + return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateMediaStartNodeIds(entityService), Constants.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 == ConstantsCore.Security.SensitiveDataGroupAlias); + return user.Groups != null && user.Groups.Any(x => x.Alias == Constants.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 = ConstantsCore.System.Root + ","; + var binPath = Constants.System.Root + ","; switch (objectType) { case UmbracoObjectTypes.Document: - binPath += ConstantsCore.System.RecycleBinContent; + binPath += Constants.System.RecycleBinContent; break; case UmbracoObjectTypes.Media: - binPath += ConstantsCore.System.RecycleBinMedia; + binPath += Constants.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[ConstantsCore.System.Root] = ConstantsCore.System.RootString; // entityService does not get that one + paths[Constants.System.Root] = Constants.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 48c3ad6fbd..f4c4066d61 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 = ConstantsCore.DeploySelector.This) + public NamedUdiRange(Udi udi, string selector = Constants.DeploySelector.This) : base(udi, selector) { } @@ -20,7 +20,7 @@ /// A . /// A name. /// An optional selector. - public NamedUdiRange(Udi udi, string name, string selector = ConstantsCore.DeploySelector.This) + public NamedUdiRange(Udi udi, string name, string selector = Constants.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 f82f0a7498..434e0393cd 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 ?? ConstantsCore.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? Constants.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 ?? ConstantsCore.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? Constants.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 ?? ConstantsCore.Security.UnknownUserId; - content.WriterId = contentVersionDto.UserId ?? ConstantsCore.Security.UnknownUserId; + content.CreatorId = nodeDto.UserId ?? Constants.Security.UnknownUserId; + content.WriterId = contentVersionDto.UserId ?? Constants.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, ConstantsCore.ObjectTypes.Media); + var contentDto = BuildContentDto(entity, Constants.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, ConstantsCore.ObjectTypes.Member); + var contentDto = BuildContentDto(entity, Constants.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 2cac044adc..54cfee0ffa 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 ?? ConstantsCore.Security.UnknownUserId; + entity.CreatorId = dto.NodeDto.UserId ?? Constants.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 = ConstantsCore.ObjectTypes.DocumentType; + nodeObjectType = Constants.ObjectTypes.DocumentType; else if (entity is IMediaType) - nodeObjectType = ConstantsCore.ObjectTypes.MediaType; + nodeObjectType = Constants.ObjectTypes.MediaType; else if (entity is IMemberType) - nodeObjectType = ConstantsCore.ObjectTypes.MemberType; + nodeObjectType = Constants.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 ea5482aaca..f189d38d05 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 ?? ConstantsCore.Security.UnknownUserId; + dataType.CreatorId = dto.NodeDto.UserId ?? Constants.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 = ConstantsCore.ObjectTypes.DataType, + NodeObjectType = Constants.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 56b6240073..cb73f3b3aa 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 = ConstantsCore.ObjectTypes.MemberGroup; + _nodeObjectTypeId = Constants.ObjectTypes.MemberGroup; } #region Implementation of IEntityFactory diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs index 33dabe1b24..9d9482fedb 100644 --- a/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/PropertyFactory.cs @@ -163,7 +163,7 @@ namespace Umbraco.Core.Persistence.Factories if (entityVariesByCulture && !sameValues) { - if (isCultureValue) + if (isCultureValue) { editedCultures.Add(propertyValue.Culture); // report culture as edited } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/AuditRepository.cs index 5cea6a8a1b..0788594e3a 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 ?? ConstantsCore.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters); + : new AuditItem(dto.NodeId, Enum.Parse(dto.Header), dto.UserId ?? Constants.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 ?? ConstantsCore.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); + return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? Constants.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 ?? ConstantsCore.Security.UnknownUserId, x.EntityType, x.Comment, x.Parameters)).ToList(); + return dtos.Select(x => new AuditItem(x.NodeId, Enum.Parse(x.Header), x.UserId ?? Constants.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 ?? ConstantsCore.Security.UnknownUserId, dto.EntityType, dto.Comment, dto.Parameters)).ToList(); + dto => new AuditItem(dto.NodeId, Enum.ParseOrNull(dto.Header) ?? AuditType.Custom, dto.UserId ?? Constants.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 67a494b24c..5e7c7a9b85 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 == ConstantsCore.ObjectTypes.IdReservation) + tsql.Select(x => x.NodeId).From().Where(x => x.UniqueId == SqlTemplate.Arg("uniqueId") && x.NodeObjectType == Constants.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 aa50baa2a2..5409c54190 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 == ConstantsCore.ObjectTypes.MediaType) + if (contentTypeDto.NodeDto.NodeObjectType == Constants.ObjectTypes.MediaType) contentType = ContentTypeFactory.BuildMediaTypeEntity(contentTypeDto); - else if (contentTypeDto.NodeDto.NodeObjectType == ConstantsCore.ObjectTypes.DocumentType) + else if (contentTypeDto.NodeDto.NodeObjectType == Constants.ObjectTypes.DocumentType) contentType = ContentTypeFactory.BuildContentTypeEntity(contentTypeDto); - else if (contentTypeDto.NodeDto.NodeObjectType == ConstantsCore.ObjectTypes.MemberType) + else if (contentTypeDto.NodeDto.NodeObjectType == Constants.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); @@ -202,7 +202,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement .AndBy(x => x.SortOrder, x => x.Id); var propertyDtos = Database.Fetch(sql2); - var builtinProperties = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var builtinProperties = ConventionsHelper.GetStandardPropertyTypeStubs(); var groupIx = 0; var propertyIx = 0; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepository.cs index ba90ad6f26..359b967dab 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 => ConstantsCore.ObjectTypes.DocumentType; + protected override Guid NodeObjectTypeId => Constants.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 a654fb60a3..c22d1f1200 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 = ConstantsCore.System.Root; + var parentId = Constants.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 ? ConstantsCore.System.RootString : container.Path) + "," + moving.Id; + moving.Path = (container == null ? Constants.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 == ConstantsCore.ObjectTypes.Document) + .Where(x => x.NodeObjectType == Constants.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 1eaddfc427..752b641bc3 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, ConstantsCore.ObjectTypes.DataTypeContainer) + : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DataTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs index 7b715d650a..d41fbc3c2b 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 => ConstantsCore.ObjectTypes.DataType; + protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DataType; #endregion diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentBlueprintRepository.cs index 64737d0749..d137d7ac76 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 => ConstantsCore.ObjectTypes.DocumentBlueprint; + protected override Guid NodeObjectTypeId => Constants.ObjectTypes.DocumentBlueprint; } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs index 7985c04243..700ae04fd8 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 => ConstantsCore.ObjectTypes.Document; + protected override Guid NodeObjectTypeId => Constants.ObjectTypes.Document; protected override IContent PerformGet(int id) { @@ -471,12 +471,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement entity.ResetDirtyProperties(); // troubleshooting - //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1) + //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {ConstantsCore.DatabaseSchema.Tables.DocumentVersion} JOIN {ConstantsCore.DatabaseSchema.Tables.ContentVersion} ON {ConstantsCore.DatabaseSchema.Tables.DocumentVersion}.id={ConstantsCore.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1) //{ // Debugger.Break(); // throw new Exception("oops"); //} - //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1) + //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {ConstantsCore.DatabaseSchema.Tables.DocumentVersion} JOIN {ConstantsCore.DatabaseSchema.Tables.ContentVersion} ON {ConstantsCore.DatabaseSchema.Tables.DocumentVersion}.id={ConstantsCore.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1) //{ // Debugger.Break(); // throw new Exception("oops"); @@ -676,12 +676,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement entity.ResetDirtyProperties(); // troubleshooting - //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1) + //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {ConstantsCore.DatabaseSchema.Tables.DocumentVersion} JOIN {ConstantsCore.DatabaseSchema.Tables.ContentVersion} ON {ConstantsCore.DatabaseSchema.Tables.DocumentVersion}.id={ConstantsCore.DatabaseSchema.Tables.ContentVersion}.id WHERE published=1 AND nodeId=" + content.Id) > 1) //{ // Debugger.Break(); // throw new Exception("oops"); //} - //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {Constants.DatabaseSchema.Tables.DocumentVersion} JOIN {Constants.DatabaseSchema.Tables.ContentVersion} ON {Constants.DatabaseSchema.Tables.DocumentVersion}.id={Constants.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1) + //if (Database.ExecuteScalar($"SELECT COUNT(*) FROM {ConstantsCore.DatabaseSchema.Tables.DocumentVersion} JOIN {ConstantsCore.DatabaseSchema.Tables.ContentVersion} ON {ConstantsCore.DatabaseSchema.Tables.DocumentVersion}.id={ConstantsCore.DatabaseSchema.Tables.ContentVersion}.id WHERE [current]=1 AND nodeId=" + content.Id) > 1) //{ // Debugger.Break(); // throw new Exception("oops"); @@ -863,7 +863,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Recycle Bin - public override int RecycleBinId => ConstantsCore.System.RecycleBinContent; + public override int RecycleBinId => Constants.System.RecycleBinContent; #endregion diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentTypeContainerRepository.cs index ba66575041..d50981e036 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, ConstantsCore.ObjectTypes.DocumentTypeContainer) + : base(scopeAccessor, cache, logger, Constants.ObjectTypes.DocumentTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityContainerRepository.cs index 8f5518a0ee..09fe949df1 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[] { ConstantsCore.ObjectTypes.DocumentTypeContainer, ConstantsCore.ObjectTypes.MediaTypeContainer, ConstantsCore.ObjectTypes.DataTypeContainer }; + var allowedContainers = new[] { Constants.ObjectTypes.DocumentTypeContainer, Constants.ObjectTypes.MediaTypeContainer, Constants.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 ?? ConstantsCore.Security.UnknownUserId); + nodeDto.Text, nodeDto.UserId ?? Constants.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 5e14d52f42..09c427e230 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 == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == ConstantsCore.ObjectTypes.Media; - var isMember = objectType == ConstantsCore.ObjectTypes.Member; + var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == Constants.ObjectTypes.Media; + var isMember = objectType == Constants.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 == ConstantsCore.ObjectTypes.Document || objectTypeId == ConstantsCore.ObjectTypes.DocumentBlueprint; - var isMedia = objectTypeId == ConstantsCore.ObjectTypes.Media; - var isMember = objectTypeId == ConstantsCore.ObjectTypes.Member; + var isContent = objectTypeId == Constants.ObjectTypes.Document || objectTypeId == Constants.ObjectTypes.DocumentBlueprint; + var isMedia = objectTypeId == Constants.ObjectTypes.Media; + var isMember = objectTypeId == Constants.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 == ConstantsCore.ObjectTypes.Document || objectTypeId == ConstantsCore.ObjectTypes.DocumentBlueprint; - var isMedia = objectTypeId == ConstantsCore.ObjectTypes.Media; - var isMember = objectTypeId == ConstantsCore.ObjectTypes.Member; + var isContent = objectTypeId == Constants.ObjectTypes.Document || objectTypeId == Constants.ObjectTypes.DocumentBlueprint; + var isMedia = objectTypeId == Constants.ObjectTypes.Media; + var isMember = objectTypeId == Constants.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 == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == ConstantsCore.ObjectTypes.Media; - var isMember = objectType == ConstantsCore.ObjectTypes.Member; + var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == Constants.ObjectTypes.Media; + var isMember = objectType == Constants.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 == ConstantsCore.ObjectTypes.Document || objectType == ConstantsCore.ObjectTypes.DocumentBlueprint; - var isMedia = objectType == ConstantsCore.ObjectTypes.Media; - var isMember = objectType == ConstantsCore.ObjectTypes.Member; + var isContent = objectType == Constants.ObjectTypes.Document || objectType == Constants.ObjectTypes.DocumentBlueprint; + var isMedia = objectType == Constants.ObjectTypes.Media; + var isMember = objectType == Constants.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 ?? ConstantsCore.Security.UnknownUserId; + entity.CreatorId = dto.UserId ?? Constants.Security.UnknownUserId; entity.Id = dto.NodeId; entity.Key = dto.UniqueId; entity.Level = dto.Level; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs index a905294417..8a0290f9d6 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/LanguageRepository.cs @@ -186,7 +186,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { //if the iso code is changing, ensure there's not another lang with the same code already assigned var sameCode = Sql() - .SelectCount() + .SelectCount() .From() .Where(x => x.IsoCode == entity.IsoCode && x.Id != entity.Id); @@ -269,7 +269,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return null; } - + // fast way of getting an isoCode for an id - avoiding cloning // _idCodeMap is rebuilt whenever PerformGetAll runs public string GetIsoCodeById(int? id, bool throwOnNotFound = true) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs index 14fc2abab1..9b9a738301 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 => ConstantsCore.ObjectTypes.Media; + protected override Guid NodeObjectTypeId => Constants.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 => ConstantsCore.System.RecycleBinMedia; + public override int RecycleBinId => Constants.System.RecycleBinMedia; #endregion diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeContainerRepository.cs index 5b9a17af61..68b33e989d 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, ConstantsCore.ObjectTypes.MediaTypeContainer) + : base(scopeAccessor, cache, logger, Constants.ObjectTypes.MediaTypeContainer) { } } } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaTypeRepository.cs index 374b0462a5..512011b52c 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 => ConstantsCore.ObjectTypes.MediaType; + protected override Guid NodeObjectTypeId => Constants.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 82b99f6a8e..c138550de5 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 => ConstantsCore.ObjectTypes.MemberGroup; + protected override Guid NodeObjectTypeId => Constants.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 = ConstantsCore.ObjectTypes.Member; + var memberObjectType = Constants.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 bbafcaac24..0f7984a1bd 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 => ConstantsCore.ObjectTypes.Member; + protected override Guid NodeObjectTypeId => Constants.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 = ConstantsCore.Security.EmptyPasswordPrefix + aspHasher.HashPassword(Guid.NewGuid().ToString("N")); + dto.Password = Constants.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 c92e093a72..5ee9c9be08 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 => ConstantsCore.ObjectTypes.MemberType; + protected override Guid NodeObjectTypeId => Constants.ObjectTypes.MemberType; protected override void PersistNewItem(IMemberType entity) { @@ -138,12 +138,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement //set a default icon if one is not specified if (entity.Icon.IsNullOrWhiteSpace()) { - entity.Icon = ConstantsCore.Icons.Member; + entity.Icon = Constants.Icons.Member; } //By Convention we add 9 standard PropertyTypes to an Umbraco MemberType entity.AddPropertyGroup(Constants.Conventions.Member.StandardPropertiesGroupName); - var standardPropertyTypes = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var standardPropertyTypes = ConventionsHelper.GetStandardPropertyTypeStubs(); foreach (var standardPropertyType in standardPropertyTypes) { entity.AddPropertyType(standardPropertyType.Value, Constants.Conventions.Member.StandardPropertiesGroupName); @@ -206,7 +206,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected override PropertyType CreatePropertyType(string propertyEditorAlias, ValueStorageType storageType, string propertyTypeAlias) { //custom property type constructor logic to set explicit dbtype's for built in properties - var builtinProperties = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var builtinProperties = ConventionsHelper.GetStandardPropertyTypeStubs(); var readonlyStorageType = builtinProperties.TryGetValue(propertyTypeAlias, out var propertyType); storageType = readonlyStorageType ? propertyType.ValueStorageType : storageType; return new PropertyType(propertyEditorAlias, storageType, readonlyStorageType, propertyTypeAlias); @@ -219,7 +219,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement /// private static void EnsureExplicitDataTypeForBuiltInProperties(IContentTypeBase memberType) { - var builtinProperties = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var builtinProperties = ConventionsHelper.GetStandardPropertyTypeStubs(); foreach (var propertyType in memberType.PropertyTypes) { if (builtinProperties.ContainsKey(propertyType.Alias)) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs index bdac18c4da..87564b9ac9 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 ConstantsCore.ObjectTypes.Document; + return Constants.ObjectTypes.Document; case TaggableObjectTypes.Media: - return ConstantsCore.ObjectTypes.Media; + return Constants.ObjectTypes.Media; case TaggableObjectTypes.Member: - return ConstantsCore.ObjectTypes.Member; + return Constants.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 47a219e1b7..b348317989 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 => ConstantsCore.ObjectTypes.Template; + protected override Guid NodeObjectTypeId => Constants.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 25ecd1b3c8..13422f43b1 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(ConstantsCore.System.UmbracoConnectionName, logger, mappers) + : this(Constants.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[ConstantsCore.AppSettings.Debug.DatabaseFactoryServerVersion]; + var setting = ConfigurationManager.AppSettings[Constants.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 5d7489c535..dbb2fc467e 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 = ConstantsCore.Icons.PropertyEditor; + Icon = Constants.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 ce2c302af8..821f06513e 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; } = ConstantsCore.Icons.PropertyEditor; + public string Icon { get; set; } = Constants.Icons.PropertyEditor; /// /// Gets or sets an optional group. diff --git a/src/Umbraco.Core/PropertyEditors/LabelConfigurationEditor.cs b/src/Umbraco.Core/PropertyEditors/LabelConfigurationEditor.cs index e323cbbb6f..fc87929385 100644 --- a/src/Umbraco.Core/PropertyEditors/LabelConfigurationEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/LabelConfigurationEditor.cs @@ -25,4 +25,4 @@ namespace Umbraco.Core.PropertyEditors return newConfiguration; } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Core/Runtime/CoreInitialComposer.cs b/src/Umbraco.Core/Runtime/CoreInitialComposer.cs index 9156eb9b97..1f004846d0 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[ConstantsCore.AppSettings.DisableElectionForSingleServer]); + var singleServer = "true".InvariantEquals(ConfigurationManager.AppSettings[Constants.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 5bde2c2e60..7c3e835a77 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 == ConstantsCore.Security.SessionIdClaimType)) + if (user.Identity is ClaimsIdentity claimsIdentity && claimsIdentity.IsAuthenticated && claimsIdentity.HasClaim(x => x.Type == Constants.Security.SessionIdClaimType)) { try { diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs index d183ca0edb..085a7b7a5b 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 = ConstantsCore.Security.EmptyPasswordPrefix + + var emptyPasswordValue = Constants.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 9b57ebf7e2..1a329fcdcb 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 == ConstantsCore.System.Root) + if (nodeId == Constants.System.Root) hasPathAccess = user.HasContentRootAccess(entityService); - else if (nodeId == ConstantsCore.System.RecycleBinContent) + else if (nodeId == Constants.System.RecycleBinContent) hasPathAccess = user.HasContentBinAccess(entityService); if (hasPathAccess.HasValue) @@ -151,9 +151,9 @@ namespace Umbraco.Core.Security bool? hasPathAccess = null; contentItem = null; - if (nodeId == ConstantsCore.System.Root) + if (nodeId == Constants.System.Root) hasPathAccess = user.HasContentRootAccess(entityService); - else if (nodeId == ConstantsCore.System.RecycleBinContent) + else if (nodeId == Constants.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(ConstantsCore.System.Root)) + if (startNodeIds.Contains(Constants.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(ConstantsCore.System.Root)) + if (startNodeIds.Contains(Constants.System.Root)) { hasPathAccess = true; return true; diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index 28920d0e78..633e12bcc1 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(ConstantsCore.Security.EmptyPasswordPrefix) == false) + if (rawPassword.Success == false || rawPasswordValue.StartsWith(Constants.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(ConstantsCore.Security.EmptyPasswordPrefix) + && (rawPasswordValue.StartsWith(Constants.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 6c99ff262b..367e6f5c5a 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[ConstantsCore.Security.UserMembershipProviderName] == null) + if (Membership.Providers[Constants.Security.UserMembershipProviderName] == null) { - throw new InvalidOperationException("No membership provider found with name " + ConstantsCore.Security.UserMembershipProviderName); + throw new InvalidOperationException("No membership provider found with name " + Constants.Security.UserMembershipProviderName); } - return Membership.Providers[ConstantsCore.Security.UserMembershipProviderName]; + return Membership.Providers[Constants.Security.UserMembershipProviderName]; } /// diff --git a/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs b/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs index 4872f09dd3..09798efa83 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(), ConstantsCore.Security.BackOfficeAuthenticationType) //this ctor is used to ensure the IsAuthenticated property is true + : base(Enumerable.Empty(), Constants.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, ConstantsCore.Security.BackOfficeAuthenticationType) + : base(childIdentity.Claims, Constants.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, ConstantsCore.Security.BackOfficeAuthenticationType) + : base(identity.Claims, Constants.Security.BackOfficeAuthenticationType) { Actor = identity; @@ -107,7 +107,7 @@ namespace Umbraco.Core.Security } } - public const string Issuer = ConstantsCore.Security.BackOfficeAuthenticationType; + public const string Issuer = Constants.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, - ConstantsCore.Security.StartContentNodeIdClaimType, - ConstantsCore.Security.StartMediaNodeIdClaimType, + Constants.Security.StartContentNodeIdClaimType, + Constants.Security.StartMediaNodeIdClaimType, ClaimTypes.Locality, - ConstantsCore.Security.SessionIdClaimType, + Constants.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 == ConstantsCore.Security.StartContentNodeIdClaimType) == false && startContentNodes != null) + if (HasClaim(x => x.Type == Constants.Security.StartContentNodeIdClaimType) == false && startContentNodes != null) { foreach (var startContentNode in startContentNodes) { - AddClaim(new Claim(ConstantsCore.Security.StartContentNodeIdClaimType, startContentNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); + AddClaim(new Claim(Constants.Security.StartContentNodeIdClaimType, startContentNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); } } - if (HasClaim(x => x.Type == ConstantsCore.Security.StartMediaNodeIdClaimType) == false && startMediaNodes != null) + if (HasClaim(x => x.Type == Constants.Security.StartMediaNodeIdClaimType) == false && startMediaNodes != null) { foreach (var startMediaNode in startMediaNodes) { - AddClaim(new Claim(ConstantsCore.Security.StartMediaNodeIdClaimType, startMediaNode.ToInvariantString(), ClaimValueTypes.Integer32, Issuer, Issuer, this)); + AddClaim(new Claim(Constants.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 == ConstantsCore.Security.SessionIdClaimType) == false && SessionId.IsNullOrWhiteSpace() == false) - AddClaim(new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, 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)); //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 == ConstantsCore.Security.AllowedApplicationsClaimType) == false && allowedApps != null) + if (HasClaim(x => x.Type == Constants.Security.AllowedApplicationsClaimType) == false && allowedApps != null) { foreach (var application in allowedApps) { - AddClaim(new Claim(ConstantsCore.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this)); + AddClaim(new Claim(Constants.Security.AllowedApplicationsClaimType, application, ClaimValueTypes.String, Issuer, Issuer, this)); } } @@ -203,13 +203,13 @@ namespace Umbraco.Core.Security public override string AuthenticationType => Issuer; 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()); + 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[] _startMediaNodes; - 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()); + 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()); private string[] _allowedApplications; - public string[] AllowedApplications => _allowedApplications ?? (_allowedApplications = FindAll(x => x.Type == ConstantsCore.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToArray()); + public string[] AllowedApplications => _allowedApplications ?? (_allowedApplications = FindAll(x => x.Type == Constants.Security.AllowedApplicationsClaimType).Select(app => app.Value).ToArray()); public int Id => int.Parse(this.FindFirstValue(ClaimTypes.NameIdentifier)); @@ -221,13 +221,13 @@ namespace Umbraco.Core.Security public string SessionId { - get => this.FindFirstValue(ConstantsCore.Security.SessionIdClaimType); + get => this.FindFirstValue(Constants.Security.SessionIdClaimType); set { - var existing = FindFirst(ConstantsCore.Security.SessionIdClaimType); + var existing = FindFirst(Constants.Security.SessionIdClaimType); if (existing != null) TryRemoveClaim(existing); - AddClaim(new Claim(ConstantsCore.Security.SessionIdClaimType, value, ClaimValueTypes.String, Issuer, Issuer, this)); + AddClaim(new Claim(Constants.Security.SessionIdClaimType, value, ClaimValueTypes.String, Issuer, Issuer, this)); } } diff --git a/src/Umbraco.Core/Services/ContentServiceExtensions.cs b/src/Umbraco.Core/Services/ContentServiceExtensions.cs index ef8398a0e4..dfe02ba690 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 = ConstantsCore.Security.SuperUserId) + public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string contentTypeAlias, int userId = Constants.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(ConstantsCore.System.RecycleBinContent) > 0; + return contentService.CountChildren(Constants.System.RecycleBinContent) > 0; } /// @@ -107,7 +107,7 @@ namespace Umbraco.Core.Services /// public static bool RecycleBinSmells(this IMediaService mediaService) { - return mediaService.CountChildren(ConstantsCore.System.RecycleBinMedia) > 0; + return mediaService.CountChildren(Constants.System.RecycleBinMedia) > 0; } } } diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index ee01987be5..94f514b28b 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 = ConstantsCore.Security.SuperUserId); + void SaveBlueprint(IContent content, int userId = Constants.Security.SuperUserId); /// /// Deletes a blueprint. /// - void DeleteBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId); + void DeleteBlueprint(IContent content, int userId = Constants.Security.SuperUserId); /// /// Creates a new content item from a blueprint. /// - IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = ConstantsCore.Security.SuperUserId); + IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = Constants.Security.SuperUserId); /// /// Deletes blueprints for a content type. /// - void DeleteBlueprintsOfType(int contentTypeId, int userId = ConstantsCore.Security.SuperUserId); + void DeleteBlueprintsOfType(int contentTypeId, int userId = Constants.Security.SuperUserId); /// /// Deletes blueprints for content types. /// - void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = ConstantsCore.Security.SuperUserId); + void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId); #endregion @@ -238,13 +238,13 @@ namespace Umbraco.Core.Services /// /// Saves a document. /// - OperationResult Save(IContent content, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + OperationResult Save(IContent content, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); /// /// Saves documents. /// // TODO: why only 1 result not 1 per content?! - OperationResult Save(IEnumerable contents, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + OperationResult Save(IEnumerable contents, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + OperationResult Delete(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteOfType(int documentTypeId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId); /// /// Deletes versions of a document prior to a given date. /// - void DeleteVersions(int id, DateTime date, int userId = ConstantsCore.Security.SuperUserId); + void DeleteVersions(int id, DateTime date, int userId = Constants.Security.SuperUserId); /// /// Deletes a version of a document. /// - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = ConstantsCore.Security.SuperUserId); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void Move(IContent content, int parentId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = Constants.Security.SuperUserId); /// /// Moves a document to the recycle bin. /// - OperationResult MoveToRecycleBin(IContent content, int userId = ConstantsCore.Security.SuperUserId); + OperationResult MoveToRecycleBin(IContent content, int userId = Constants.Security.SuperUserId); /// /// Empties the recycle bin. @@ -324,17 +324,17 @@ 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 = ConstantsCore.Security.SuperUserId); + OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId); /// /// Sorts documents. /// - OperationResult Sort(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + OperationResult Sort(IEnumerable items, int userId = Constants.Security.SuperUserId, bool raiseEvents = true); /// /// Sorts documents. /// - OperationResult Sort(IEnumerable ids, int userId = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + OperationResult Sort(IEnumerable ids, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, string[] cultures, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.Security.SuperUserId); ///// ///// Saves and publishes a document branch. @@ -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 = ConstantsCore.Security.SuperUserId); + PublishResult Unpublish(IContent content, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + bool SendToPublication(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = Constants.Security.SuperUserId); /// /// Creates a document. /// - IContent Create(string name, int parentId, string documentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); + IContent Create(string name, int parentId, string documentTypeAlias, int userId = Constants.Security.SuperUserId); /// /// Creates a document. /// - IContent Create(string name, IContent parent, string documentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); + IContent Create(string name, IContent parent, string documentTypeAlias, int userId = Constants.Security.SuperUserId); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); + IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = Constants.Security.SuperUserId); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = ConstantsCore.Security.SuperUserId); + IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = Constants.Security.SuperUserId); #endregion @@ -523,7 +523,7 @@ namespace Umbraco.Core.Services /// /// When no culture is specified, all cultures are rolled back. /// - OperationResult Rollback(int id, int versionId, string culture = "*", int userId = ConstantsCore.Security.SuperUserId); + OperationResult Rollback(int id, int versionId, string culture = "*", int userId = Constants.Security.SuperUserId); #endregion diff --git a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs index e51d099d1c..51e5d756eb 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 = ConstantsCore.Security.SuperUserId); - void Save(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId); + void Save(TItem item, int userId = Constants.Security.SuperUserId); + void Save(IEnumerable items, int userId = Constants.Security.SuperUserId); - void Delete(TItem item, int userId = ConstantsCore.Security.SuperUserId); - void Delete(IEnumerable item, int userId = ConstantsCore.Security.SuperUserId); + void Delete(TItem item, int userId = Constants.Security.SuperUserId); + void Delete(IEnumerable item, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); - Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId); + Attempt> CreateContainer(int parentContainerId, string name, int userId = Constants.Security.SuperUserId); + Attempt SaveContainer(EntityContainer container, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); - Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId); + Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId); + Attempt> RenameContainer(int id, string name, int userId = Constants.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 97f3a9fcb7..bedf6fdfad 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -17,15 +17,15 @@ namespace Umbraco.Core.Services /// IReadOnlyDictionary> GetReferences(int id); - Attempt> CreateContainer(int parentId, string name, int userId = ConstantsCore.Security.SuperUserId); - Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId); + Attempt> CreateContainer(int parentId, string name, int userId = Constants.Security.SuperUserId); + Attempt SaveContainer(EntityContainer container, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); - Attempt> RenameContainer(int id, string name, int userId = ConstantsCore.Security.SuperUserId); + Attempt DeleteContainer(int containerId, int userId = Constants.Security.SuperUserId); + Attempt> RenameContainer(int id, string name, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void Save(IDataType dataType, int userId = Constants.Security.SuperUserId); /// /// Saves a collection of /// /// to save /// Id of the user issuing the save - void Save(IEnumerable dataTypeDefinitions, int userId = ConstantsCore.Security.SuperUserId); + void Save(IEnumerable dataTypeDefinitions, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void Delete(IDataType dataType, int userId = Constants.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 2bfb354020..5fe52559ee 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 = 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); + 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); 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 = ConstantsCore.Security.SuperUserId); + void SaveStylesheet(Stylesheet stylesheet, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteStylesheet(string path, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void SaveScript(Script script, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteScript(string path, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void SaveTemplate(ITemplate template, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = Constants.Security.SuperUserId); - ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = ConstantsCore.Security.SuperUserId); + ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteTemplate(string alias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void SaveTemplate(IEnumerable templates, int userId = Constants.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 ecd4433045..019e07493a 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 = ConstantsCore.Security.SuperUserId); + void Save(IDictionaryItem dictionaryItem, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void Delete(IDictionaryItem dictionaryItem, int userId = Constants.Security.SuperUserId); /// /// Gets a by its id @@ -153,14 +153,14 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the language - void Save(ILanguage language, int userId = ConstantsCore.Security.SuperUserId); + void Save(ILanguage language, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void Delete(ILanguage language, int userId = Constants.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 7ccd107861..597c986f37 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 = ConstantsCore.Security.SuperUserId); + void Delete(IMacro macro, int userId = Constants.Security.SuperUserId); /// /// Saves an /// /// to save /// Optional id of the user saving the macro - void Save(IMacro macro, int userId = ConstantsCore.Security.SuperUserId); + void Save(IMacro macro, int userId = Constants.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 0ba6e79aa1..48345bc88c 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 = ConstantsCore.Security.SuperUserId); + IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + Attempt Move(IMedia media, int parentId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + Attempt MoveToRecycleBin(IMedia media, int userId = Constants.Security.SuperUserId); /// /// Empties the Recycle Bin by deleting all that resides in the bin @@ -170,7 +170,7 @@ 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 = ConstantsCore.Security.SuperUserId); + OperationResult EmptyRecycleBin(int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteMediaOfType(int mediaTypeId, int userId = Constants.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,7 +186,7 @@ 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 = ConstantsCore.Security.SuperUserId); + void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + Attempt Delete(IMedia media, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + Attempt Save(IMedia media, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + Attempt Save(IEnumerable medias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteVersions(int id, DateTime versionDate, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = Constants.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 9d00632f8d..b38b5a426b 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 = ConstantsCore.Security.SuperUserId); + IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.Security.SuperUserId); /// /// Uninstalls all versions of the package by name @@ -43,7 +43,7 @@ namespace Umbraco.Core.Services /// /// /// - UninstallationSummary UninstallPackage(string packageName, int userId = ConstantsCore.Security.SuperUserId); + UninstallationSummary UninstallPackage(string packageName, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteInstalledPackage(int packageId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId); + void DeleteCreatedPackage(int id, int userId = Constants.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 d3366e1f5e..590e73f75d 100644 --- a/src/Umbraco.Core/Services/IdkMap.cs +++ b/src/Umbraco.Core/Services/IdkMap.cs @@ -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 = ConstantsCore.ObjectTypes.IdReservation }); + new { id = key, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservation }); } scope.Complete(); } @@ -207,7 +207,7 @@ namespace Umbraco.Core.Services if (guidUdi == null) return Attempt.Fail(); - var umbracoType = Constants.UdiEntityType.ToUmbracoObjectType(guidUdi.EntityType); + var umbracoType = UdiEntityTypeHelper.ToUmbracoObjectType(guidUdi.EntityType); return GetIdForKey(guidUdi.Guid, umbracoType); } @@ -215,7 +215,7 @@ namespace Umbraco.Core.Services { var keyAttempt = GetKeyForId(id, umbracoObjectType); return keyAttempt - ? Attempt.Succeed(new GuidUdi(Constants.UdiEntityType.FromUmbracoObjectType(umbracoObjectType), keyAttempt.Result)) + ? Attempt.Succeed(new GuidUdi(UdiEntityTypeHelper.FromUmbracoObjectType(umbracoObjectType), keyAttempt.Result)) : Attempt.Fail(); } @@ -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 = ConstantsCore.ObjectTypes.IdReservation }); + new { id, type = GetNodeObjectTypeGuid(umbracoObjectType), reservation = Constants.ObjectTypes.IdReservation }); } scope.Complete(); } diff --git a/src/Umbraco.Core/Services/Implement/AuditService.cs b/src/Umbraco.Core/Services/Implement/AuditService.cs index 79a5a239d6..5eb08f2dea 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 == ConstantsCore.System.Root || entityId <= 0) + if (entityId == Constants.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 != ConstantsCore.Security.SuperUserId) throw new ArgumentOutOfRangeException(nameof(performingUserId)); + if (performingUserId < 0 && performingUserId != Constants.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 37768d661e..8e3b2d07b5 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -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 = ConstantsCore.Security.SuperUserId) + public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent Create(string name, int parentId, string contentTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = Constants.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 = ConstantsCore.System.RootString; + var rootId = Constants.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 != ConstantsCore.System.Root) + if (id != Constants.System.Root) { - var contentPath = _entityRepository.GetAllPaths(ConstantsCore.ObjectTypes.Document, id).ToArray(); + var contentPath = _entityRepository.GetAllPaths(Constants.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 == ConstantsCore.System.Root || content.ParentId == ConstantsCore.System.RecycleBinContent) + if (content.ParentId == Constants.System.Root || content.ParentId == Constants.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 == ConstantsCore.System.Root); + var query = Query().Where(x => x.ParentId == Constants.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(ConstantsCore.System.RecycleBinContentPathPrefix)); + var query = Query().Where(x => x.Path.StartsWith(Constants.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 == ConstantsCore.System.Root) return true; // root content is always publishable + if (content.ParentId == Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Save(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Save(IEnumerable contents, int userId = Constants.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, ConstantsCore.System.Root, "Saved multiple content"); + Audit(AuditType.Save, userId == -1 ? 0 : userId, Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public PublishResult Unpublish(IContent content, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + int userId = Constants.Security.SuperUserId, bool raiseEvents = true) { using (var scope = ScopeProvider.CreateScope()) { @@ -1089,7 +1089,7 @@ namespace Umbraco.Core.Services.Implement /// private PublishResult CommitDocumentChangesInternal(IScope scope, IContent content, ContentSavingEventArgs saveEventArgs, IReadOnlyCollection allLangs, - int userId = ConstantsCore.Security.SuperUserId, + int userId = Constants.Security.SuperUserId, bool raiseEvents = true, bool branchOne = false, bool branchRoot = false) { if (scope == null) throw new ArgumentNullException(nameof(scope)); @@ -1533,7 +1533,7 @@ namespace Umbraco.Core.Services.Implement } /// - public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = ConstantsCore.Security.SuperUserId) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteVersions(int id, DateTime versionDate, int userId = Constants.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, ConstantsCore.System.Root, "Delete (by version date)"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.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, ConstantsCore.System.Root, "Delete (by version)"); + Audit(AuditType.Delete, userId, Constants.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, ConstantsCore.System.RecycleBinContent); + var moveEventInfo = new MoveEventInfo(content, originalPath, Constants.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, ConstantsCore.System.RecycleBinContent, null, userId, moves, true); + PerformMoveLocked(content, Constants.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 = ConstantsCore.Security.SuperUserId) + public void Move(IContent content, int parentId, int userId = Constants.Security.SuperUserId) { // if moving to the recycle bin then use the proper method - if (parentId == ConstantsCore.System.RecycleBinContent) + if (parentId == Constants.System.RecycleBinContent) { MoveToRecycleBin(content, userId); return; @@ -1931,8 +1931,8 @@ namespace Umbraco.Core.Services.Implement { scope.WriteLock(Constants.Locks.ContentTree); - var parent = parentId == ConstantsCore.System.Root ? null : GetById(parentId); - if (parentId != ConstantsCore.System.Root && (parent == null || parent.Trashed)) + var parent = parentId == Constants.System.Root ? null : GetById(parentId); + if (parentId != Constants.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 == ConstantsCore.System.RecycleBinContent ? "-1,-20" : ConstantsCore.System.RootString) : parent.Path) + "," + content.Id; + paths[content.Id] = (parent == null ? (parentId == Constants.System.RecycleBinContent ? "-1,-20" : Constants.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(ConstantsCore.Security.SuperUserId); + public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.Security.SuperUserId); /// /// Empties the Recycle Bin by deleting all that resides in the bin /// - public OperationResult EmptyRecycleBin(int userId = ConstantsCore.Security.SuperUserId) + public OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId) { - var nodeObjectType = ConstantsCore.ObjectTypes.Document; + var nodeObjectType = Constants.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 == ConstantsCore.System.RecycleBinContent); + var query = Query().Where(x => x.ParentId == Constants.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, ConstantsCore.System.RecycleBinContent, "Recycle bin emptied"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public bool SendToPublication(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Sort(IEnumerable items, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public OperationResult Sort(IEnumerable ids, int userId = Constants.Security.SuperUserId, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); @@ -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 == ConstantsCore.System.Root || IsPathPublished(GetParent(content)); + var pathIsOk = content.ParentId == Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = Constants.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, ConstantsCore.System.RecycleBinContent, null, userId, moves, true); + PerformMoveLocked(child, Constants.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, ConstantsCore.System.Root, $"Delete content of type {string.Join(",", contentTypeIdsA)}"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteOfType(int contentTypeId, int userId = Constants.Security.SuperUserId) { DeleteOfTypes(new[] { contentTypeId }, userId); } @@ -2936,7 +2936,7 @@ namespace Umbraco.Core.Services.Implement } } - public void SaveBlueprint(IContent content, int userId = ConstantsCore.Security.SuperUserId) + public void SaveBlueprint(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteBlueprint(IContent content, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -3063,7 +3063,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfType(int contentTypeId, int userId = ConstantsCore.Security.SuperUserId) + public void DeleteBlueprintsOfType(int contentTypeId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public OperationResult Rollback(int id, int versionId, string culture = "*", int userId = Constants.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeService.cs index 98907cc081..206f11e5b0 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 => ConstantsCore.ObjectTypes.DocumentType; + protected override Guid ContainedObjectType => Constants.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 abb107f8ea..705a876d83 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 = ConstantsCore.Security.SuperUserId) + public void Save(TItem item, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -419,7 +419,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Save(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId) + public void Save(IEnumerable items, int userId = Constants.Security.SuperUserId) { var itemsA = items.ToArray(); @@ -465,7 +465,7 @@ namespace Umbraco.Core.Services.Implement #region Delete - public void Delete(TItem item, int userId = ConstantsCore.Security.SuperUserId) + public void Delete(TItem item, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -519,7 +519,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Delete(IEnumerable items, int userId = ConstantsCore.Security.SuperUserId) + public void Delete(IEnumerable items, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt> CreateContainer(int parentId, string name, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); @@ -874,7 +874,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt DeleteContainer(int containerId, int userId = ConstantsCore.Security.SuperUserId) + public Attempt DeleteContainer(int containerId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt> RenameContainer(int id, string name, int userId = Constants.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 26b87de7eb..5a93fb91b1 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 = ConstantsCore.Security.SuperUserId) + public Attempt> CreateContainer(int parentId, string name, int userId = Constants.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) { try { - var container = new EntityContainer(ConstantsCore.ObjectTypes.DataType) + var container = new EntityContainer(Constants.ObjectTypes.DataType) { Name = name, ParentId = parentId, @@ -119,13 +119,13 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = ConstantsCore.Security.SuperUserId) + public Attempt SaveContainer(EntityContainer container, int userId = Constants.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); - if (container.ContainedObjectType != ConstantsCore.ObjectTypes.DataType) + if (container.ContainedObjectType != Constants.ObjectTypes.DataType) { - var ex = new InvalidOperationException("Not a " + ConstantsCore.ObjectTypes.DataType + " container."); + var ex = new InvalidOperationException("Not a " + Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt DeleteContainer(int containerId, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt> RenameContainer(int id, string name, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Save(IDataType dataType, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Save(IEnumerable dataTypeDefinitions, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Delete(IDataType dataType, int userId = Constants.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 8eed5402f7..04e2624592 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 != ConstantsCore.System.Root) + if (id != Constants.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 != ConstantsCore.System.Root)) + if (idsA.All(x => x != Constants.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 == ConstantsCore.System.Root) continue; + if (id == Constants.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 == ConstantsCore.ObjectTypes.IdReservation); + .Where(x => x.UniqueId == key && x.NodeObjectType == Constants.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 = ConstantsCore.ObjectTypes.IdReservation, + NodeObjectType = Constants.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 0e1e051b36..524986a440 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 = ConstantsCore.Security.SuperUserId) + public void SaveStylesheet(Stylesheet stylesheet, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteStylesheet(string path, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void SaveScript(Script script, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteScript(string path, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = Constants.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 @@ -403,7 +403,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// - public ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = ConstantsCore.Security.SuperUserId) + public ITemplate CreateTemplateWithIdentity(string name, string alias, string content, ITemplate masterTemplate = null, int userId = Constants.Security.SuperUserId) { // file might already be on disk, if so grab the content to avoid overwriting var template = new Template(name, alias) @@ -537,7 +537,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveTemplate(ITemplate template, int userId = ConstantsCore.Security.SuperUserId) + public void SaveTemplate(ITemplate template, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void SaveTemplate(IEnumerable templates, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteTemplate(string alias, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -731,17 +731,17 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) + public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId) { return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId); } - public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) + public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = Constants.Security.SuperUserId) { return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId); } - private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = ConstantsCore.Security.SuperUserId) + private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = Constants.Security.SuperUserId) { string partialViewHeader; switch (partialViewType) @@ -807,17 +807,17 @@ namespace Umbraco.Core.Services.Implement return Attempt.Succeed(partialView); } - public bool DeletePartialView(string path, int userId = ConstantsCore.Security.SuperUserId) + public bool DeletePartialView(string path, int userId = Constants.Security.SuperUserId) { return DeletePartialViewMacro(path, PartialViewType.PartialView, userId); } - public bool DeletePartialViewMacro(string path, int userId = ConstantsCore.Security.SuperUserId) + public bool DeletePartialViewMacro(string path, int userId = Constants.Security.SuperUserId) { return DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId); } - private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = ConstantsCore.Security.SuperUserId) + private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt SavePartialView(IPartialView partialView, int userId = Constants.Security.SuperUserId) { return SavePartialView(partialView, PartialViewType.PartialView, userId); } - public Attempt SavePartialViewMacro(IPartialView partialView, int userId = ConstantsCore.Security.SuperUserId) + public Attempt SavePartialViewMacro(IPartialView partialView, int userId = Constants.Security.SuperUserId) { return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId); } - private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = ConstantsCore.Security.SuperUserId) + private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/LocalizationService.cs b/src/Umbraco.Core/Services/Implement/LocalizationService.cs index 25fe95dd70..251261cfc8 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 = ConstantsCore.Security.SuperUserId) + public void Save(IDictionaryItem dictionaryItem, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Delete(IDictionaryItem dictionaryItem, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Save(ILanguage language, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Delete(ILanguage language, int userId = Constants.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 40234a13e4..a6631aae4c 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 = ConstantsCore.Security.SuperUserId) + public void Delete(IMacro macro, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void Save(IMacro macro, int userId = Constants.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 5bac40cec5..edb9983c97 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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = Constants.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 = ConstantsCore.System.RootString; + var rootId = Constants.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 != ConstantsCore.System.Root) + if (id != Constants.System.Root) { - var mediaPath = _entityRepository.GetAllPaths(ConstantsCore.ObjectTypes.Media, id).ToArray(); + var mediaPath = _entityRepository.GetAllPaths(Constants.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 == ConstantsCore.System.Root || media.ParentId == ConstantsCore.System.RecycleBinMedia) + if (media.ParentId == Constants.System.Root || media.ParentId == Constants.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 == ConstantsCore.System.Root); + var query = Query().Where(x => x.ParentId == Constants.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(ConstantsCore.System.RecycleBinMediaPathPrefix)); + var query = Query().Where(x => x.Path.StartsWith(Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public Attempt Save(IMedia media, int userId = Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public Attempt Save(IEnumerable medias, int userId = Constants.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, ConstantsCore.System.Root, "Bulk save media"); + Audit(AuditType.Save, userId == -1 ? 0 : userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt Delete(IMedia media, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteVersions(int id, DateTime versionDate, int userId = Constants.Security.SuperUserId) { using (var scope = ScopeProvider.CreateScope()) { @@ -812,7 +812,7 @@ namespace Umbraco.Core.Services.Implement // return; //} - //uow.WriteLock(Constants.Locks.MediaTree); + //uow.WriteLock(ConstantsCore.Locks.MediaTree); //var repository = uow.CreateRepository(); //repository.DeleteVersions(id, versionDate); @@ -823,7 +823,7 @@ namespace Umbraco.Core.Services.Implement } } - private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = ConstantsCore.Security.SuperUserId) + private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = Constants.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, ConstantsCore.System.Root, "Delete Media by version date"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = Constants.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, ConstantsCore.System.Root, "Delete Media by version"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt MoveToRecycleBin(IMedia media, int userId = Constants.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, ConstantsCore.System.RecycleBinMedia); + var moveEventInfo = new MoveEventInfo(media, originalPath, Constants.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, ConstantsCore.System.RecycleBinMedia, null, userId, moves, true); + PerformMoveLocked(media, Constants.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 = ConstantsCore.Security.SuperUserId) + public Attempt Move(IMedia media, int parentId, int userId = Constants.Security.SuperUserId) { var evtMsgs = EventMessagesFactory.Get(); // if moving to the recycle bin then use the proper method - if (parentId == ConstantsCore.System.RecycleBinMedia) + if (parentId == Constants.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 == ConstantsCore.System.Root ? null : GetById(parentId); - if (parentId != ConstantsCore.System.Root && (parent == null || parent.Trashed)) + var parent = parentId == Constants.System.Root ? null : GetById(parentId); + if (parentId != Constants.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 == ConstantsCore.System.RecycleBinMedia ? "-1,-21" : ConstantsCore.System.RootString) : parent.Path) + "," + media.Id; + paths[media.Id] = (parent == null ? (parentId == Constants.System.RecycleBinMedia ? "-1,-21" : Constants.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(ConstantsCore.Security.SuperUserId); + public OperationResult EmptyRecycleBin() => EmptyRecycleBin(Constants.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 = ConstantsCore.Security.SuperUserId) + public OperationResult EmptyRecycleBin(int userId = Constants.Security.SuperUserId) { - var nodeObjectType = ConstantsCore.ObjectTypes.Media; + var nodeObjectType = Constants.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 == ConstantsCore.System.RecycleBinMedia); + var query = Query().Where(x => x.ParentId == Constants.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, ConstantsCore.System.RecycleBinMedia, "Empty Media recycle bin"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = Constants.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, ConstantsCore.System.RecycleBinMedia, null, userId, moves, true); + PerformMoveLocked(child, Constants.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, ConstantsCore.System.Root, $"Delete Media of types {string.Join(",", mediaTypeIdsA)}"); + Audit(AuditType.Delete, userId, Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteMediaOfType(int mediaTypeId, int userId = Constants.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 9f61cc637f..8cb69a655d 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 => ConstantsCore.ObjectTypes.MediaType; + protected override Guid ContainedObjectType => Constants.ObjectTypes.MediaType; protected override void DeleteItemsOfTypes(IEnumerable typeIds) { diff --git a/src/Umbraco.Core/Services/Implement/MemberService.cs b/src/Umbraco.Core/Services/Implement/MemberService.cs index 8c69664712..e475881e48 100644 --- a/src/Umbraco.Core/Services/Implement/MemberService.cs +++ b/src/Umbraco.Core/Services/Implement/MemberService.cs @@ -331,7 +331,7 @@ namespace Umbraco.Core.Services.Implement saveEventArgs.CanCancel = false; scope.Events.Dispatch(Saved, this, saveEventArgs); } - + if (withIdentity == false) return; @@ -1241,7 +1241,7 @@ namespace Umbraco.Core.Services.Implement /// Exports a member. /// /// - /// This is internal for now and is used to export a member in the member editor, + /// This is internal for now and is used to export a member in the member editor, /// it will raise an event so that auditing logs can be created. /// internal MemberExportModel ExportMember(Guid key) diff --git a/src/Umbraco.Core/Services/Implement/MemberTypeService.cs b/src/Umbraco.Core/Services/Implement/MemberTypeService.cs index 1b78b26c82..05f32dc99c 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 => ConstantsCore.ObjectTypes.MemberType; + protected override Guid ContainedObjectType => Constants.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 6792a0b3d1..5f81cf8c4a 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 = ConstantsCore.Security.SuperUserId; + var id = Constants.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(), ConstantsCore.ObjectTypes.Document).ToList(); + var notifications = GetUsersNotifications(users.Select(x => x.Id), action, Enumerable.Empty(), Constants.ObjectTypes.Document).ToList(); if (notifications.Count == 0) break; var i = 0; diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index 519e2d1686..79fa2b42ed 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 = $"{ConstantsCore.PackageRepository.RestApiBaseUrl}/{packageId}?version={umbracoVersion.ToString(3)}&includeHidden=true&asFile=true"; + var url = $"{Constants.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 {ConstantsCore.PackageRepository.DefaultRepositoryId}"); + _auditService.Add(AuditType.PackagerInstall, userId, -1, "Package", $"Package {packageId} fetched from {Constants.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 = ConstantsCore.Security.SuperUserId) + public IEnumerable InstallCompiledPackageFiles(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public InstallationSummary InstallCompiledPackageData(PackageDefinition packageDefinition, FileInfo packageFile, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public UninstallationSummary UninstallPackage(string packageName, int userId = Constants.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 = ConstantsCore.Security.SuperUserId) + public void DeleteCreatedPackage(int id, int userId = Constants.Security.SuperUserId) { var package = GetCreatedPackageById(id); if (package == null) return; @@ -224,7 +224,7 @@ namespace Umbraco.Core.Services.Implement public bool SaveInstalledPackage(PackageDefinition definition) => _installedPackages.SavePackage(definition); - public void DeleteInstalledPackage(int packageId, int userId = ConstantsCore.Security.SuperUserId) + public void DeleteInstalledPackage(int packageId, int userId = Constants.Security.SuperUserId) { var package = GetInstalledPackageById(packageId); if (package == null) return; diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs index 0ea77dedcc..9266a5b8a7 100644 --- a/src/Umbraco.Core/Services/Implement/UserService.cs +++ b/src/Umbraco.Core/Services/Implement/UserService.cs @@ -17,7 +17,7 @@ using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Persistence.Repositories.Implement; using Umbraco.Core.Scoping; -using Umbraco.Core.Security; +using Umbraco.Core.Security; namespace Umbraco.Core.Services.Implement { @@ -209,7 +209,7 @@ namespace Umbraco.Core.Services.Implement //NOTE: this will not be cached return _userRepository.GetByUsername(username, includeSecurityData: false); } - + throw; } } @@ -486,14 +486,14 @@ namespace Umbraco.Core.Services.Implement //query = // Query.Builder.Where( // x => - // ((Member)x).PropertyTypeAlias == Constants.Conventions.Member.LastLoginDate && + // ((Member)x).PropertyTypeAlias == ConstantsCore.Conventions.Member.LastLoginDate && // ((Member)x).DateTimePropertyValue > fromDate); //return repository.GetCountByQuery(query); //var fromDate = DateTime.Now.AddMinutes(-Membership.UserIsOnlineTimeWindow); //query = // Query.Builder.Where( // x => - // ((Member)x).PropertyTypeAlias == Constants.Conventions.Member.LastLoginDate && + // ((Member)x).PropertyTypeAlias == ConstantsCore.Conventions.Member.LastLoginDate && // ((Member)x).DateTimePropertyValue > fromDate); //return repository.GetCountByQuery(query); case MemberCountType.LockedOut: @@ -714,7 +714,7 @@ namespace Umbraco.Core.Services.Implement //NOTE: this will not be cached return _userRepository.Get(id, includeSecurityData: false); } - + throw; } } diff --git a/src/Umbraco.Core/Udi.cs b/src/Umbraco.Core/Udi.cs index c7297b8c09..444cbda6f5 100644 --- a/src/Umbraco.Core/Udi.cs +++ b/src/Umbraco.Core/Udi.cs @@ -52,13 +52,13 @@ namespace Umbraco.Core { // initialize with known (built-in) Udi types // we will add scanned types later on - _udiTypes = new ConcurrentDictionary(Constants.UdiEntityType.GetTypes()); + _udiTypes = new ConcurrentDictionary(UdiEntityTypeHelper.GetTypes()); } // for tests, totally unsafe internal static void ResetUdiTypes() { - _udiTypes = new ConcurrentDictionary(Constants.UdiEntityType.GetTypes()); + _udiTypes = new ConcurrentDictionary(UdiEntityTypeHelper.GetTypes()); _scanned = false; } diff --git a/src/Umbraco.Core/UdiEntityType.cs b/src/Umbraco.Core/UdiEntityType.cs deleted file mode 100644 index 75a137bd2e..0000000000 --- a/src/Umbraco.Core/UdiEntityType.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core.Models; - -namespace Umbraco.Core -{ - public static partial class Constants - { - /// - /// Defines well-known entity types. - /// - /// Well-known entity types are those that Deploy already knows about, - /// but entity types are strings and so can be extended beyond what is defined here. - public static class UdiEntityType - { - // note: const fields in this class MUST be consistent with what GetTypes returns - // this is validated by UdiTests.ValidateUdiEntityType - // also, this is used exclusively in Udi static ctor, only once, so there is no - // need to keep it around in a field nor to make it readonly - - internal static Dictionary GetTypes() - { - return new Dictionary - { - { Unknown, UdiType.Unknown }, - - { AnyGuid, UdiType.GuidUdi }, - { Document, UdiType.GuidUdi }, - { DocumentBlueprint, UdiType.GuidUdi }, - { Media, UdiType.GuidUdi }, - { Member, UdiType.GuidUdi }, - { DictionaryItem, UdiType.GuidUdi }, - { Macro, UdiType.GuidUdi }, - { Template, UdiType.GuidUdi }, - { DocumentType, UdiType.GuidUdi }, - { DocumentTypeContainer, UdiType.GuidUdi }, - { DocumentTypeBluePrints, UdiType.GuidUdi }, - { MediaType, UdiType.GuidUdi }, - { MediaTypeContainer, UdiType.GuidUdi }, - { DataType, UdiType.GuidUdi }, - { DataTypeContainer, UdiType.GuidUdi }, - { MemberType, UdiType.GuidUdi }, - { MemberGroup, UdiType.GuidUdi }, - { RelationType, UdiType.GuidUdi }, - { FormsForm, UdiType.GuidUdi }, - { FormsPreValue, UdiType.GuidUdi }, - { FormsDataSource, UdiType.GuidUdi }, - - { AnyString, UdiType.StringUdi}, - { Language, UdiType.StringUdi}, - { MacroScript, UdiType.StringUdi}, - { MediaFile, UdiType.StringUdi}, - { TemplateFile, UdiType.StringUdi}, - { Script, UdiType.StringUdi}, - { PartialView, UdiType.StringUdi}, - { PartialViewMacro, UdiType.StringUdi}, - { Stylesheet, UdiType.StringUdi} - }; - } - - public const string Unknown = "unknown"; - - // guid entity types - - public const string AnyGuid = "any-guid"; // that one is for tests - - public const string Document = "document"; - - public const string DocumentBlueprint = "document-blueprint"; - - public const string Media = "media"; - public const string Member = "member"; - - public const string DictionaryItem = "dictionary-item"; - public const string Macro = "macro"; - public const string Template = "template"; - - public const string DocumentType = "document-type"; - public const string DocumentTypeContainer = "document-type-container"; - - // TODO: What is this? This alias is only used for the blue print tree to render the blueprint's document type, it's not a real udi type - public const string DocumentTypeBluePrints = "document-type-blueprints"; - public const string MediaType = "media-type"; - public const string MediaTypeContainer = "media-type-container"; - public const string DataType = "data-type"; - public const string DataTypeContainer = "data-type-container"; - public const string MemberType = "member-type"; - public const string MemberGroup = "member-group"; - - public const string RelationType = "relation-type"; - - // forms - - public const string FormsForm = "forms-form"; - public const string FormsPreValue = "forms-prevalue"; - public const string FormsDataSource = "forms-datasource"; - - // string entity types - - public const string AnyString = "any-string"; // that one is for tests - - public const string Language = "language"; - public const string MacroScript = "macroscript"; - public const string MediaFile = "media-file"; - public const string TemplateFile = "template-file"; - public const string Script = "script"; - public const string Stylesheet = "stylesheet"; - public const string PartialView = "partial-view"; - public const string PartialViewMacro = "partial-view-macro"; - - public static string FromUmbracoObjectType(UmbracoObjectTypes umbracoObjectType) - { - switch (umbracoObjectType) - { - case UmbracoObjectTypes.Document: - return Document; - case UmbracoObjectTypes.DocumentBlueprint: - return DocumentBlueprint; - case UmbracoObjectTypes.Media: - return Media; - case UmbracoObjectTypes.Member: - return Member; - case UmbracoObjectTypes.Template: - return Template; - case UmbracoObjectTypes.DocumentType: - return DocumentType; - case UmbracoObjectTypes.DocumentTypeContainer: - return DocumentTypeContainer; - case UmbracoObjectTypes.MediaType: - return MediaType; - case UmbracoObjectTypes.MediaTypeContainer: - return MediaTypeContainer; - case UmbracoObjectTypes.DataType: - return DataType; - case UmbracoObjectTypes.DataTypeContainer: - return DataTypeContainer; - case UmbracoObjectTypes.MemberType: - return MemberType; - case UmbracoObjectTypes.MemberGroup: - return MemberGroup; - case UmbracoObjectTypes.Stylesheet: - return Stylesheet; - case UmbracoObjectTypes.RelationType: - return RelationType; - case UmbracoObjectTypes.FormsForm: - return FormsForm; - case UmbracoObjectTypes.FormsPreValue: - return FormsPreValue; - case UmbracoObjectTypes.FormsDataSource: - return FormsDataSource; - case UmbracoObjectTypes.Language: - return Language; - } - throw new NotSupportedException(string.Format("UmbracoObjectType \"{0}\" does not have a matching EntityType.", umbracoObjectType)); - } - - public static UmbracoObjectTypes ToUmbracoObjectType(string entityType) - { - switch (entityType) - { - case Document: - return UmbracoObjectTypes.Document; - case DocumentBlueprint: - return UmbracoObjectTypes.DocumentBlueprint; - case Media: - return UmbracoObjectTypes.Media; - case Member: - return UmbracoObjectTypes.Member; - case Template: - return UmbracoObjectTypes.Template; - case DocumentType: - return UmbracoObjectTypes.DocumentType; - case DocumentTypeContainer: - return UmbracoObjectTypes.DocumentTypeContainer; - case MediaType: - return UmbracoObjectTypes.MediaType; - case MediaTypeContainer: - return UmbracoObjectTypes.MediaTypeContainer; - case DataType: - return UmbracoObjectTypes.DataType; - case DataTypeContainer: - return UmbracoObjectTypes.DataTypeContainer; - case MemberType: - return UmbracoObjectTypes.MemberType; - case MemberGroup: - return UmbracoObjectTypes.MemberGroup; - case Stylesheet: - return UmbracoObjectTypes.Stylesheet; - case RelationType: - return UmbracoObjectTypes.RelationType; - case FormsForm: - return UmbracoObjectTypes.FormsForm; - case FormsPreValue: - return UmbracoObjectTypes.FormsPreValue; - case FormsDataSource: - return UmbracoObjectTypes.FormsDataSource; - case Language: - return UmbracoObjectTypes.Language; - } - throw new NotSupportedException( - string.Format("EntityType \"{0}\" does not have a matching UmbracoObjectType.", entityType)); - } - } - } -} diff --git a/src/Umbraco.Core/UdiEntityTypeHelper.cs b/src/Umbraco.Core/UdiEntityTypeHelper.cs new file mode 100644 index 0000000000..6504ddc674 --- /dev/null +++ b/src/Umbraco.Core/UdiEntityTypeHelper.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; +using Umbraco.Core.Models; + +namespace Umbraco.Core +{ + public static class UdiEntityTypeHelper + { + internal static Dictionary GetTypes() => + new Dictionary + { + { Constants.UdiEntityType.Unknown, UdiType.Unknown }, + + { Constants.UdiEntityType.AnyGuid, UdiType.GuidUdi }, + { Constants.UdiEntityType.Document, UdiType.GuidUdi }, + { Constants.UdiEntityType.DocumentBlueprint, UdiType.GuidUdi }, + { Constants.UdiEntityType.Media, UdiType.GuidUdi }, + { Constants.UdiEntityType.Member, UdiType.GuidUdi }, + { Constants.UdiEntityType.DictionaryItem, UdiType.GuidUdi }, + { Constants.UdiEntityType.Macro, UdiType.GuidUdi }, + { Constants.UdiEntityType.Template, UdiType.GuidUdi }, + { Constants.UdiEntityType.DocumentType, UdiType.GuidUdi }, + { Constants.UdiEntityType.DocumentTypeContainer, UdiType.GuidUdi }, + { Constants.UdiEntityType.DocumentTypeBluePrints, UdiType.GuidUdi }, + { Constants.UdiEntityType.MediaType, UdiType.GuidUdi }, + { Constants.UdiEntityType.MediaTypeContainer, UdiType.GuidUdi }, + { Constants.UdiEntityType.DataType, UdiType.GuidUdi }, + { Constants.UdiEntityType.DataTypeContainer, UdiType.GuidUdi }, + { Constants.UdiEntityType.MemberType, UdiType.GuidUdi }, + { Constants.UdiEntityType.MemberGroup, UdiType.GuidUdi }, + { Constants.UdiEntityType.RelationType, UdiType.GuidUdi }, + { Constants.UdiEntityType.FormsForm, UdiType.GuidUdi }, + { Constants.UdiEntityType.FormsPreValue, UdiType.GuidUdi }, + { Constants.UdiEntityType.FormsDataSource, UdiType.GuidUdi }, + + { Constants.UdiEntityType.AnyString, UdiType.StringUdi }, + { Constants.UdiEntityType.Language, UdiType.StringUdi }, + { Constants.UdiEntityType.MacroScript, UdiType.StringUdi }, + { Constants.UdiEntityType.MediaFile, UdiType.StringUdi }, + { Constants.UdiEntityType.TemplateFile, UdiType.StringUdi }, + { Constants.UdiEntityType.Script, UdiType.StringUdi }, + { Constants.UdiEntityType.PartialView, UdiType.StringUdi }, + { Constants.UdiEntityType.PartialViewMacro, UdiType.StringUdi }, + { Constants.UdiEntityType.Stylesheet, UdiType.StringUdi } + }; + + public static string FromUmbracoObjectType(UmbracoObjectTypes umbracoObjectType) + { + switch (umbracoObjectType) + { + case UmbracoObjectTypes.Document: + return Constants.UdiEntityType.Document; + case UmbracoObjectTypes.DocumentBlueprint: + return Constants.UdiEntityType.DocumentBlueprint; + case UmbracoObjectTypes.Media: + return Constants.UdiEntityType.Media; + case UmbracoObjectTypes.Member: + return Constants.UdiEntityType.Member; + case UmbracoObjectTypes.Template: + return Constants.UdiEntityType.Template; + case UmbracoObjectTypes.DocumentType: + return Constants.UdiEntityType.DocumentType; + case UmbracoObjectTypes.DocumentTypeContainer: + return Constants.UdiEntityType.DocumentTypeContainer; + case UmbracoObjectTypes.MediaType: + return Constants.UdiEntityType.MediaType; + case UmbracoObjectTypes.MediaTypeContainer: + return Constants.UdiEntityType.MediaTypeContainer; + case UmbracoObjectTypes.DataType: + return Constants.UdiEntityType.DataType; + case UmbracoObjectTypes.DataTypeContainer: + return Constants.UdiEntityType.DataTypeContainer; + case UmbracoObjectTypes.MemberType: + return Constants.UdiEntityType.MemberType; + case UmbracoObjectTypes.MemberGroup: + return Constants.UdiEntityType.MemberGroup; + case UmbracoObjectTypes.Stylesheet: + return Constants.UdiEntityType.Stylesheet; + case UmbracoObjectTypes.RelationType: + return Constants.UdiEntityType.RelationType; + case UmbracoObjectTypes.FormsForm: + return Constants.UdiEntityType.FormsForm; + case UmbracoObjectTypes.FormsPreValue: + return Constants.UdiEntityType.FormsPreValue; + case UmbracoObjectTypes.FormsDataSource: + return Constants.UdiEntityType.FormsDataSource; + case UmbracoObjectTypes.Language: + return Constants.UdiEntityType.Language; + } + + throw new NotSupportedException( + $"UmbracoObjectType \"{umbracoObjectType}\" does not have a matching EntityType."); + } + + public static UmbracoObjectTypes ToUmbracoObjectType(string entityType) + { + switch (entityType) + { + case Constants.UdiEntityType.Document: + return UmbracoObjectTypes.Document; + case Constants.UdiEntityType.DocumentBlueprint: + return UmbracoObjectTypes.DocumentBlueprint; + case Constants.UdiEntityType.Media: + return UmbracoObjectTypes.Media; + case Constants.UdiEntityType.Member: + return UmbracoObjectTypes.Member; + case Constants.UdiEntityType.Template: + return UmbracoObjectTypes.Template; + case Constants.UdiEntityType.DocumentType: + return UmbracoObjectTypes.DocumentType; + case Constants.UdiEntityType.DocumentTypeContainer: + return UmbracoObjectTypes.DocumentTypeContainer; + case Constants.UdiEntityType.MediaType: + return UmbracoObjectTypes.MediaType; + case Constants.UdiEntityType.MediaTypeContainer: + return UmbracoObjectTypes.MediaTypeContainer; + case Constants.UdiEntityType.DataType: + return UmbracoObjectTypes.DataType; + case Constants.UdiEntityType.DataTypeContainer: + return UmbracoObjectTypes.DataTypeContainer; + case Constants.UdiEntityType.MemberType: + return UmbracoObjectTypes.MemberType; + case Constants.UdiEntityType.MemberGroup: + return UmbracoObjectTypes.MemberGroup; + case Constants.UdiEntityType.Stylesheet: + return UmbracoObjectTypes.Stylesheet; + case Constants.UdiEntityType.RelationType: + return UmbracoObjectTypes.RelationType; + case Constants.UdiEntityType.FormsForm: + return UmbracoObjectTypes.FormsForm; + case Constants.UdiEntityType.FormsPreValue: + return UmbracoObjectTypes.FormsPreValue; + case Constants.UdiEntityType.FormsDataSource: + return UmbracoObjectTypes.FormsDataSource; + case Constants.UdiEntityType.Language: + return UmbracoObjectTypes.Language; + } + + throw new NotSupportedException( + $"EntityType \"{entityType}\" does not have a matching UmbracoObjectType."); + } + } +} diff --git a/src/Umbraco.Core/UdiGetterExtensions.cs b/src/Umbraco.Core/UdiGetterExtensions.cs index 09dd293245..958e2c13a2 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 == ConstantsCore.ObjectTypes.DataType) + if (entity.ContainedObjectType == Constants.ObjectTypes.DataType) entityType = Constants.UdiEntityType.DataTypeContainer; - else if (entity.ContainedObjectType == ConstantsCore.ObjectTypes.DocumentType) + else if (entity.ContainedObjectType == Constants.ObjectTypes.DocumentType) entityType = Constants.UdiEntityType.DocumentTypeContainer; - else if (entity.ContainedObjectType == ConstantsCore.ObjectTypes.MediaType) + else if (entity.ContainedObjectType == Constants.ObjectTypes.MediaType) entityType = Constants.UdiEntityType.MediaTypeContainer; else throw new NotSupportedException(string.Format("Contained object type {0} is not supported.", entity.ContainedObjectType)); diff --git a/src/Umbraco.Core/UdiRange.cs b/src/Umbraco.Core/UdiRange.cs index 0493f1c880..b70cf43d18 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 = ConstantsCore.DeploySelector.This) + public UdiRange(Udi udi, string selector = Constants.DeploySelector.This) { Udi = udi; switch (selector) { - case ConstantsCore.DeploySelector.This: + case Constants.DeploySelector.This: Selector = selector; _uriValue = udi.UriValue; break; - case ConstantsCore.DeploySelector.ChildrenOfThis: - case ConstantsCore.DeploySelector.DescendantsOfThis: - case ConstantsCore.DeploySelector.ThisAndChildren: - case ConstantsCore.DeploySelector.ThisAndDescendants: + case Constants.DeploySelector.ChildrenOfThis: + case Constants.DeploySelector.DescendantsOfThis: + case Constants.DeploySelector.ThisAndChildren: + case Constants.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 58010bdf30..4f25848000 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -177,9 +177,7 @@ - - - + @@ -701,9 +699,6 @@ - - - @@ -1178,7 +1173,7 @@ - + diff --git a/src/Umbraco.Examine/ContentValueSetValidator.cs b/src/Umbraco.Examine/ContentValueSetValidator.cs index fa37a19ebb..9555566c53 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 ? ConstantsCore.System.RecycleBinContent : ConstantsCore.System.RecycleBinMedia; + var recycleBinId = category == IndexTypes.Content ? Constants.System.RecycleBinContent : Constants.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 eb28696082..f62a4ae3de 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+7b88b85c7d5ca2fbc4d07d5a8eca4de41967f335")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+3f93240d973130bcef5dd129e7841ee347eeeb06")] [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 d8f8ee50b0..fd55eba80c 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 @@ -a0aec7f73a91976a27b35551640fb5437d434107 +3efd476d872db129f0c05f7a1ad3a88faacc94f7 diff --git a/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs b/src/Umbraco.ModelsBuilder.Embedded/BackOffice/ModelsBuilderDashboardController.cs index fcaad0fafa..1d9de265e9 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.ConstantsCore.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.Constants.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 d2217df403..d6dc1f8c73 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", - ConstantsCore.DatabaseProviders.SqlServer, + Constants.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, - ConstantsCore.DatabaseProviders.SqlCe, + Constants.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 96c67d4069..2770803bea 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, ConstantsCore.DeploySelector.ChildrenOfThis); + var range = new UdiRange(stringUdi, Constants.DeploySelector.ChildrenOfThis); // cannot create invalid ranges Assert.Throws(() => new UdiRange(guidUdi, "x")); @@ -249,20 +249,20 @@ namespace Umbraco.Tests.CoreThings Assert.AreEqual(Constants.UdiEntityType.AnyGuid, dudi.EntityType); Assert.AreEqual(guid, ((GuidUdi)dudi).Guid); - var range = new UdiRange(udi, ConstantsCore.DeploySelector.ChildrenOfThis); + var range = new UdiRange(udi, Constants.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(ConstantsCore.DeploySelector.ChildrenOfThis, drange.Selector); + Assert.AreEqual(Constants.DeploySelector.ChildrenOfThis, drange.Selector); } [Test] public void ValidateUdiEntityType() { - var types = Constants.UdiEntityType.GetTypes(); + var types = UdiEntityTypeHelper.GetTypes(); foreach (var fi in typeof(Constants.UdiEntityType).GetFields(BindingFlags.Public | BindingFlags.Static)) { diff --git a/src/Umbraco.Tests/Integration/ContentEventsTests.cs b/src/Umbraco.Tests/Integration/ContentEventsTests.cs index ac46601cdf..7f103e13e4 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(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); var content = CreateContent(); Assert.IsNotNull(content); @@ -1095,7 +1095,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.MoveToRecycleBin(content); ResetEvents(); - ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.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(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.Security.SuperUserId); var content1 = CreateContent(); Assert.IsNotNull(content1); @@ -1120,7 +1120,7 @@ namespace Umbraco.Tests.Integration ServiceContext.ContentService.MoveToRecycleBin(content2); ResetEvents(); - ServiceContext.ContentService.EmptyRecycleBin(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.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(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.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(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.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, ConstantsCore.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, Constants.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, ConstantsCore.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, Constants.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, ConstantsCore.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, Constants.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, ConstantsCore.System.Root, false); + var copy = ServiceContext.ContentService.Copy(content, Constants.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 ee8785bc86..999d7f040d 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(ConstantsCore.UmbracoIndexes.InternalIndexName, out var index) ? index.GetSearcher() : null; + return eMgr.TryGetIndex(Constants.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[ConstantsCore.AppSettings.PublishedMediaCacheSeconds]; + var value = ConfigurationManager.AppSettings[Constants.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 8ba327b0a6..d83298ac8d 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 = ConstantsCore.ObjectTypes.Media, + nodeObjectType = Constants.ObjectTypes.Media, id = mediaId }); xmlDto = xmlDtos.FirstOrDefault(); @@ -486,7 +486,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = ConstantsCore.ObjectTypes.Member, + nodeObjectType = Constants.ObjectTypes.Member, id = memberId }); xmlDto = xmlDtos.FirstOrDefault(); @@ -519,7 +519,7 @@ AND (umbracoNode.id=@id)"; var xmlDtos = scope.Database.Query(sql, new { - nodeObjectType = ConstantsCore.ObjectTypes.Document, + nodeObjectType = Constants.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(ConstantsCore.ObjectTypes.Media); + return LoadMoreXmlFromDatabase(Constants.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(ConstantsCore.ObjectTypes.Member); + return LoadMoreXmlFromDatabase(Constants.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 = ConstantsCore.ObjectTypes.Document, + nodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.Document }); + new { nodeObjectType = Constants.ObjectTypes.Document }); foreach (var xmlDto in xmlDtos) { @@ -961,11 +961,11 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; using (var scope = _scopeProvider.CreateScope()) { - if (nodeObjectType == ConstantsCore.ObjectTypes.Document) + if (nodeObjectType == Constants.ObjectTypes.Document) scope.ReadLock(Constants.Locks.ContentTree); - else if (nodeObjectType == ConstantsCore.ObjectTypes.Media) + else if (nodeObjectType == Constants.ObjectTypes.Media) scope.ReadLock(Constants.Locks.MediaTree); - else if (nodeObjectType == ConstantsCore.ObjectTypes.Member) + else if (nodeObjectType == Constants.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 = ConstantsCore.ObjectTypes.Document, + nodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.Document, /*@ids =*/ ids }); + new { nodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.Document; + var contentObjectType = Constants.ObjectTypes.Document; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1723,9 +1723,9 @@ WHERE cmsContentXml.nodeId IN ( // db.Execute(@"DELETE cmsContentXml //FROM cmsContentXml //JOIN umbracoNode ON (cmsContentXml.nodeId=umbracoNode.Id) - //JOIN {Constants.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={Constants.DatabaseSchema.Tables.Content}.nodeId) + //JOIN {ConstantsCore.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={ConstantsCore.DatabaseSchema.Tables.Content}.nodeId) //WHERE umbracoNode.nodeObjectType=@objType - //AND {Constants.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", + //AND {ConstantsCore.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", db.Execute($@"DELETE FROM cmsContentXml WHERE cmsContentXml.nodeId IN ( SELECT id FROM umbracoNode @@ -1770,7 +1770,7 @@ WHERE cmsContentXml.nodeId IN ( private void RebuildPreviewXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var contentObjectType = ConstantsCore.ObjectTypes.Document; + var contentObjectType = Constants.ObjectTypes.Document; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1794,9 +1794,9 @@ WHERE cmsPreviewXml.nodeId IN ( // db.Execute(@"DELETE cmsPreviewXml //FROM cmsPreviewXml //JOIN umbracoNode ON (cmsPreviewXml.nodeId=umbracoNode.Id) - //JOIN {Constants.DatabaseSchema.Tables.Content} ON (cmsPreviewXml.nodeId={Constants.DatabaseSchema.Tables.Content}.nodeId) + //JOIN {ConstantsCore.DatabaseSchema.Tables.Content} ON (cmsPreviewXml.nodeId={ConstantsCore.DatabaseSchema.Tables.Content}.nodeId) //WHERE umbracoNode.nodeObjectType=@objType - //AND {Constants.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", + //AND {ConstantsCore.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", db.Execute($@"DELETE FROM cmsPreviewXml WHERE cmsPreviewXml.nodeId IN ( SELECT id FROM umbracoNode @@ -1817,7 +1817,7 @@ WHERE cmsPreviewXml.nodeId IN ( long total; do { - // .GetPagedResultsByQuery implicitly adds ({Constants.DatabaseSchema.Tables.Document}.newest = 1) which + // .GetPagedResultsByQuery implicitly adds ({ConstantsCore.DatabaseSchema.Tables.Document}.newest = 1) which // is what we want for preview (ie latest version of a content, published or not) var descendants = _documentRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path")); const bool published = true; // previewXml contains edit content! @@ -1845,7 +1845,7 @@ WHERE cmsPreviewXml.nodeId IN ( public void RebuildMediaXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var mediaObjectType = ConstantsCore.ObjectTypes.Media; + var mediaObjectType = Constants.ObjectTypes.Media; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1869,9 +1869,9 @@ WHERE cmsContentXml.nodeId IN ( // db.Execute(@"DELETE cmsContentXml //FROM cmsContentXml //JOIN umbracoNode ON (cmsContentXml.nodeId=umbracoNode.Id) - //JOIN {Constants.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={Constants.DatabaseSchema.Tables.Content}.nodeId) + //JOIN {ConstantsCore.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={ConstantsCore.DatabaseSchema.Tables.Content}.nodeId) //WHERE umbracoNode.nodeObjectType=@objType - //AND {Constants.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", + //AND {ConstantsCore.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", db.Execute($@"DELETE FROM cmsContentXml WHERE cmsContentXml.nodeId IN ( SELECT id FROM umbracoNode @@ -1914,7 +1914,7 @@ WHERE cmsContentXml.nodeId IN ( public void RebuildMemberXmlLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var memberObjectType = ConstantsCore.ObjectTypes.Member; + var memberObjectType = Constants.ObjectTypes.Member; var db = scope.Database; // remove all - if anything fails the transaction will rollback @@ -1938,9 +1938,9 @@ WHERE cmsContentXml.nodeId IN ( // db.Execute(@"DELETE cmsContentXml //FROM cmsContentXml //JOIN umbracoNode ON (cmsContentXml.nodeId=umbracoNode.Id) - //JOIN {Constants.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={Constants.DatabaseSchema.Tables.Content}.nodeId) + //JOIN {ConstantsCore.DatabaseSchema.Tables.Content} ON (cmsContentXml.nodeId={ConstantsCore.DatabaseSchema.Tables.Content}.nodeId) //WHERE umbracoNode.nodeObjectType=@objType - //AND {Constants.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", + //AND {ConstantsCore.DatabaseSchema.Tables.Content}.contentTypeId IN (@ctypes)", db.Execute($@"DELETE FROM cmsContentXml WHERE cmsContentXml.nodeId IN ( SELECT id FROM umbracoNode @@ -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 = ConstantsCore.ObjectTypes.Document; + var contentObjectType = Constants.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 = ConstantsCore.ObjectTypes.Media; + var mediaObjectType = Constants.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 = ConstantsCore.ObjectTypes.Member; + var memberObjectType = Constants.ObjectTypes.Member; var db = scope.Database; var count = db.ExecuteScalar(@"SELECT COUNT(*) diff --git a/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs b/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs index 6f1543285c..1c91d8a920 100644 --- a/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs +++ b/src/Umbraco.Tests/Membership/UmbracoServiceMembershipProviderTests.cs @@ -79,7 +79,7 @@ namespace Umbraco.Tests.Membership { IMember createdMember = null; var memberType = MockedContentTypes.CreateSimpleMemberType(); - foreach (var p in Constants.Conventions.Member.GetStandardPropertyTypeStubs()) + foreach (var p in ConventionsHelper.GetStandardPropertyTypeStubs()) { memberType.AddPropertyType(p.Value); } @@ -111,7 +111,7 @@ namespace Umbraco.Tests.Membership { IMember createdMember = null; var memberType = MockedContentTypes.CreateSimpleMemberType(); - foreach (var p in Constants.Conventions.Member.GetStandardPropertyTypeStubs()) + foreach (var p in ConventionsHelper.GetStandardPropertyTypeStubs()) { memberType.AddPropertyType(p.Value); } @@ -145,7 +145,7 @@ namespace Umbraco.Tests.Membership { IMember createdMember = null; var memberType = MockedContentTypes.CreateSimpleMemberType(); - foreach (var p in Constants.Conventions.Member.GetStandardPropertyTypeStubs()) + foreach (var p in ConventionsHelper.GetStandardPropertyTypeStubs()) { memberType.AddPropertyType(p.Value); } diff --git a/src/Umbraco.Tests/Models/ContentXmlTest.cs b/src/Umbraco.Tests/Models/ContentXmlTest.cs index b5c55523eb..fbef2cc103 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, ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.Save(content, Constants.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 6f7e496cbd..6a4054d5ae 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 = ConstantsCore.Security.SuperUserId; + content.CreatorId = Constants.Security.SuperUserId; } [Test] @@ -282,7 +282,7 @@ namespace Umbraco.Tests.Models.Mapping if (ownerId != 0) { Assert.IsNotNull(result.Owner); - Assert.AreEqual(ConstantsCore.Security.SuperUserId, result.Owner.UserId); + Assert.AreEqual(Constants.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(ConstantsCore.Security.SuperUserId, result.Owner.UserId); + Assert.AreEqual(Constants.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 481f43ad09..3ae9414dc1 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, ConstantsCore.Security.SuperUserId); + ServiceContext.MediaService.Save(media, Constants.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/Packaging/PackageDataInstallationTests.cs b/src/Umbraco.Tests/Packaging/PackageDataInstallationTests.cs index 51df7d1f2f..1c863bd007 100644 --- a/src/Umbraco.Tests/Packaging/PackageDataInstallationTests.cs +++ b/src/Umbraco.Tests/Packaging/PackageDataInstallationTests.cs @@ -189,7 +189,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.StandardMvc_Package; var xml = XElement.Parse(strXml); var element = xml.Descendants("Templates").First(); - + var init = ServiceContext.FileService.GetTemplates().Count(); // Act @@ -213,7 +213,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.StandardMvc_Package; var xml = XElement.Parse(strXml); var element = xml.Descendants("Templates").First(); - + // Act var templates = PackageDataInstallation.ImportTemplate(element.Elements("Template").First(), 0); @@ -233,7 +233,7 @@ namespace Umbraco.Tests.Packaging var dataTypeElement = xml.Descendants("DataTypes").First(); var templateElement = xml.Descendants("Templates").First(); var docTypeElement = xml.Descendants("DocumentTypes").First(); - + // Act var dataTypeDefinitions = PackageDataInstallation.ImportDataTypes(dataTypeElement.Elements("DataType").ToList(), 0); @@ -387,7 +387,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.XsltSearch_Package; var xml = XElement.Parse(strXml); var templateElement = xml.Descendants("Templates").First(); - + // Act var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); @@ -404,7 +404,7 @@ namespace Umbraco.Tests.Packaging // Arrange string strXml = ImportResources.SingleDocType; var docTypeElement = XElement.Parse(strXml); - + // Act var contentTypes = PackageDataInstallation.ImportDocumentType(docTypeElement, 0); @@ -421,7 +421,7 @@ namespace Umbraco.Tests.Packaging // Arrange string strXml = ImportResources.SingleDocType; var docTypeElement = XElement.Parse(strXml); - + var serializer = Factory.GetInstance(); // Act @@ -470,7 +470,7 @@ namespace Umbraco.Tests.Packaging var templateElement = newPackageXml.Descendants("Templates").First(); var templateElementUpdated = updatedPackageXml.Descendants("Templates").First(); - + var fileService = ServiceContext.FileService; // kill default test data @@ -616,7 +616,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.uBlogsy_Package; var xml = XElement.Parse(strXml); var macrosElement = xml.Descendants("Macros").First(); - + // Act var macros = PackageDataInstallation.ImportMacros(macrosElement.Elements("macro"), 0).ToList(); @@ -638,7 +638,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.XsltSearch_Package; var xml = XElement.Parse(strXml); var macrosElement = xml.Descendants("Macros").First(); - + // Act var macros = PackageDataInstallation.ImportMacros(macrosElement.Elements("macro"), 0).ToList(); @@ -662,7 +662,7 @@ namespace Umbraco.Tests.Packaging var xml = XElement.Parse(strXml); var templateElement = xml.Descendants("Templates").First(); var docTypeElement = xml.Descendants("DocumentTypes").First(); - + // Act var templates = PackageDataInstallation.ImportTemplates(templateElement.Elements("Template").ToList(), 0); @@ -690,7 +690,7 @@ namespace Umbraco.Tests.Packaging string strXml = ImportResources.CompositionsTestPackage_Random; var xml = XElement.Parse(strXml); var docTypeElement = xml.Descendants("DocumentTypes").First(); - + // Act var contentTypes = PackageDataInstallation.ImportDocumentTypes(docTypeElement.Elements("DocumentType"), 0); diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index 7965162a28..fb451b1d5c 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[ConstantsCore.System.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.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 bce662406d..9745caa8c9 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 = ConstantsCore.ObjectTypes.DocumentType; + var nodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.DocumentType; + var nodeObjectType = Constants.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 f65f05601b..ac5d6413b4 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs @@ -149,7 +149,7 @@ // 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" }); +// scope.Database.Insert(ConstantsCore.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 55555, EditorAlias = ConstantsCore.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" }); // scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsContentType")))); // scope.Database.Insert("cmsContentType", "pk", false, new ContentTypeDto { PrimaryKey = 88888, NodeId = 99999, Alias = "TestContentType", Icon = "icon-folder", Thumbnail = "folder.png", IsContainer = false, AllowAtRoot = true }); diff --git a/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs b/src/Umbraco.Tests/Persistence/Querying/DataTypeDefinitionRepositorySqlClausesTest.cs index 6abb355a2a..53bc6e5c68 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 = ConstantsCore.ObjectTypes.DataType; + var NodeObjectTypeId = Constants.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 9f1c984372..8ff0dd2a0d 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 = ConstantsCore.ObjectTypes.Media; + var nodeObjectTypeId = Constants.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 5d5e839f52..bcb62ec770 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 = ConstantsCore.ObjectTypes.MediaType; + var NodeObjectTypeId = Constants.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 59694c9424..f953b9cce6 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, ConstantsCore.ObjectTypes.DocumentTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); var repository = CreateRepository((IScopeAccessor) provider); - var container1 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah1" }; + var container1 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "blah1" }; containerRepository.Save(container1); - var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah2", ParentId = container1.Id }; + var container2 = new EntityContainer(Constants.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, ConstantsCore.ObjectTypes.DocumentTypeContainer); - var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah" }; + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); + var container = new EntityContainer(Constants.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, ConstantsCore.ObjectTypes.DocumentTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); - container1 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container1" }; + container1 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "container1" }; containerRepository.Save(container1); - container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container2" }; + container2 = new EntityContainer(Constants.ObjectTypes.DocumentType) { Name = "container2" }; containerRepository.Save(container2); - container3 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "container3" }; + container3 = new EntityContainer(Constants.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, ConstantsCore.ObjectTypes.DocumentTypeContainer); - var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType) { Name = "blah" }; + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.DocumentTypeContainer); + var container = new EntityContainer(Constants.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, ConstantsCore.ObjectTypes.MediaTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.MediaTypeContainer); var repository = CreateRepository((IScopeAccessor) provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.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, ConstantsCore.ObjectTypes.MediaTypeContainer); + var containerRepository = CreateContainerRepository((IScopeAccessor) provider, Constants.ObjectTypes.MediaTypeContainer); var repository = CreateMediaTypeRepository((IScopeAccessor) provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.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 = ConstantsCore.ObjectTypes.DocumentType}); + new {NodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.DocumentType }); + new { NodeObjectType = Constants.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 aa9daf3d65..ca8ee29ee3 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, ConstantsCore.ObjectTypes.DataTypeContainer); + return new EntityContainerRepository(scopeAccessor, AppCaches.Disabled, Logger, Constants.ObjectTypes.DataTypeContainer); } [Test] @@ -100,10 +100,10 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(accessor); var repository = CreateRepository(); - var container1 = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah1" }; + var container1 = new EntityContainer(Constants.ObjectTypes.DataType) { Name = "blah1" }; containerRepository.Save(container1); - var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DataType) { Name = "blah2", ParentId = container1.Id }; + var container2 = new EntityContainer(Constants.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(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(Constants.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(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(Constants.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(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(Constants.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(ConstantsCore.ObjectTypes.DataType) { Name = "blah" }; + var container = new EntityContainer(Constants.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(ConstantsCore.DataTypes.DropDownSingle); + var dataTypeDefinition = repository.Get(Constants.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 757f1b74e0..bc23762fa9 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, ConstantsCore.ObjectTypes.MediaTypeContainer); + return new EntityContainerRepository((IScopeAccessor) provider, AppCaches.Disabled, Logger, Constants.ObjectTypes.MediaTypeContainer); } @@ -42,11 +42,11 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container1 = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah1" }; + var container1 = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah1" }; containerRepository.Save(container1); - var container2 = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah2", ParentId = container1.Id }; + var container2 = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah2", ParentId = container1.Id }; containerRepository.Save(container2); @@ -88,7 +88,7 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); Assert.That(container.Id, Is.GreaterThan(0)); @@ -106,7 +106,7 @@ namespace Umbraco.Tests.Persistence.Repositories { var containerRepository = CreateContainerRepository(provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); Assert.That(container.Id, Is.GreaterThan(0)); @@ -129,7 +129,7 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); @@ -151,7 +151,7 @@ namespace Umbraco.Tests.Persistence.Repositories var containerRepository = CreateContainerRepository(provider); var repository = CreateRepository(provider); - var container = new EntityContainer(ConstantsCore.ObjectTypes.MediaType) { Name = "blah" }; + var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); @@ -318,7 +318,7 @@ namespace Umbraco.Tests.Persistence.Repositories int count = scope.Database.ExecuteScalar( "SELECT COUNT(*) FROM umbracoNode WHERE nodeObjectType = @NodeObjectType", - new { NodeObjectType = ConstantsCore.ObjectTypes.MediaType }); + new { NodeObjectType = Constants.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 = ConstantsCore.ObjectTypes.MediaType }); + new { NodeObjectType = Constants.ObjectTypes.MediaType }); // Assert Assert.That(mediaTypes.Any(), Is.True); diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs index 45b7c7ee62..5a3a011a74 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs @@ -174,11 +174,11 @@ namespace Umbraco.Tests.Persistence.Repositories var sut = repository.Get(member.Id); Assert.That(memberType.CompositionPropertyGroups.Count(), Is.EqualTo(2)); - Assert.That(memberType.CompositionPropertyTypes.Count(), Is.EqualTo(3 + Constants.Conventions.Member.GetStandardPropertyTypeStubs().Count)); - Assert.That(sut.Properties.Count(), Is.EqualTo(3 + Constants.Conventions.Member.GetStandardPropertyTypeStubs().Count)); + Assert.That(memberType.CompositionPropertyTypes.Count(), Is.EqualTo(3 + ConventionsHelper.GetStandardPropertyTypeStubs().Count)); + Assert.That(sut.Properties.Count(), Is.EqualTo(3 + ConventionsHelper.GetStandardPropertyTypeStubs().Count)); var grp = memberType.CompositionPropertyGroups.FirstOrDefault(x => x.Name == Constants.Conventions.Member.StandardPropertiesGroupName); Assert.IsNotNull(grp); - var aliases = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); + var aliases = ConventionsHelper.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); foreach (var p in memberType.CompositionPropertyTypes.Where(x => aliases.Contains(x.Alias))) { Assert.AreEqual(grp.Id, p.PropertyGroupId.Value); @@ -366,6 +366,6 @@ namespace Umbraco.Tests.Persistence.Repositories return sql; } - private Guid NodeObjectTypeId => ConstantsCore.ObjectTypes.Member; + private Guid NodeObjectTypeId => Constants.ObjectTypes.Member; } } diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs index 4b9f3096ce..fc5504fd6f 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs @@ -41,7 +41,7 @@ namespace Umbraco.Tests.Persistence.Repositories var sut = repository.Get(memberType.Id); - var standardProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var standardProps = ConventionsHelper.GetStandardPropertyTypeStubs(); Assert.That(sut, Is.Not.Null); Assert.That(sut.PropertyGroups.Count, Is.EqualTo(2)); @@ -236,7 +236,7 @@ namespace Umbraco.Tests.Persistence.Repositories [Test] public void Bug_Changing_Built_In_Member_Type_Property_Type_Aliases_Results_In_Exception() { - var stubs = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var stubs = ConventionsHelper.GetStandardPropertyTypeStubs(); var provider = TestObjects.GetScopeProvider(Logger); using (provider.CreateScope()) @@ -281,7 +281,7 @@ namespace Umbraco.Tests.Persistence.Repositories [Test] public void Built_In_Member_Type_Properties_Are_Automatically_Added_When_Creating() { - var stubs = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var stubs = ConventionsHelper.GetStandardPropertyTypeStubs(); var provider = TestObjects.GetScopeProvider(Logger); using (provider.CreateScope()) @@ -312,7 +312,7 @@ namespace Umbraco.Tests.Persistence.Repositories [Test] public void Built_In_Member_Type_Properties_Missing_Are_Automatically_Added_When_Creating() { - var stubs = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var stubs = ConventionsHelper.GetStandardPropertyTypeStubs(); var provider = TestObjects.GetScopeProvider(Logger); using (provider.CreateScope()) diff --git a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs index 64b5b53ce7..12fa1bb9bb 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 = ConstantsCore.ObjectTypes.ContentItem, + NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,123", SortOrder = 1, Text = "hello", Trashed = false, UniqueId = Guid.NewGuid(), - UserId = ConstantsCore.Security.SuperUserId + UserId = Constants.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 == ConstantsCore.Security.SuperUserId); + var userAdmin = Mock.Of(e => e.Id == Constants.Security.SuperUserId); for (var i = 0; i < 10; i++) { - 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 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 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 = ConstantsCore.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 = Constants.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 = ConstantsCore.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 = Constants.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 = ConstantsCore.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 = Constants.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 = ConstantsCore.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 = Constants.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 == ConstantsCore.Security.SuperUserId); + var userAdmin = Mock.Of(e => e.Id == Constants.Security.SuperUserId); for (var i = 0; i < 10; i++) { - 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 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 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 b6c82b2d97..5bec3f6585 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs @@ -260,8 +260,8 @@ namespace Umbraco.Tests.Persistence.Repositories public void CreateTestData() { - 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 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 provider = TestObjects.GetScopeProvider(Logger); using (var scope = provider.CreateScope()) diff --git a/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs index 9e6db3f297..e52e2dfcdf 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(ConstantsCore.ObjectTypes.Member, - ConstantsCore.ObjectTypes.Document, + var relateMemberToContent = new RelationType(Constants.ObjectTypes.Member, + Constants.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 = ConstantsCore.ObjectTypes.DocumentType; + var childObjType = Constants.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(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 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 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 1fe137bcc8..3e5919d7f3 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[] { ConstantsCore.Security.TranslatorGroupAlias }, + excludeUserGroups: new[] { Constants.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[] { ConstantsCore.Security.AdminGroupAlias, ConstantsCore.Security.SensitiveDataGroupAlias }, - excludeUserGroups: new[] { ConstantsCore.Security.TranslatorGroupAlias }, + includeUserGroups: new[] { Constants.Security.AdminGroupAlias, Constants.Security.SensitiveDataGroupAlias }, + excludeUserGroups: new[] { Constants.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 2fe71e7681..1d87bb35e7 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 = ConstantsCore.ObjectTypes.Media; + var mediaObjectType = Constants.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 b900550de3..8d0a544c06 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs @@ -22,7 +22,7 @@ namespace Umbraco.Tests.Routing var properties = new[] { - new PublishedPropertyType("umbracoUrlAlias", ConstantsCore.DataTypes.Textbox, false, ContentVariation.Nothing, + new PublishedPropertyType("umbracoUrlAlias", Constants.DataTypes.Textbox, false, ContentVariation.Nothing, new PropertyValueConverterCollection(Enumerable.Empty()), Mock.Of(), Mock.Of()), diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs index 6a56feaad9..60ed41593d 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests.Routing var properties = new[] { - new PublishedPropertyType("umbracoUrlAlias", ConstantsCore.DataTypes.Textbox, false, ContentVariation.Nothing, + new PublishedPropertyType("umbracoUrlAlias", Constants.DataTypes.Textbox, false, ContentVariation.Nothing, new PropertyValueConverterCollection(Enumerable.Empty()), Mock.Of(), Mock.Of()), diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs index b83f3b4ba6..691328a7df 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[ConstantsCore.AppSettings.ConfigurationStatus] = ""; + ConfigurationManager.AppSettings[Constants.AppSettings.ConfigurationStatus] = ""; // FIXME: we need a better management of settings here (and, true config files?) // create the very basic and essential things we need @@ -141,7 +141,7 @@ namespace Umbraco.Tests.Runtimes } //var databaseBuilder = factory.GetInstance(); - //databaseFactory.Configure(DatabaseBuilder.EmbeddedDatabaseConnectionString, Constants.DbProviderNames.SqlCe); + //databaseFactory.Configure(DatabaseBuilder.EmbeddedDatabaseConnectionString, ConstantsCore.DbProviderNames.SqlCe); //databaseBuilder.CreateDatabaseSchemaAndData(); if (!databaseFactory.Configured) diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index f637db83d2..2b04a02f46 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(ConstantsCore.AppSettings.ConfigurationStatus, ""); + ConfigurationManager.AppSettings.Set(Constants.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 073fcafbd5..beb2c0b3dc 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(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(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(ClaimTypes.Locality, "en-us", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, ConstantsCore.Security.SessionIdClaimType, TestIssuer, TestIssuer), + new Claim(Constants.Security.SessionIdClaimType, sessionId, Constants.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(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(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(ClaimTypes.Locality, "en-us", ClaimValueTypes.String, TestIssuer, TestIssuer), - new Claim(ConstantsCore.Security.SessionIdClaimType, sessionId, ConstantsCore.Security.SessionIdClaimType, TestIssuer, TestIssuer), + new Claim(Constants.Security.SessionIdClaimType, sessionId, Constants.Security.SessionIdClaimType, TestIssuer, TestIssuer), new Claim(ClaimsIdentity.DefaultRoleClaimType, "admin", ClaimValueTypes.String, TestIssuer, TestIssuer), }); diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index e673cfa584..4e0cc3c161 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -36,7 +36,7 @@ namespace Umbraco.Tests.Services Logger = UmbracoTestOptions.Logger.Console)] public class ContentServiceTests : TestWithSomeContentBase { - // TODO: Add test to verify there is only ONE newest document/content in {Constants.DatabaseSchema.Tables.Document} table after updating. + // TODO: Add test to verify there is only ONE newest document/content in {ConstantsCore.DatabaseSchema.Tables.Document} table after updating. // TODO: Add test to delete specific version (with and without deleting prior versions) and versions by date. public override void SetUp() @@ -68,7 +68,7 @@ namespace Umbraco.Tests.Services ServiceContext.FileService.SaveTemplate(contentType.DefaultTemplate); contentTypeService.Save(contentType); - var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", ConstantsCore.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.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", ConstantsCore.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.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", ConstantsCore.System.Root); + var blueprint = MockedContent.CreateTextpageContent(contentType, "hello", Constants.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, ConstantsCore.System.Root); + var blueprint = MockedContent.CreateTextpageContent(i % 2 == 0 ? ct1 : ct2, "hello" + i, Constants.System.Root); contentService.SaveBlueprint(blueprint); } @@ -266,10 +266,10 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); content.ContentSchedule.Add(null, DateTime.Now.AddHours(2)); - contentService.Save(content, ConstantsCore.Security.SuperUserId); + contentService.Save(content, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Save(content, Constants.Security.SuperUserId); // Assert @@ -294,7 +294,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.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", ConstantsCore.System.Root, "umbTextpage", 0)); + results.Add(contentService.CreateAndSave("Test", Constants.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", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + contentService.CreateAndSave("Test", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); } // Assert @@ -358,7 +358,7 @@ namespace Umbraco.Tests.Services // Act for (int i = 0; i < 20; i++) { - contentService.CreateAndSave("Test", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); + contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.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", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); + var parent = contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.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", ConstantsCore.System.Root, "umbBlah", ConstantsCore.Security.SuperUserId); + var parent = contentService.CreateAndSave("Test", Constants.System.Root, "umbBlah", Constants.Security.SuperUserId); // Act IContent current = parent; @@ -427,7 +427,7 @@ namespace Umbraco.Tests.Services var contentService = ServiceContext.ContentService; // Act - var content = contentService.Create("Test", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Test", Constants.System.Root, "umbTextpage", Constants.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", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Test", Constants.System.Root, "umbTextpage", Constants.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", ConstantsCore.System.Root, "umbTextpage"); + var content = contentService.Create("Test", Constants.System.Root, "umbTextpage"); // Assert Assert.That(content, Is.Not.Null); Assert.That(content.HasIdentity, Is.False); - 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 + 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 } [Test] @@ -474,7 +474,7 @@ namespace Umbraco.Tests.Services RawPasswordValue = "test" }; ServiceContext.UserService.Save(user); - var content = new Content("Test", ConstantsCore.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); + var content = new Content("Test", Constants.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", ConstantsCore.System.Root, "umbAliasDoesntExist")); + Assert.Throws(() => contentService.Create("Test", Constants.System.Root, "umbAliasDoesntExist")); } [Test] @@ -499,7 +499,7 @@ namespace Umbraco.Tests.Services { // Arrange var contentService = ServiceContext.ContentService; - var content = new Content(string.Empty, ConstantsCore.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); + var content = new Content(string.Empty, Constants.System.Root, ServiceContext.ContentTypeService.Get("umbTextpage")); // Act & Assert Assert.Throws(() => contentService.Save(content)); @@ -845,7 +845,7 @@ namespace Umbraco.Tests.Services contentType.Variations = ContentVariation.Culture; ServiceContext.ContentTypeService.Save(contentType); - IContent content = new Content("content", ConstantsCore.System.Root, contentType); + IContent content = new Content("content", Constants.System.Root, contentType); content.SetCultureName("content-fr", langFr.IsoCode); content.SetCultureName("content-en", langUk.IsoCode); @@ -947,7 +947,7 @@ namespace Umbraco.Tests.Services ServiceContext.ContentTypeService.Save(contentType); - IContent content = new Content("content", ConstantsCore.System.Root, contentType); + IContent content = new Content("content", Constants.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", ConstantsCore.System.Root, contentType); + IContent content = new Content("content", Constants.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", ConstantsCore.System.Root, contentType); + IContent content = new Content("content", Constants.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: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.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", ConstantsCore.System.Root, "umbTextpage"); + var parent = contentService.Create("parent", Constants.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: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); Assert.That(published.Success, Is.True); Assert.That(content.Published, Is.True); @@ -1281,10 +1281,10 @@ namespace Umbraco.Tests.Services contentService.Save(content); var parent = contentService.GetById(NodeDto.NodeIdSeed + 2); - var parentPublished = contentService.SaveAndPublish(parent, userId: ConstantsCore.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' + var parentPublished = contentService.SaveAndPublish(parent, userId: Constants.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' // Act - var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.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", ConstantsCore.Security.SuperUserId); + var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Save(content, Constants.Security.SuperUserId); var parent = contentService.GetById(NodeDto.NodeIdSeed + 2); - var parentPublished = contentService.SaveAndPublish(parent, userId: ConstantsCore.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' + var parentPublished = contentService.SaveAndPublish(parent, userId: Constants.Security.SuperUserId);//Publish root Home node to enable publishing of 'NodeDto.NodeIdSeed + 3' // Act - var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.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", ConstantsCore.Security.SuperUserId); + var published = ServiceContext.ContentService.SaveAndPublish(content, "en-US", Constants.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", ConstantsCore.Security.SuperUserId); - contentService.Save(content, ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Subpage with Unpublished Parent", NodeDto.NodeIdSeed + 2, "umbTextpage", Constants.Security.SuperUserId); + contentService.Save(content, Constants.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: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.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", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Home US", - 1, "umbTextpage", Constants.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.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", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - var published = contentService.SaveAndPublish(content, userId: ConstantsCore.Security.SuperUserId); - var childContent = contentService.Create("Child", content.Id, "umbTextpage", ConstantsCore.Security.SuperUserId); + var published = contentService.SaveAndPublish(content, userId: Constants.Security.SuperUserId); + var childContent = contentService.Create("Child", content.Id, "umbTextpage", Constants.Security.SuperUserId); // Reset all identity properties childContent.Id = 0; childContent.Path = null; ((Content)childContent).ResetIdentity(); - var childPublished = contentService.SaveAndPublish(childContent, userId: ConstantsCore.Security.SuperUserId); + var childPublished = contentService.SaveAndPublish(childContent, userId: Constants.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", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Home US", - 1, "umbTextpage", Constants.Security.SuperUserId); content.SetValue("author", "Barack Obama"); // Act - contentService.Save(content, ConstantsCore.Security.SuperUserId); + contentService.Save(content, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Save(list, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Save(hierarchy, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Delete(content, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.MoveToRecycleBin(content, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.Save(subsubpage, Constants.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, ConstantsCore.Security.SuperUserId); + contentService.MoveToRecycleBin(content, Constants.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(ConstantsCore.Security.SuperUserId); + contentService.EmptyRecycleBin(Constants.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(ConstantsCore.Security.SuperUserId); + contentService.EmptyRecycleBin(Constants.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, ConstantsCore.Security.SuperUserId); + ServiceContext.ContentTypeService.Save(contentType, Constants.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, ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.Save(content1, Constants.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, ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.Save(content2, Constants.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(ConstantsCore.Security.SuperUserId); + var admin = ServiceContext.UserService.GetUserById(Constants.Security.SuperUserId); admin.StartContentIds = new[] {content1.Id}; ServiceContext.UserService.Save(admin); - ServiceContext.RelationService.Save(new RelationType(ConstantsCore.ObjectTypes.Document, ConstantsCore.ObjectTypes.Document, "test")); + ServiceContext.RelationService.Save(new RelationType(Constants.ObjectTypes.Document, Constants.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(ConstantsCore.Security.SuperUserId); + var user = ServiceContext.UserService.GetUserById(Constants.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(ConstantsCore.Security.SuperUserId); + ServiceContext.ContentService.EmptyRecycleBin(Constants.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, ConstantsCore.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, Constants.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, ConstantsCore.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, true, Constants.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, ConstantsCore.Security.SuperUserId); + var copy = contentService.Copy(temp, temp.ParentId, false, false, Constants.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", ConstantsCore.System.Root); + var content = MockedContent.CreateSimpleContent(contentType, "Simple Tags Page", Constants.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", ConstantsCore.System.Root, contentType) + var page = new Content("Page", Constants.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", ConstantsCore.System.Root); + var content = MockedContent.CreateAllTypesContent(contentType, "Random Content", Constants.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, ConstantsCore.Security.SuperUserId); + contentService.DeleteVersion(NodeDto.NodeIdSeed + 5, version, true, Constants.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", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.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", ConstantsCore.System.Root, "umbTextpage", ConstantsCore.Security.SuperUserId); + var content = contentService.Create("Home US", Constants.System.Root, "umbTextpage", Constants.Security.SuperUserId); content.SetValue("author", "Barack Obama"); contentService.Save(content); @@ -2415,10 +2415,10 @@ namespace Umbraco.Tests.Services } long total; - var entities = service.GetPagedChildren(ConstantsCore.System.Root, 0, 6, out total).ToArray(); + var entities = service.GetPagedChildren(Constants.System.Root, 0, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(6)); Assert.That(total, Is.EqualTo(10)); - entities = service.GetPagedChildren(ConstantsCore.System.Root, 1, 6, out total).ToArray(); + entities = service.GetPagedChildren(Constants.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(ConstantsCore.System.Root, 0, 6, out total).ToArray(); + var entities = service.GetPagedChildren(Constants.System.Root, 0, 6, out total).ToArray(); Assert.That(entities.Length, Is.EqualTo(6)); Assert.That(total, Is.EqualTo(10)); - entities = service.GetPagedChildren(ConstantsCore.System.Root, 1, 6, out total).ToArray(); + entities = service.GetPagedChildren(Constants.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(ConstantsCore.System.Root) + var contentType = new ContentType(Constants.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", ConstantsCore.System.Root, "foo"); + var content = contentService.Create("foo", Constants.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, ConstantsCore.System.Root, contentType); + var content = new Content(null, Constants.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, ConstantsCore.System.Root, contentType); + var content = new Content(null, Constants.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, ConstantsCore.System.Root, contentType); + var contentA = new Content(null, Constants.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, ConstantsCore.System.Root, contentType); + var contentB = new Content(null, Constants.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(ConstantsCore.System.Root, 0, 100, out var total).ToList(); + var list = contentService.GetPagedChildren(Constants.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(ConstantsCore.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(Constants.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(ConstantsCore.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(Constants.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(ConstantsCore.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(Constants.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(ConstantsCore.System.Root, 0, 100, out total, + list = contentService.GetPagedChildren(Constants.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", ConstantsCore.System.Root, "umbTextpage"); + var content = contentService.Create("Home US", Constants.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", ConstantsCore.System.Root, contentType); + IContent content = new Content("content", Constants.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 92c8afd144..652232ecad 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -524,7 +524,7 @@ namespace Umbraco.Tests.Services var cts = ServiceContext.ContentTypeService; // Act - var container = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType); + var container = new EntityContainer(Constants.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(ConstantsCore.ObjectTypes.DocumentType); + var container1 = new EntityContainer(Constants.ObjectTypes.DocumentType); container1.Name = "container1"; cts.SaveContainer(container1); - var container2 = new EntityContainer(ConstantsCore.ObjectTypes.DocumentType); + var container2 = new EntityContainer(Constants.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 e642b25e66..0598b8cea2 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 = ConstantsCore.ObjectTypes.Document; + var objectTypeId = Constants.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 = ConstantsCore.ObjectTypes.ContentItem; + var objectTypeId = Constants.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 = ConstantsCore.ObjectTypes.DocumentType; + var objectTypeId = Constants.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 4ae6439f4b..57d6b67af8 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(ConstantsCore.Security.EmptyPasswordPrefix)); + Assert.IsTrue(member.RawPasswordValue.StartsWith(Constants.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(ConstantsCore.Security.EmptyPasswordPrefix)); + Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.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(ConstantsCore.Security.EmptyPasswordPrefix)); + Assert.IsFalse(member.RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)); Assert.Throws(() => ServiceContext.MemberService.SavePassword(member, "HELLO123456$!")); } diff --git a/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs b/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs index 24709469e9..e87a31923b 100644 --- a/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs @@ -86,7 +86,7 @@ namespace Umbraco.Tests.Services var initProps = member.Properties.Count; //remove a property (NOT ONE OF THE DEFAULTS) - var standardProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var standardProps = ConventionsHelper.GetStandardPropertyTypeStubs(); memberType.RemovePropertyType(memberType.PropertyTypes.First(x => standardProps.ContainsKey(x.Alias) == false).Alias); ServiceContext.MemberTypeService.Save(memberType); @@ -132,7 +132,7 @@ namespace Umbraco.Tests.Services [Test] public void Rebuild_Member_Xml_On_Property_Removal() { - var standardProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var standardProps = ConventionsHelper.GetStandardPropertyTypeStubs(); var contentType1 = MockedContentTypes.CreateSimpleMemberType("test1", "Test1"); ServiceContext.MemberTypeService.Save(contentType1); @@ -208,7 +208,7 @@ namespace Umbraco.Tests.Services // ctBase.AddPropertyType(new PropertyType(dtdYesNo) // { // Name = "Hide From Navigation", - // Alias = Constants.Conventions.Content.NaviHide + // Alias = ConstantsCore.Conventions.Content.NaviHide // } // /*,"Navigation"*/); // cts.Save(ctBase); diff --git a/src/Umbraco.Tests/Services/PropertyValidationServiceTests.cs b/src/Umbraco.Tests/Services/PropertyValidationServiceTests.cs index e1e19918ce..425c03a9b4 100644 --- a/src/Umbraco.Tests/Services/PropertyValidationServiceTests.cs +++ b/src/Umbraco.Tests/Services/PropertyValidationServiceTests.cs @@ -124,7 +124,7 @@ namespace Umbraco.Tests.Services p3.SetValue("Hello", "en-US"); //ignored since this is variant var p4 = new Property(new PropertyType(dataType, "test4") { Mandatory = true, Variations = ContentVariation.Nothing }); p4.SetValue(null, null); //invalid - + var content = Mock.Of( x => x.Properties == new PropertyCollection(new[] { p1, p2, p3, p4 })); diff --git a/src/Umbraco.Tests/Services/RelationServiceTests.cs b/src/Umbraco.Tests/Services/RelationServiceTests.cs index 3e760bf795..cfef50a330 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(ConstantsCore.ObjectTypes.Document, ConstantsCore.ObjectTypes.Document, "repeatedEventOccurence"); + var rt = new RelationType(Constants.ObjectTypes.Document, Constants.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 1cd7f3ae3f..0665210430 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 = ConstantsCore.DataTypes.Tags + DataTypeId = Constants.DataTypes.Tags }); contentTypeService.Save(contentType); diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index 903c6a65ab..e93e8e8740 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 = ConstantsCore.DataTypes.Tags + DataTypeId = Constants.DataTypes.Tags }; contentType.AddPropertyType(propertyType); diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index 7e8dc618ea..56ad22d414 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(ConstantsCore.System.UmbracoConnectionName, logger, new Lazy(() => mappers)); + databaseFactory = new UmbracoDatabaseFactory(Constants.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 cc054520f3..050de4fcb9 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[ConstantsCore.System.UmbracoConnectionName]; + var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; ConfigurationManager.AppSettings.Set( - ConstantsCore.System.UmbracoConnectionName, + Constants.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 132319b527..7e72a5aefb 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( - ConstantsCore.System.UmbracoConnectionName, + Constants.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 fe378c105d..d77867152a 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 ConstantsCore.DataTypes.Textbox: - return Attempt.Succeed(ConstantsCore.DataTypes.Guids.TextstringGuid); - case ConstantsCore.DataTypes.RichtextEditor: - return Attempt.Succeed(ConstantsCore.DataTypes.Guids.RichtextEditorGuid); + case Constants.DataTypes.Textbox: + return Attempt.Succeed(Constants.DataTypes.Guids.TextstringGuid); + case Constants.DataTypes.RichtextEditor: + return Attempt.Succeed(Constants.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 9f9a975716..04694b21ee 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, ConstantsCore.Security.AdminGroupAlias, new string[0], new string[0]) + new ReadOnlyUserGroup(1, "Admin", "icon-user", null, null, Constants.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 d9887a703f..901c737584 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.ConstantsCore.Web.UmbracoDataToken] = "hello"; + routeData.DataTokens[Core.Constants.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.ConstantsCore.Web.UmbracoDataToken] = content; + routeData.DataTokens[Core.Constants.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 5d19950652..a9c405237b 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.ConstantsCore.Web.UmbracoRouteDefinitionDataToken, routeDefinition); + routeData.DataTokens.Add(Core.Constants.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 d6a12fcbf6..9ca17675af 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.ConstantsCore.Web.UmbracoContextDataToken, umbracoContext); + context.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbracoContext); return context; } diff --git a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs index 5a1d73946a..9ba010642e 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.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); + r1.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbCtx); - Assert.IsTrue(r1.DataTokens.ContainsKey(Core.ConstantsCore.Web.UmbracoContextDataToken)); - Assert.AreSame(umbCtx, r1.DataTokens[Core.ConstantsCore.Web.UmbracoContextDataToken]); + Assert.IsTrue(r1.DataTokens.ContainsKey(Core.Constants.Web.UmbracoContextDataToken)); + Assert.AreSame(umbCtx, r1.DataTokens[Core.Constants.Web.UmbracoContextDataToken]); } [Test] @@ -56,7 +56,7 @@ namespace Umbraco.Tests.Web new TestVariationContextAccessor()); var r1 = new RouteData(); - r1.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); + r1.DataTokens.Add(Core.Constants.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/Actions/ActionChangeDocType.cs b/src/Umbraco.Web/Actions/ActionChangeDocType.cs index 60f6d52d3f..b6dd3f783e 100644 --- a/src/Umbraco.Web/Actions/ActionChangeDocType.cs +++ b/src/Umbraco.Web/Actions/ActionChangeDocType.cs @@ -8,7 +8,7 @@ //{ // public char Letter => '7'; // public string Alias => "changeDocType"; - // public string Category => Constants.Conventions.PermissionCategories.AdministrationCategory; + // public string Category => ConstantsCore.Conventions.PermissionCategories.AdministrationCategory; // public string Icon => "axis-rotation-2"; // public bool ShowInNotifier => true; // public bool CanBePermissionAssigned => true; diff --git a/src/Umbraco.Web/Compose/NotificationsComponent.cs b/src/Umbraco.Web/Compose/NotificationsComponent.cs index f23bdd8d03..3144895ba3 100644 --- a/src/Umbraco.Web/Compose/NotificationsComponent.cs +++ b/src/Umbraco.Web/Compose/NotificationsComponent.cs @@ -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(ConstantsCore.System.RecycleBinContentString)) + .Where(m => m.OriginalPath.Contains(Constants.System.RecycleBinContentString)) .Select(m => m.Entity) .ToArray(); if(restoredEntities.Any()) @@ -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(ConstantsCore.Security.SuperUserId); + user = _userService.GetUserById(Constants.Security.SuperUserId); if (user == null) { - _logger.Warn(typeof(Notifier), "Notifications can not be sent, no admin user with id {SuperUserId} could be resolved", ConstantsCore.Security.SuperUserId); + _logger.Warn(typeof(Notifier), "Notifications can not be sent, no admin user with id {SuperUserId} could be resolved", Constants.Security.SuperUserId); return; } } diff --git a/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs b/src/Umbraco.Web/ContentApps/ContentEditorContentAppFactory.cs index 488c35b757..8c251cacd2 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 = ConstantsCore.Icons.Content, + Icon = Constants.Icons.Content, View = "views/content/apps/content/content.html", Weight = Weight }); @@ -37,7 +37,7 @@ namespace Umbraco.Web.ContentApps { Alias = "umbContent", Name = "Content", - Icon = ConstantsCore.Icons.Content, + Icon = Constants.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 c11a4fb108..e715dc569e 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.ConstantsCore.DataTypes.DefaultContentListView; + dtdId = Core.Constants.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.ConstantsCore.DataTypes.DefaultMediaListView; + dtdId = Core.Constants.DataTypes.DefaultMediaListView; break; default: throw new NotSupportedException($"Object type {o.GetType()} is not supported here."); diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index a991c323ee..0cd96f738c 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 = ConstantsCore.Security.TranslatorGroupAlias}, - new AccessRule {Type = AccessRuleType.Grant, Value = ConstantsCore.Security.AdminGroupAlias} + new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias}, + new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} }; return rules; } diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs index c355879098..867e8af3aa 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 [] { ConstantsCore.Applications.Forms }; + public string[] Sections => new [] { Constants.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 69a8bfb1ed..c2c481e8e4 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.ConstantsCore.Security.BackOfficeAuthenticationType, - Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Core.Constants.Security.BackOfficeAuthenticationType, + Core.Constants.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.ConstantsCore.Security.BackOfficeAuthenticationType, - Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Core.Constants.Security.BackOfficeAuthenticationType, + Core.Constants.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 6ab0043e93..e77a1b70f2 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.ConstantsCore.Security.BackOfficeAuthenticationType, - Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Core.Constants.Security.BackOfficeAuthenticationType, + Core.Constants.Security.BackOfficeExternalAuthenticationType); } if (invite == null) @@ -319,7 +319,7 @@ namespace Umbraco.Web.Editors public async Task ExternalLinkLoginCallback() { var loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync( - ConstantsCore.Security.BackOfficeExternalAuthenticationType, + Constants.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( - ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Constants.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[ConstantsCore.Security.BackOfficeExternalCookieName] != null) + if (Response.Cookies[Constants.Security.BackOfficeExternalCookieName] != null) { - Response.Cookies[ConstantsCore.Security.BackOfficeExternalCookieName].Expires = DateTime.MinValue; + Response.Cookies[Constants.Security.BackOfficeExternalCookieName].Expires = DateTime.MinValue; } } diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index f878342948..3e51befcfb 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", ConstantsCore.PackageRepository.RestApiBaseUrl + "packagesRestApiBaseUrl", Constants.PackageRepository.RestApiBaseUrl }, { "redirectUrlManagementApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( diff --git a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs index 60b4f85c21..fc293ae169 100644 --- a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs +++ b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs @@ -86,7 +86,7 @@ namespace Umbraco.Web.Editors.Binders //{ // //if there's a 'Member' type then we should be able to just go get it from the db since it was created with a link // // to our data. - // var memberType = ApplicationContext.Services.MemberTypeService.GetMemberType(Constants.Conventions.MemberTypes.Member); + // var memberType = ApplicationContext.Services.MemberTypeService.GetMemberType(ConstantsCore.Conventions.MemberTypes.Member); // if (memberType != null) // { // var existing = GetExisting(model.Key); @@ -182,7 +182,7 @@ namespace Umbraco.Web.Editors.Binders /// private void FilterMembershipProviderProperties(IContentTypeBase contentType) { - var defaultProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(); //remove all membership properties, these values are set with the membership provider. var exclude = defaultProps.Select(x => x.Value.Alias).ToArray(); FilterContentTypeProperties(contentType, exclude); @@ -199,6 +199,6 @@ namespace Umbraco.Web.Editors.Binders } } } - + } } diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index 5796856377..5ddbb506c9 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.ConstantsCore.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.Constants.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.ConstantsCore.Trees.PartialViews: + case Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.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.ConstantsCore.Trees.Scripts: + case Core.Constants.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.ConstantsCore.System.RootString) + if (parentId == Core.Constants.System.RootString) { parentId = string.Empty; } @@ -109,19 +109,19 @@ namespace Umbraco.Web.Editors var virtualPath = string.Empty; switch (type) { - case Core.ConstantsCore.Trees.PartialViews: + case Core.Constants.Trees.PartialViews: virtualPath = NormalizeVirtualPath(name, SystemDirectories.PartialViews); Services.FileService.CreatePartialViewFolder(virtualPath); break; - case Core.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.Trees.PartialViewMacros: virtualPath = NormalizeVirtualPath(name, SystemDirectories.MacroPartials); Services.FileService.CreatePartialViewMacroFolder(virtualPath); break; - case Core.ConstantsCore.Trees.Scripts: + case Core.Constants.Trees.Scripts: virtualPath = NormalizeVirtualPath(name, SystemDirectories.Scripts); Services.FileService.CreateScriptFolder(virtualPath); break; - case Core.ConstantsCore.Trees.Stylesheets: + case Core.Constants.Trees.Stylesheets: virtualPath = NormalizeVirtualPath(name, SystemDirectories.Css); Services.FileService.CreateStyleSheetFolder(virtualPath); break; @@ -150,48 +150,48 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.ConstantsCore.Trees.PartialViews: + case Core.Constants.Trees.PartialViews: var view = Services.FileService.GetPartialView(virtualPath); if (view != null) { var display = Mapper.Map(view); - display.FileType = Core.ConstantsCore.Trees.PartialViews; + display.FileType = Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.Trees.PartialViewMacros: var viewMacro = Services.FileService.GetPartialViewMacro(virtualPath); if (viewMacro != null) { var display = Mapper.Map(viewMacro); - display.FileType = Core.ConstantsCore.Trees.PartialViewMacros; + display.FileType = Core.Constants.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.ConstantsCore.Trees.Scripts: + case Core.Constants.Trees.Scripts: var script = Services.FileService.GetScriptByName(virtualPath); if (script != null) { var display = Mapper.Map(script); - display.FileType = Core.ConstantsCore.Trees.Scripts; + display.FileType = Core.Constants.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.ConstantsCore.Trees.Stylesheets: + case Core.Constants.Trees.Stylesheets: var stylesheet = Services.FileService.GetStylesheetByName(virtualPath); if (stylesheet != null) { var display = Mapper.Map(stylesheet); - display.FileType = Core.ConstantsCore.Trees.Stylesheets; + display.FileType = Core.Constants.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.ConstantsCore.Trees.PartialViews: + case Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.Trees.PartialViewMacros: snippets = Services.FileService.GetPartialViewSnippetNames(); break; default: @@ -248,23 +248,23 @@ namespace Umbraco.Web.Editors switch (type) { - case Core.ConstantsCore.Trees.PartialViews: + case Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.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.ConstantsCore.Trees.Scripts: + case Core.Constants.Trees.Scripts: codeFileDisplay = Mapper.Map(new Script(string.Empty)); codeFileDisplay.VirtualPath = SystemDirectories.Scripts; break; - case Core.ConstantsCore.Trees.Stylesheets: + case Core.Constants.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.ConstantsCore.System.RootString) + if (id != Core.Constants.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.ConstantsCore.Trees.PartialViews: + case Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.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.ConstantsCore.Trees.Scripts: + case Core.Constants.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.ConstantsCore.Trees.Stylesheets: + case Core.Constants.Trees.Stylesheets: if (IsDirectory(virtualPath, SystemDirectories.Css)) { Services.FileService.DeleteStyleSheetFolder(virtualPath); @@ -377,7 +377,7 @@ namespace Umbraco.Web.Editors switch (display.FileType) { - case Core.ConstantsCore.Trees.PartialViews: + case Core.Constants.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.ConstantsCore.Trees.PartialViewMacros: + case Core.Constants.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.ConstantsCore.Trees.Scripts: + case Core.Constants.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.ConstantsCore.Trees.Stylesheets: + case Core.Constants.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 219af1ac50..5c8e6fc2b5 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -27,7 +27,6 @@ using Umbraco.Core.Events; using Umbraco.Core.Models.ContentEditing; using Umbraco.Core.Models.Validation; using Umbraco.Web.Composing; -using Constants = Umbraco.Core.Constants; using Umbraco.Core.PropertyEditors; using Umbraco.Web.Actions; using Umbraco.Web.ContentApps; @@ -37,6 +36,7 @@ using Umbraco.Core.Models.Entities; using Umbraco.Core.Persistence; using Umbraco.Core.Security; using Umbraco.Web.Routing; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { @@ -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(ConstantsCore.Applications.Content)] + [UmbracoApplicationAuthorize(Constants.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.ConstantsCore.DataTypes.DefaultMembersListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "content", Core.Constants.DataTypes.DefaultMembersListView)); apps[0].Active = true; var display = new ContentItemDisplay { - Id = ConstantsCore.System.RecycleBinContent, + Id = Constants.System.RecycleBinContent, ParentId = -1, ContentTypeAlias = "recycleBin", IsContainer = true, - Path = "-1," + ConstantsCore.System.RecycleBinContent, + Path = "-1," + Constants.System.RecycleBinContent, Variants = new List { new ContentVariantDisplay @@ -1484,10 +1484,10 @@ namespace Umbraco.Web.Editors /// [HttpDelete] [HttpPost] - [EnsureUserPermissionForContent(ConstantsCore.System.RecycleBinContent, ActionDelete.ActionLetter)] + [EnsureUserPermissionForContent(Constants.System.RecycleBinContent, ActionDelete.ActionLetter)] public HttpResponseMessage EmptyRecycleBin() { - Services.ContentService.EmptyRecycleBin(Security.GetUserId().ResultOr(ConstantsCore.Security.SuperUserId)); + Services.ContentService.EmptyRecycleBin(Security.GetUserId().ResultOr(Constants.Security.SuperUserId)); return Request.CreateNotificationSuccessResponse(Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")); } diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 6a02e65790..0f51c35a14 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(ConstantsCore.Trees.DocumentTypes)] + [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)] [EnableOverrideAuthorization] public class ContentTypeController : ContentTypeControllerBase { @@ -106,9 +106,9 @@ namespace Umbraco.Web.Editors /// /// [UmbracoTreeAuthorize( - ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, - ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, - ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] + Constants.Trees.DocumentTypes, Constants.Trees.Content, + Constants.Trees.MediaTypes, Constants.Trees.Media, + Constants.Trees.MemberTypes, Constants.Trees.Members)] public IEnumerable GetAllPropertyTypeAliases() { return Services.ContentTypeService.GetAllPropertyTypeAliases(); @@ -119,9 +119,9 @@ namespace Umbraco.Web.Editors /// /// [UmbracoTreeAuthorize( - ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, - ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, - ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] + Constants.Trees.DocumentTypes, Constants.Trees.Content, + Constants.Trees.MediaTypes, Constants.Trees.Media, + Constants.Trees.MemberTypes, Constants.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( - ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content, - ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media, - ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members)] + Constants.Trees.DocumentTypes, Constants.Trees.Content, + Constants.Trees.MediaTypes, Constants.Trees.Media, + Constants.Trees.MemberTypes, Constants.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 != ConstantsCore.System.Root) + if (parentId != Constants.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 = ConstantsCore.Icons.Content; + ct.Icon = Constants.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(ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.Content)] + [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes, Constants.Trees.Content)] public IEnumerable GetAllowedChildren(int contentId) { - if (contentId == ConstantsCore.System.RecycleBinContent) + if (contentId == Constants.System.RecycleBinContent) return Enumerable.Empty(); IEnumerable types; - if (contentId == ConstantsCore.System.Root) + if (contentId == Constants.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 af565656ac..5329a312e5 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -12,7 +12,6 @@ using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; using System.Net.Http; using System.Text; using Umbraco.Core.Cache; @@ -20,6 +19,7 @@ using Umbraco.Web.Composing; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { @@ -32,7 +32,7 @@ namespace Umbraco.Web.Editors /// Content Types, Member Types or Media Types ... and of course to Data Types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(ConstantsCore.Trees.DataTypes, ConstantsCore.Trees.DocumentTypes, ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.Trees.DataTypes, Constants.Trees.DocumentTypes, Constants.Trees.MediaTypes, Constants.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( - ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, - ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] + Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, + Constants.Applications.Settings, Constants.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( - ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, - ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] + Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, + Constants.Applications.Settings, Constants.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( - ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, - ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] + Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, + Constants.Applications.Settings, Constants.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( - ConstantsCore.Applications.Content, ConstantsCore.Applications.Media, ConstantsCore.Applications.Members, - ConstantsCore.Applications.Settings, ConstantsCore.Applications.Packages)] + Constants.Applications.Content, Constants.Applications.Media, Constants.Applications.Members, + Constants.Applications.Settings, Constants.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 3654fc0f5d..d132fdc201 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(ConstantsCore.Trees.Dictionary)] + [UmbracoTreeAuthorize(Constants.Trees.Dictionary)] [EnableOverrideAuthorization] public class DictionaryController : BackOfficeNotificationsController { diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 2be28a7304..7113abd6eb 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -29,8 +29,8 @@ using Umbraco.Web.Services; using Umbraco.Web.Trees; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; - using Constants = Umbraco.Core.Constants; + namespace Umbraco.Web.Editors { /// @@ -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 == ConstantsCore.System.Root && startNodes.Length > 0 && startNodes.Contains(ConstantsCore.System.Root) == false && !ignoreUserStartNodes) + if (id == Constants.System.Root && startNodes.Length > 0 && startNodes.Contains(Constants.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 == ConstantsCore.System.Root && startNodes.Length > 0 && startNodes.Contains(ConstantsCore.System.Root) == false && !ignoreUserStartNodes) + if (id == Constants.System.Root && startNodes.Length > 0 && startNodes.Contains(Constants.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 == ConstantsCore.System.Root) + if (id == Constants.System.Root) { // root is special: we reduce it to start nodes int[] aids = GetStartNodes(type); var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeKey); - entities = aids == null || aids.Contains(ConstantsCore.System.Root) || ignoreUserStartNodes + entities = aids == null || aids.Contains(Constants.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 0b12d81546..2a7705ffb9 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs @@ -121,7 +121,7 @@ namespace Umbraco.Web.Editors.Filters permissionToCheck.Add(ActionNew.ActionLetter); - if (contentItem.ParentId != ConstantsCore.System.Root) + if (contentItem.ParentId != Constants.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 != ConstantsCore.System.Root) + if (contentItem.ParentId != Constants.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 != ConstantsCore.System.Root) + if (contentItem.ParentId != Constants.System.Root) { contentToCheck = _contentService.GetById(contentItem.ParentId); contentIdToCheck = contentToCheck.Id; @@ -171,7 +171,7 @@ namespace Umbraco.Web.Editors.Filters permissionToCheck.Add(ActionUpdate.ActionLetter); permissionToCheck.Add(ActionPublish.ActionLetter); - if (contentItem.ParentId != ConstantsCore.System.Root) + if (contentItem.ParentId != Constants.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 66faff7af4..7351c476e4 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 != ConstantsCore.System.Root) + if (mediaItem.ParentId != Constants.System.Root) { contentToCheck = _mediaService.GetById(mediaItem.ParentId); contentIdToCheck = contentToCheck.Id; diff --git a/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs b/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs index 7fc2b1e648..1d421c756b 100644 --- a/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs +++ b/src/Umbraco.Web/Editors/Filters/MemberSaveModelValidator.cs @@ -85,13 +85,13 @@ namespace Umbraco.Web.Editors.Filters public override bool ValidateProperties(MemberSave model, IContentProperties modelWithProperties, HttpActionContext actionContext) { var propertiesToValidate = model.Properties.ToList(); - var defaultProps = Constants.Conventions.Member.GetStandardPropertyTypeStubs(); + var defaultProps = ConventionsHelper.GetStandardPropertyTypeStubs(); var exclude = defaultProps.Select(x => x.Value.Alias).ToArray(); foreach (var remove in exclude) { propertiesToValidate.RemoveAll(property => property.Alias == remove); } - + //if the user doesn't have access to sensitive values, then we need to validate the incoming properties to check //if a sensitive value is being submitted. if (UmbracoContextAccessor.UmbracoContext.Security.CurrentUser.HasAccessToSensitiveData() == false) @@ -169,7 +169,7 @@ namespace Umbraco.Web.Editors.Filters { return true; } - + int totalRecs; var existingByEmail = membershipProvider.FindUsersByEmail(model.Email.Trim(), 0, int.MaxValue, out totalRecs); switch (model.Action) diff --git a/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs b/src/Umbraco.Web/Editors/Filters/UserGroupEditorAuthorizationHelper.cs index 0c1301782b..985c42bbbf 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(ConstantsCore.Applications.Users)) + if (currentUser.AllowedSections.Contains(Constants.Applications.Users)) return Attempt.Succeed(); } diff --git a/src/Umbraco.Web/Editors/ImagesController.cs b/src/Umbraco.Web/Editors/ImagesController.cs index b29c166765..f6452ffba2 100644 --- a/src/Umbraco.Web/Editors/ImagesController.cs +++ b/src/Umbraco.Web/Editors/ImagesController.cs @@ -7,7 +7,6 @@ using Umbraco.Core.IO; using Umbraco.Web.Media; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; -using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { @@ -64,6 +63,6 @@ namespace Umbraco.Web.Editors response.Headers.Location = new Uri($"{imagePath}?rnd={imageLastModified:yyyyMMddHHmmss}&upscale=false&width={width}&animationprocessmode=first&mode=max", UriKind.Relative); return response; } - + } } diff --git a/src/Umbraco.Web/Editors/LanguageController.cs b/src/Umbraco.Web/Editors/LanguageController.cs index 1b04814978..cb7fde23db 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.ConstantsCore.Trees.Languages)] + [UmbracoTreeAuthorize(Core.Constants.Trees.Languages)] [HttpDelete] [HttpPost] public IHttpActionResult DeleteLanguage(int id) @@ -91,7 +91,7 @@ namespace Umbraco.Web.Editors /// /// Creates or saves a language /// - [UmbracoTreeAuthorize(Core.ConstantsCore.Trees.Languages)] + [UmbracoTreeAuthorize(Core.Constants.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 75b719fc73..44eb0a34fc 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.ConstantsCore.Applications.Content, Core.ConstantsCore.Applications.Media)] + [UmbracoApplicationAuthorize(Core.Constants.Applications.Content, Core.Constants.Applications.Media)] public PagedResult GetPagedEntityLog(int id, int pageNumber = 1, int pageSize = 10, diff --git a/src/Umbraco.Web/Editors/MacrosController.cs b/src/Umbraco.Web/Editors/MacrosController.cs index 2a76f1ea0b..3cb161e547 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(ConstantsCore.Trees.Macros)] + [UmbracoTreeAuthorize(Constants.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 ff96dcf207..febb8739be 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -24,7 +24,6 @@ using Umbraco.Core.Cache; using Umbraco.Core.Composing; using Umbraco.Core.Configuration; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; using Umbraco.Core.Persistence.Querying; using Notification = Umbraco.Web.Models.ContentEditing.Notification; using Umbraco.Core.Persistence; @@ -36,6 +35,7 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Web.ContentApps; using Umbraco.Web.Editors.Binders; using Umbraco.Web.Editors.Filters; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { @@ -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(ConstantsCore.Applications.Media)] + [UmbracoApplicationAuthorize(Constants.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(ConstantsCore.Security.SuperUserId)); + var emptyContent = Services.MediaService.CreateMedia("", parentId, contentType.Alias, Security.GetUserId().ResultOr(Constants.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.ConstantsCore.DataTypes.DefaultMediaListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, "recycleBin", "media", Core.Constants.DataTypes.DefaultMediaListView)); apps[0].Active = true; var display = new MediaItemDisplay { - Id = ConstantsCore.System.RecycleBinMedia, + Id = Constants.System.RecycleBinMedia, Alias = "recycleBin", ParentId = -1, Name = Services.TextService.Localize("general/recycleBin"), ContentTypeAlias = "recycleBin", CreateDate = DateTime.Now, IsContainer = true, - Path = "-1," + ConstantsCore.System.RecycleBinMedia, + Path = "-1," + Constants.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 == ConstantsCore.System.Root && UserStartNodes.Length > 0 && UserStartNodes.Contains(ConstantsCore.System.Root) == false) + if (id == Constants.System.Root && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.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(ConstantsCore.Security.SuperUserId)); + var moveResult = Services.MediaService.MoveToRecycleBin(foundMedia, Security.GetUserId().ResultOr(Constants.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(ConstantsCore.Security.SuperUserId)); + var deleteResult = Services.MediaService.Delete(foundMedia, Security.GetUserId().ResultOr(Constants.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(ConstantsCore.Security.SuperUserId)); + var moveResult = Services.MediaService.Move(toMove, move.ParentId, Security.GetUserId().ResultOr(Constants.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(ConstantsCore.Security.SuperUserId)); + var saveStatus = Services.MediaService.Save(contentItem.PersistedContent, Security.GetUserId().ResultOr(Constants.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(ConstantsCore.Security.SuperUserId)); + Services.MediaService.EmptyRecycleBin(Security.GetUserId().ResultOr(Constants.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 != ConstantsCore.System.Root && nodeId != ConstantsCore.System.RecycleBinMedia) + if (media == null && nodeId != Constants.System.Root && nodeId != Constants.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 != ConstantsCore.System.Root && nodeId != ConstantsCore.System.RecycleBinMedia) + if (media == null && nodeId != Constants.System.Root && nodeId != Constants.System.RecycleBinMedia) { throw new HttpResponseException(HttpStatusCode.NotFound); } - var hasPathAccess = (nodeId == ConstantsCore.System.Root) + var hasPathAccess = (nodeId == Constants.System.Root) ? user.HasMediaRootAccess(entityService) - : (nodeId == ConstantsCore.System.RecycleBinMedia) + : (nodeId == Constants.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 3c4c809578..c8e3e202ae 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -4,7 +4,6 @@ using Umbraco.Core.Models; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; using System.Web.Http; using System.Net; using System.Net.Http; @@ -19,6 +18,7 @@ using Umbraco.Core.Dictionary; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Web.Composing; +using Constants = Umbraco.Core.Constants; using IMediaType = Umbraco.Core.Models.IMediaType; namespace Umbraco.Web.Editors @@ -31,7 +31,7 @@ namespace Umbraco.Web.Editors /// An API controller used for dealing with content types /// [PluginController("UmbracoApi")] - [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes)] [EnableOverrideAuthorization] [MediaTypeControllerControllerConfiguration] public class MediaTypeController : ContentTypeControllerBase @@ -58,7 +58,7 @@ namespace Umbraco.Web.Editors return Services.ContentTypeService.Count(); } - [UmbracoTreeAuthorize(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.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 != ConstantsCore.System.Root) + if (parentId != Constants.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 = ConstantsCore.Icons.MediaImage; + mt.Icon = Constants.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(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.Trees.Media)] public IEnumerable GetAllowedChildren(int contentId) { - if (contentId == ConstantsCore.System.RecycleBinContent) + if (contentId == Constants.System.RecycleBinContent) return Enumerable.Empty(); IEnumerable types; - if (contentId == ConstantsCore.System.Root) + if (contentId == Constants.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(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.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(ConstantsCore.Trees.MediaTypes, ConstantsCore.Trees.Media)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes, Constants.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 88c4a19c2b..13f0ed86c4 100644 --- a/src/Umbraco.Web/Editors/MemberController.cs +++ b/src/Umbraco.Web/Editors/MemberController.cs @@ -20,7 +20,6 @@ using Umbraco.Web.WebApi; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.Constants; using System.Collections.Generic; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; @@ -30,6 +29,7 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Web.ContentApps; using Umbraco.Web.Editors.Binders; using Umbraco.Web.Editors.Filters; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { @@ -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(ConstantsCore.Applications.Members)] + [UmbracoApplicationAuthorizeAttribute(Constants.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.ConstantsCore.DataTypes.DefaultMembersListView)); + apps.Add(ListViewContentAppFactory.CreateContentApp(Services.DataTypeService, _propertyEditors, listName, "member", Core.Constants.DataTypes.DefaultMembersListView)); apps[0].Active = true; var display = new MemberListDisplay @@ -586,7 +586,7 @@ namespace Umbraco.Web.Editors UpdateName(contentItem); // re-assign the mapped values that are not part of the membership provider properties. - var builtInAliases = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); + var builtInAliases = ConventionsHelper.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); foreach (var p in contentItem.PersistedContent.Properties) { var valueMapped = currProps.FirstOrDefault(x => x.Alias == p.Alias); diff --git a/src/Umbraco.Web/Editors/MemberGroupController.cs b/src/Umbraco.Web/Editors/MemberGroupController.cs index bcdadc75ea..81191311f9 100644 --- a/src/Umbraco.Web/Editors/MemberGroupController.cs +++ b/src/Umbraco.Web/Editors/MemberGroupController.cs @@ -11,7 +11,7 @@ using Umbraco.Core.Services; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.ConstantsCore; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs index f57b5d4208..fffead9155 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[] { ConstantsCore.Trees.MemberTypes, ConstantsCore.Trees.Members})] + [UmbracoTreeAuthorize(new string[] { Constants.Trees.MemberTypes, Constants.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(ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] public MemberTypeDisplay GetById(int id) { var ct = Services.MemberTypeService.Get(id); @@ -56,7 +56,7 @@ namespace Umbraco.Web.Editors /// [HttpDelete] [HttpPost] - [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] public HttpResponseMessage DeleteById(int id) { var foundType = Services.MemberTypeService.Get(id); @@ -84,7 +84,7 @@ namespace Umbraco.Web.Editors /// /// - [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.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(ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] public MemberTypeDisplay GetEmpty() { var ct = new MemberType(-1); - ct.Icon = ConstantsCore.Icons.Member; + ct.Icon = Constants.Icons.Member; var dto = Mapper.Map(ct); return dto; @@ -122,7 +122,7 @@ namespace Umbraco.Web.Editors return Enumerable.Empty(); } - [UmbracoTreeAuthorize(ConstantsCore.Trees.MemberTypes)] + [UmbracoTreeAuthorize(Constants.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 e2b30943f7..18678fdb12 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.ConstantsCore.Applications.Packages)] + [UmbracoApplicationAuthorize(Core.Constants.Applications.Packages)] public class PackageController : UmbracoAuthorizedJsonController { public IEnumerable GetCreatedPackages() diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs index 309eca8a7e..6b2bd07fbd 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.ConstantsCore.Applications.Packages)] + [UmbracoApplicationAuthorize(Core.Constants.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 8d6b05369c..d700d05c8a 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.ConstantsCore.Applications.Users) == false) + if (currentUser.HasSectionAccess(Umbraco.Core.Constants.Applications.Users) == false) { return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("The current user is not authorized", new[] { "resetPassword" }) }); } diff --git a/src/Umbraco.Web/Editors/PreviewController.cs b/src/Umbraco.Web/Editors/PreviewController.cs index 2cb68c3ec3..c1848419dc 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(ConstantsCore.Web.PreviewCookieName, previewToken)); + Response.Cookies.Set(new HttpCookie(Constants.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(ConstantsCore.Web.PreviewCookieName); + System.Web.HttpContext.Current.ExpireCookie(Constants.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 509275d0e5..b7f9baba55 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(ConstantsCore.Applications.Content)] + [UmbracoApplicationAuthorize(Constants.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 404ee346d8..faafbb79f1 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(ConstantsCore.Trees.RelationTypes)] + [UmbracoTreeAuthorize(Constants.Trees.RelationTypes)] [EnableOverrideAuthorization] public class RelationTypeController : BackOfficeNotificationsController { diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs index dca1afcc03..8da5e80f2e 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(ConstantsCore.Trees.Templates)] + [UmbracoTreeAuthorize(Constants.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 2f64a4ff98..c6c1acd048 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( - ConstantsCore.Applications.Content, - ConstantsCore.Applications.Media, - ConstantsCore.Applications.Members)] + Constants.Applications.Content, + Constants.Applications.Media, + Constants.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 7498f81816..320580aaf9 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 == ConstantsCore.System.Root) + if (contentId == Constants.System.Root) { - var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateContentStartNodeIds(_entityService), ConstantsCore.System.RecycleBinContent); + var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateContentStartNodeIds(_entityService), Constants.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 == ConstantsCore.System.Root) + if (mediaId == Constants.System.Root) { - var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateMediaStartNodeIds(_entityService), ConstantsCore.System.RecycleBinMedia); + var hasAccess = ContentPermissionsHelper.HasPathAccess("-1", currentUser.CalculateMediaStartNodeIds(_entityService), Constants.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 3a68c80eb7..e521b5de2e 100644 --- a/src/Umbraco.Web/Editors/UserGroupsController.cs +++ b/src/Umbraco.Web/Editors/UserGroupsController.cs @@ -18,7 +18,7 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Editors { [PluginController("UmbracoApi")] - [UmbracoApplicationAuthorize(ConstantsCore.Applications.Users)] + [UmbracoApplicationAuthorize(Constants.Applications.Users)] [PrefixlessBodyModelValidator] public class UserGroupsController : UmbracoAuthorizedJsonController { @@ -124,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 == ConstantsCore.Security.AdminGroupAlias))); + allGroups.RemoveAt(allGroups.IndexOf(allGroups.Find(basic => basic.Alias == Constants.Security.AdminGroupAlias))); return allGroups; } diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs index 36223c4edf..15e5b9404f 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(ConstantsCore.Applications.Users)] + [UmbracoApplicationAuthorize(Constants.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[] {ConstantsCore.Security.AdminGroupAlias}; + excludeUserGroups = new[] {Constants.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 != ConstantsCore.Security.SuperUserId); + filterQuery.Where(x => x.Id != Constants.Security.SuperUserId); } if (filter.IsNullOrWhiteSpace() == false) diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs index eca225f093..2f72b946de 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.ConstantsCore.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.Constants.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 c0e9561ca0..5f520653f5 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(ConstantsCore.Web.PreviewCookieName).FirstOrDefault(); + var cookie = request.Headers.GetCookies(Constants.Web.PreviewCookieName).FirstOrDefault(); if (cookie != null) { - if (cookie[ConstantsCore.Web.PreviewCookieName] != null) + if (cookie[Constants.Web.PreviewCookieName] != null) { - return cookie[ConstantsCore.Web.PreviewCookieName].Value; + return cookie[Constants.Web.PreviewCookieName].Value; } } return null; @@ -99,7 +99,7 @@ namespace Umbraco.Web public static string GetPreviewCookieValue(this HttpRequestBase request) { - return request.GetCookieValue(ConstantsCore.Web.PreviewCookieName); + return request.GetCookieValue(Constants.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[ConstantsCore.Web.PreviewCookieName] != null; + return request.Cookies[Constants.Web.PreviewCookieName] != null; } /// @@ -134,7 +134,7 @@ namespace Umbraco.Web /// public static bool HasPreviewCookie(this IOwinRequest request) { - return request.Cookies[ConstantsCore.Web.PreviewCookieName] != null; + return request.Cookies[Constants.Web.PreviewCookieName] != null; } /// diff --git a/src/Umbraco.Web/Install/InstallHelper.cs b/src/Umbraco.Web/Install/InstallHelper.cs index 45199012a0..effb46c9b7 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(ConstantsCore.Web.InstallerCookieName); + var installCookie = _httpContext.Request.GetCookieValue(Constants.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(ConstantsCore.Web.InstallerCookieName, "1")); + _httpContext.Response.Cookies.Set(new HttpCookie(Constants.Web.InstallerCookieName, "1")); var dbProvider = string.Empty; if (IsBrandNewInstall == false) @@ -113,7 +113,7 @@ namespace Umbraco.Web.Install { get { - var databaseSettings = ConfigurationManager.ConnectionStrings[ConstantsCore.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.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 4629376309..d119759488 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[ConstantsCore.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.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 a5703ded89..c680b6e41a 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[ConstantsCore.System.UmbracoConnectionName] != null) + if (ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName] != null) { - GlobalSettings.RemoveSetting(ConstantsCore.System.UmbracoConnectionName); + GlobalSettings.RemoveSetting(Constants.System.UmbracoConnectionName); } else { - 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"); + 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"); 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 be84c50a9e..4e8068c4c5 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[ConstantsCore.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.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 1802fcc823..151265f394 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(ConstantsCore.Security.SuperUserId); + var admin = _userService.GetUserById(Constants.Security.SuperUserId); if (admin == null) { throw new InvalidOperationException("Could not find the super user!"); } - var membershipUser = CurrentProvider.GetUser(ConstantsCore.Security.SuperUserId, true); + var membershipUser = CurrentProvider.GetUser(Constants.Security.SuperUserId, true); if (membershipUser == null) { - throw new InvalidOperationException($"No user found in membership provider with id of {ConstantsCore.Security.SuperUserId}."); + throw new InvalidOperationException($"No user found in membership provider with id of {Constants.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[ConstantsCore.System.UmbracoConnectionName]; + var databaseSettings = ConfigurationManager.ConnectionStrings[Constants.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 77f420a057..b5fdea32b7 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(ConstantsCore.Security.SuperUserId); + security.PerformLogin(Constants.Security.SuperUserId); } } else if (_globalSettings.ConfigurationStatus.IsNullOrWhiteSpace()) { // for installs, we need to log the super user in - security.PerformLogin(ConstantsCore.Security.SuperUserId); + security.PerformLogin(Constants.Security.SuperUserId); } // Update configurationStatus diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs index ef296dbf71..44ee77507b 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.ConstantsCore.Web.UmbracoContextDataToken, umbCtx); //required for UmbracoViewPage + routeVals.DataTokens.Add(Core.Constants.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/Media/ImageHelper.cs b/src/Umbraco.Web/Media/ImageHelper.cs index 899f817d5a..ee01ec4a1c 100644 --- a/src/Umbraco.Web/Media/ImageHelper.cs +++ b/src/Umbraco.Web/Media/ImageHelper.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.Media /// in memory. Fallback to GDI which means loading the image in memory and thus /// use potentially large amounts of memory. public static Size GetDimensions(Stream stream) - { + { //Try to load with exif try { @@ -56,7 +56,7 @@ namespace Umbraco.Web.Media //We will just swallow, just means we can't read via GDI, we don't want to log an error either } - return new Size(Constants.Conventions.Media.DefaultSize, Constants.Conventions.Media.DefaultSize); + return new Size(Constants.Conventions.Media.DefaultSize, Constants.Conventions.Media.DefaultSize); } } } diff --git a/src/Umbraco.Web/Models/Mapping/CommonMapper.cs b/src/Umbraco.Web/Models/Mapping/CommonMapper.cs index d99ec22236..7bf4a94b1c 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(ConstantsCore.Applications.Settings))) + && Composing.Current.UmbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.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 9f757c3b4b..528d5f6de5 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 == ConstantsCore.System.Root) + if (source.ParentId == Constants.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 29909e3837..3074d0a2c8 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 = { - ConstantsCore.DataTypes.DefaultContentListView, - ConstantsCore.DataTypes.DefaultMediaListView, - ConstantsCore.DataTypes.DefaultMembersListView + Constants.DataTypes.DefaultContentListView, + Constants.DataTypes.DefaultMediaListView, + Constants.DataTypes.DefaultMembersListView }; public void DefineMaps(UmbracoMapper mapper) @@ -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(ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes)) + if (dataType != null && dataType.IsBuildInDataType() && field.Key.InvariantEquals(Constants.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 db223194e2..2e44f1327b 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 = ConstantsCore.Icons.User; + target.Icon = Constants.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 = ConstantsCore.Icons.Template; + target.Icon = Constants.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 == 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; + 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; } } @@ -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] - : ConstantsCore.Icons.DefaultIcon; + : Constants.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(ConstantsCore.Icons.Member); + return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(Constants.Icons.Member); } return null; diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MacroMapDefinition.cs index 64ac5162c2..e5bca22287 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 = ConstantsCore.Icons.Macro; + target.Icon = Constants.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 8c888ffa38..8671bfe538 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 = ConstantsCore.Icons.Member; + target.Icon = Constants.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 7958525eaa..8744b068a7 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(ConstantsCore.Applications.Settings))) + && umbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.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 = ConstantsCore.Icons.ContentType + icon = Constants.Icons.ContentType } }; docTypeProperty.View = "urllist"; diff --git a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs index a184ac92cf..540b080dbc 100644 --- a/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/PropertyTypeGroupMapper.cs @@ -150,7 +150,7 @@ namespace Umbraco.Web.Models.Mapping // handle locked properties var lockedPropertyAliases = new List(); // add built-in member property aliases to list of aliases to be locked - foreach (var propertyAlias in Constants.Conventions.Member.GetStandardPropertyTypeStubs().Keys) + foreach (var propertyAlias in ConventionsHelper.GetStandardPropertyTypeStubs().Keys) { lockedPropertyAliases.Add(propertyAlias); } diff --git a/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/UserMapDefinition.cs index bd187dc286..88960fb189 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 = ConstantsCore.Icons.UserGroup; + target.Icon = Constants.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 == ConstantsCore.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace()) - target.Icon = ConstantsCore.Icons.Member; + if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace()) + target.Icon = Constants.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 = ConstantsCore.Icons.UserGroup; + target.Icon = Constants.Icons.UserGroup; } private IDictionary> MapUserGroupDefaultPermissions(IUserGroup source) diff --git a/src/Umbraco.Web/Models/RegisterModel.cs b/src/Umbraco.Web/Models/RegisterModel.cs index 86a5459a74..41edea19de 100644 --- a/src/Umbraco.Web/Models/RegisterModel.cs +++ b/src/Umbraco.Web/Models/RegisterModel.cs @@ -65,7 +65,7 @@ namespace Umbraco.Web.Models /// [Required] public string Password { get; set; } - + /// /// The username of the model, if UsernameIsEmail is true then this is ignored. /// diff --git a/src/Umbraco.Web/Models/Trees/TreeRootNode.cs b/src/Umbraco.Web/Models/Trees/TreeRootNode.cs index a5b4c6042b..386ff9e99b 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.ConstantsCore.System.RootString; + private static readonly string RootId = Core.Constants.System.RootString; private bool _isGroup; private bool _isSingleNodeTree; diff --git a/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs b/src/Umbraco.Web/Mvc/AdminTokenAuthorizeAttribute.cs index 23c9b887c0..882cb5624c 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.ConstantsCore.Security.SuperUserId); + var admin = userService.GetUserById(Core.Constants.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.ConstantsCore.Security.SuperUserId); + var admin = UserService.GetUserById(Core.Constants.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 4a8f2a0445..61a659615f 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.ConstantsCore.Web.UmbracoDataToken, umbracoTokenValue); //ensure the umbraco token is set + controllerPluginRoute.DataTokens.Add(Core.Constants.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 f27b9d21ab..052938807a 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.ConstantsCore.Web.UmbracoDataToken, out model) == false) + if (controllerContext.RouteData.DataTokens.TryGetValue(Core.Constants.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 31960a406d..393b6882c9 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.ConstantsCore.Web.UmbracoContextDataToken); + var o = controllerContext.GetDataTokenInViewContextHierarchy(Core.Constants.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 5e0f81a672..64c9ad52c4 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.ConstantsCore.Web.PublishedDocumentRequestDataToken) == false) + if (RouteData.DataTokens.ContainsKey(Core.Constants.Web.PublishedDocumentRequestDataToken) == false) { throw new InvalidOperationException("DataTokens must contain an 'umbraco-doc-request' key with a PublishedRequest object"); } - _publishedRequest = (PublishedRequest)RouteData.DataTokens[Core.ConstantsCore.Web.PublishedDocumentRequestDataToken]; + _publishedRequest = (PublishedRequest)RouteData.DataTokens[Core.Constants.Web.PublishedDocumentRequestDataToken]; return _publishedRequest; } } diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 3b766fe923..8f07dfb18b 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.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 + 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 } 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.ConstantsCore.Web.UmbracoDataToken] = contentModel; + requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoDataToken] = contentModel; // the rest should not change -- it's only the published content that has changed } @@ -298,7 +298,7 @@ namespace Umbraco.Web.Mvc } //store the route definition - requestContext.RouteData.DataTokens[Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken] = def; + requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken] = def; return def; } diff --git a/src/Umbraco.Web/Mvc/RenderViewEngine.cs b/src/Umbraco.Web/Mvc/RenderViewEngine.cs index ce6b95d2ea..f8a636c87b 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.ConstantsCore.Web.UmbracoDataToken); + var umbracoToken = controllerContext.GetDataTokenInViewContextHierarchy(Core.Constants.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 d32dea150c..4fc53de4ae 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.ConstantsCore.Web.UmbracoRouteDefinitionDataToken)) - return Attempt.Succeed((RouteDefinition)currentRouteData.DataTokens[Core.ConstantsCore.Web.UmbracoRouteDefinitionDataToken]); + if (currentRouteData.DataTokens.ContainsKey(Core.Constants.Web.UmbracoRouteDefinitionDataToken)) + return Attempt.Succeed((RouteDefinition)currentRouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken]); currentContext = currentContext.IsChildAction ? currentContext.ParentActionViewContext diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index 19d9b82470..75804b47bb 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.ConstantsCore.Web.UmbracoRouteDefinitionDataToken]; + var routeDef = (RouteDefinition)context.RouteData.DataTokens[Umbraco.Core.Constants.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.ConstantsCore.Web.UmbracoRouteDefinitionDataToken) == false) + if (routeData.DataTokens.ContainsKey(Umbraco.Core.Constants.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 f73658bab9..7f3a69bfaf 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.ConstantsCore.Web.PublishedDocumentRequestDataToken; + const string token = Core.Constants.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. diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs index 31c7a6f155..6f5dcab45f 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.ConstantsCore.Web.UmbracoDataToken, renderModel); - requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.PublishedDocumentRequestDataToken, umbracoContext.PublishedRequest); - requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.UmbracoContextDataToken, umbracoContext); + 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); // this is used just for a flag that this is an umbraco custom route - requestContext.RouteData.DataTokens.Add(Core.ConstantsCore.Web.CustomRouteDataToken, true); + requestContext.RouteData.DataTokens.Add(Core.Constants.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.ConstantsCore.Web.UmbracoRouteDefinitionDataToken] = def; + requestContext.RouteData.DataTokens[Core.Constants.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 2db8de1e21..b3d580bc38 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.ConstantsCore.Applications.Settings)] + [UmbracoApplicationAuthorize(Core.Constants.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 320e37e1ed..021d416781 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.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index 702408788a..a3396a5fb3 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.PropertyEditors { return property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.Aliases.UploadField; } - + /// /// Ensures any files associated are removed /// diff --git a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs index e52209489a..7c9a549aef 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.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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 39b60f61e3..24e2fc29a5 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 ?? ConstantsCore.Security.SuperUserId; + var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? Constants.Security.SuperUserId; // Process the rte values foreach (var rte in rtes) diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs index 9a8fb7c40b..1d7c1eef65 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs @@ -63,7 +63,7 @@ namespace Umbraco.Web.PropertyEditors /// /// Gets a value indicating whether a property is an image cropper field. /// - /// The property. + /// The property. /// A value indicating whether a property is an image cropper field, and (optionally) has a non-empty value. private static bool IsCropperField(Property property) { diff --git a/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ListViewPropertyEditor.cs index e030fcb631..53f9cb94ef 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 = ConstantsCore.Icons.ListView)] + Icon = Constants.Icons.ListView)] public class ListViewPropertyEditor : DataEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs b/src/Umbraco.Web/PropertyEditors/MediaPickerConfiguration.cs index e7a2450141..b8b9476184 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.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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 8633b6dd22..dd755ee0ba 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 = ConstantsCore.Icons.MediaImage)] + Icon = Constants.Icons.MediaImage)] public class MediaPickerPropertyEditor : DataEditor { /// diff --git a/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MemberGroupPickerPropertyEditor.cs index ebf29afa40..b8e67c863c 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 = ConstantsCore.Icons.MemberGroup)] + Icon = Constants.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 793d12f93e..69020ba350 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 = ConstantsCore.Icons.Member)] + Icon = Constants.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 80ea55842f..81a96b5ad7 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.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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 498cec3490..73a098cc9d 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerConfiguration.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("maxNumber", "Maximum number of items", "number")] public int MaxNumber { get; set; } - [ConfigurationField(Core.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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 aa8b5c9f7b..c6d4e3ce70 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.ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes, + [ConfigurationField(Core.Constants.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 475fd0de8f..5743e9c1d5 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 ?? ConstantsCore.Security.SuperUserId; + var userId = _umbracoContextAccessor.UmbracoContext?.Security?.CurrentUser?.Id ?? Constants.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 06ca4d652f..daf574719a 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 = ConstantsCore.Icons.User)] + Icon = Constants.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 9ad2effe17..1edb20633f 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 == ConstantsCore.ObjectTypes.Document && x.NodeId == id && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Document && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Media && x.NodeId == id && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 == ConstantsCore.ObjectTypes.Media && !x.Trashed) + .Where(x => x.NodeObjectType == Constants.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 7a9fde8b5a..eae2f33979 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -1456,7 +1456,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private void RebuildContentDbCacheLocked(IScope scope, int groupSize, IEnumerable contentTypeIds) { var contentTypeIdsA = contentTypeIds?.ToArray(); - var contentObjectType = ConstantsCore.ObjectTypes.Document; + var contentObjectType = Constants.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 = ConstantsCore.ObjectTypes.Media; + var mediaObjectType = Constants.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 = ConstantsCore.ObjectTypes.Member; + var memberObjectType = Constants.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 = ConstantsCore.ObjectTypes.Document; + var contentObjectType = Constants.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 = ConstantsCore.ObjectTypes.Media; + var mediaObjectType = Constants.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 = ConstantsCore.ObjectTypes.Member; + var memberObjectType = Constants.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 745e167c51..75eb6adbcb 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) ? ConstantsCore.UmbracoIndexes.ExternalIndexName : indexName; + indexName = string.IsNullOrEmpty(indexName) ? Constants.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) ? ConstantsCore.UmbracoIndexes.ExternalIndexName : indexName; + indexName = string.IsNullOrEmpty(indexName) ? Constants.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 10b989d030..2dbe4de4c5 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) - ? ConstantsCore.UmbracoIndexes.ExternalIndexName + ? Constants.UmbracoIndexes.ExternalIndexName : indexName; if (!_examineManager.TryGetIndex(indexName, out var index) || !(index is IUmbracoIndex umbIndex)) diff --git a/src/Umbraco.Web/PublishedElementExtensions.cs b/src/Umbraco.Web/PublishedElementExtensions.cs index f28581eb42..f3bc27182f 100644 --- a/src/Umbraco.Web/PublishedElementExtensions.cs +++ b/src/Umbraco.Web/PublishedElementExtensions.cs @@ -166,7 +166,7 @@ namespace Umbraco.Web where T : IPublishedElement { if (types == null || types.Length == 0) return Enumerable.Empty(); - + return contents.Where(x => types.InvariantContains(x.ContentType.Alias)); } diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs index 6e768c28b6..e811caf77b 100644 --- a/src/Umbraco.Web/Routing/PublishedRouter.cs +++ b/src/Umbraco.Web/Routing/PublishedRouter.cs @@ -236,7 +236,7 @@ namespace Umbraco.Web.Routing // assign the legacy page back to the docrequest // handlers like default.aspx will want it and most macros currently need it request.LegacyContentHashTable = new PublishedContentHashtableConverter(request); - + } #endregion diff --git a/src/Umbraco.Web/Runtime/WebInitialComponent.cs b/src/Umbraco.Web/Runtime/WebInitialComponent.cs index 877549be7e..ac813d7196 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.ConstantsCore.Web.UmbracoDataToken, "api"); //ensure the umbraco token is set + route.DataTokens.Add(Core.Constants.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.ConstantsCore.Web.UmbracoDataToken, "surface"); // ensure the umbraco token is set + route.DataTokens.Add(Core.Constants.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 c2422f60ab..ec536b9d75 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( - ConstantsCore.UmbracoIndexes.InternalIndexName, - CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.InternalIndexPath), + Constants.UmbracoIndexes.InternalIndexName, + CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.InternalIndexPath), new UmbracoFieldDefinitionCollection(), new CultureInvariantWhitespaceAnalyzer(), ProfilingLogger, @@ -66,8 +66,8 @@ namespace Umbraco.Web.Search private IIndex CreateExternalIndex() { var index = new UmbracoContentIndex( - ConstantsCore.UmbracoIndexes.ExternalIndexName, - CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.ExternalIndexPath), + Constants.UmbracoIndexes.ExternalIndexName, + CreateFileSystemLuceneDirectory(Constants.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( - ConstantsCore.UmbracoIndexes.MembersIndexName, + Constants.UmbracoIndexes.MembersIndexName, new UmbracoFieldDefinitionCollection(), - CreateFileSystemLuceneDirectory(ConstantsCore.UmbracoIndexes.MembersIndexPath), + CreateFileSystemLuceneDirectory(Constants.UmbracoIndexes.MembersIndexPath), new CultureInvariantWhitespaceAnalyzer(), ProfilingLogger, GetMemberValueSetValidator() diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs index 65a46d10e5..b351cca972 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 = ConstantsCore.UmbracoIndexes.InternalIndexName; + var indexName = Constants.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 = ConstantsCore.UmbracoIndexes.MembersIndexName; + indexName = Constants.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 == ConstantsCore.Icons.DefaultIcon) + if (m.Icon == Constants.Icons.DefaultIcon) { - m.Icon = ConstantsCore.Icons.Member; + m.Icon = Constants.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 b786d5dc48..a93c3040f8 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 => ConstantsCore.Applications.Content; + public string Alias => Constants.Applications.Content; /// public string Name => "Content"; diff --git a/src/Umbraco.Web/Sections/FormsSection.cs b/src/Umbraco.Web/Sections/FormsSection.cs index 2c0d59bf19..98ca2d1eb5 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 => ConstantsCore.Applications.Forms; + public string Alias => Constants.Applications.Forms; public string Name => "Forms"; } } diff --git a/src/Umbraco.Web/Sections/MediaSection.cs b/src/Umbraco.Web/Sections/MediaSection.cs index 79c6fec43b..3d6b16125a 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 => ConstantsCore.Applications.Media; + public string Alias => Constants.Applications.Media; public string Name => "Media"; } } diff --git a/src/Umbraco.Web/Sections/MembersSection.cs b/src/Umbraco.Web/Sections/MembersSection.cs index fdf4f83562..1f82d31131 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 => ConstantsCore.Applications.Members; + public string Alias => Constants.Applications.Members; /// public string Name => "Members"; diff --git a/src/Umbraco.Web/Sections/PackagesSection.cs b/src/Umbraco.Web/Sections/PackagesSection.cs index 879b243add..265b440195 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 => ConstantsCore.Applications.Packages; + public string Alias => Constants.Applications.Packages; /// public string Name => "Packages"; diff --git a/src/Umbraco.Web/Sections/SettingsSection.cs b/src/Umbraco.Web/Sections/SettingsSection.cs index 1a246a5d1d..4185cd123a 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 => ConstantsCore.Applications.Settings; + public string Alias => Constants.Applications.Settings; /// public string Name => "Settings"; diff --git a/src/Umbraco.Web/Sections/TranslationSection.cs b/src/Umbraco.Web/Sections/TranslationSection.cs index 4cbc366b4a..b23dbde93b 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 => ConstantsCore.Applications.Translation; + public string Alias => Constants.Applications.Translation; /// public string Name => "Translation"; diff --git a/src/Umbraco.Web/Sections/UsersSection.cs b/src/Umbraco.Web/Sections/UsersSection.cs index 01842d0d1d..ac4255ac96 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 => ConstantsCore.Applications.Users; + public string Alias => Constants.Applications.Users; /// public string Name => "Users"; diff --git a/src/Umbraco.Web/Security/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/AppBuilderExtensions.cs index e9dd3b4590..0a3e57c4fd 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 = ConstantsCore.Security.BackOfficeExternalAuthenticationType, + AuthenticationType = Constants.Security.BackOfficeExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, - CookieName = ConstantsCore.Security.BackOfficeExternalCookieName, + CookieName = Constants.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, - ConstantsCore.Security.BackOfficeAuthenticationType, + Constants.Security.BackOfficeAuthenticationType, "v1")); var authOptions = new UmbracoBackOfficeCookieAuthOptions( diff --git a/src/Umbraco.Web/Security/AuthenticationExtensions.cs b/src/Umbraco.Web/Security/AuthenticationExtensions.cs index 68244e9205..1fa75a214b 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[ConstantsCore.Security.ForceReAuthFlag] = true; + http.Items[Constants.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[ConstantsCore.Security.ForceReAuthFlag] = true; + http.Items[Constants.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(ConstantsCore.Security.SessionIdClaimType); + var sessionId = claimsIdentity.FindFirstValue(Constants.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, ConstantsCore.Web.PreviewCookieName, ConstantsCore.Security.BackOfficeExternalCookieName }; + var cookies = new[] { cookieName, Constants.Web.PreviewCookieName, Constants.Security.BackOfficeExternalCookieName }; foreach (var c in cookies) { // remove from the request @@ -296,8 +296,8 @@ namespace Umbraco.Web.Security catch (Exception) { owinCtx.Authentication.SignOut( - ConstantsCore.Security.BackOfficeAuthenticationType, - ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Constants.Security.BackOfficeAuthenticationType, + Constants.Security.BackOfficeExternalAuthenticationType); return null; } } diff --git a/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs b/src/Umbraco.Web/Security/AuthenticationOptionsExtensions.cs index 08373fd6ce..b1b2755f4c 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(ConstantsCore.Security.BackOfficeExternalAuthenticationTypePrefix) == false) + if (options.AuthenticationType.StartsWith(Constants.Security.BackOfficeExternalAuthenticationTypePrefix) == false) { - options.AuthenticationType = ConstantsCore.Security.BackOfficeExternalAuthenticationTypePrefix + options.AuthenticationType; + options.AuthenticationType = Constants.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 1eaf762030..e1cdf272d9 100644 --- a/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs +++ b/src/Umbraco.Web/Security/BackOfficeClaimsIdentityFactory.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Security { public BackOfficeClaimsIdentityFactory() { - SecurityStampClaimType = ConstantsCore.Security.SessionIdClaimType; + SecurityStampClaimType = Constants.Security.SessionIdClaimType; UserNameClaimType = ClaimTypes.Name; } diff --git a/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs b/src/Umbraco.Web/Security/BackOfficeCookieAuthenticationProvider.cs index 2b55fb81f4..e7aef4be03 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.ConstantsCore.Security.SessionIdClaimType); + var sessionId = claimsIdentity.FindFirstValue(Core.Constants.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.ConstantsCore.Web.PreviewCookieName, "", new CookieOptions + context.Response.Cookies.Append(Core.Constants.Web.PreviewCookieName, "", new CookieOptions { Expires = DateTime.Now.AddYears(-1), Path = "/" }); - context.Response.Cookies.Append(Core.ConstantsCore.Security.BackOfficeExternalCookieName, "", new CookieOptions + context.Response.Cookies.Append(Core.Constants.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 6b3a66d9b4..5da86204f3 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(ConstantsCore.Security.ForceReAuthFlag) != null) - || (checkForceAuthTokens && httpContext.Success && httpContext.Result.Items[ConstantsCore.Security.ForceReAuthFlag] != null) + (checkForceAuthTokens && owinContext.Get(Constants.Security.ForceReAuthFlag) != null) + || (checkForceAuthTokens && httpContext.Success && httpContext.Result.Items[Constants.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 e32155960e..00b07cd7ef 100644 --- a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web.Security _logger = logger; _request = request; _globalSettings = globalSettings; - AuthenticationType = ConstantsCore.Security.BackOfficeAuthenticationType; + AuthenticationType = Constants.Security.BackOfficeAuthenticationType; } public override Task CreateUserIdentityAsync(BackOfficeIdentityUser user) @@ -160,7 +160,7 @@ namespace Umbraco.Web.Security if (await UserManager.GetTwoFactorEnabledAsync(user.Id) && (await UserManager.GetValidTwoFactorProvidersAsync(user.Id)).Count > 0) { - var identity = new ClaimsIdentity(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); + var identity = new ClaimsIdentity(Constants.Security.BackOfficeTwoFactorAuthenticationType); identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, id)); identity.AddClaim(new Claim(ClaimsIdentity.DefaultNameClaimType, user.UserName)); AuthenticationManager.SignIn(identity); @@ -183,8 +183,8 @@ namespace Umbraco.Web.Security // Clear any partial cookies from external or two factor partial sign ins AuthenticationManager.SignOut( - ConstantsCore.Security.BackOfficeExternalAuthenticationType, - ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); + Constants.Security.BackOfficeExternalAuthenticationType, + Constants.Security.BackOfficeTwoFactorAuthenticationType); var nowUtc = DateTime.Now.ToUniversalTime(); @@ -236,7 +236,7 @@ namespace Umbraco.Web.Security /// public new async Task GetVerifiedUserIdAsync() { - var result = await AuthenticationManager.AuthenticateAsync(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); + var result = await AuthenticationManager.AuthenticateAsync(Constants.Security.BackOfficeTwoFactorAuthenticationType); if (result != null && result.Identity != null && string.IsNullOrEmpty(result.Identity.GetUserId()) == false) { return ConvertIdFromString(result.Identity.GetUserId()); @@ -250,7 +250,7 @@ namespace Umbraco.Web.Security /// public async Task GetVerifiedUserNameAsync() { - var result = await AuthenticationManager.AuthenticateAsync(ConstantsCore.Security.BackOfficeTwoFactorAuthenticationType); + var result = await AuthenticationManager.AuthenticateAsync(Constants.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 2965a63440..6205c1705c 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.ConstantsCore.Security.BackOfficeAuthenticationType); + var userIdentity = await CreateIdentityAsync(user, Core.Constants.Security.BackOfficeAuthenticationType); return userIdentity; } diff --git a/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs b/src/Umbraco.Web/Security/ForceRenewalCookieAuthenticationHandler.cs index a88cfd19ef..896a0ca63e 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(ConstantsCore.Security.ForceReAuthFlag) != null || (httpCtx.Success && httpCtx.Result.Items[ConstantsCore.Security.ForceReAuthFlag] != null); + var shouldRenew = Context.Get(Constants.Security.ForceReAuthFlag) != null || (httpCtx.Success && httpCtx.Result.Items[Constants.Security.ForceReAuthFlag] != null); if (shouldRenew) { diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index f74897d565..a441a428ac 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -329,7 +329,7 @@ namespace Umbraco.Web.Security var guidUdi = udi as GuidUdi; if (guidUdi == null) return null; - var umbracoType = Constants.UdiEntityType.ToUmbracoObjectType(udi.EntityType); + var umbracoType = UdiEntityTypeHelper.ToUmbracoObjectType(udi.EntityType); var entityService = Current.Services.EntityService; switch (umbracoType) @@ -423,7 +423,7 @@ namespace Umbraco.Web.Security var memberType = _memberTypeService.Get(member.ContentTypeId); - var builtIns = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); + var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); model.MemberProperties = GetMemberPropertiesViewModel(memberType, builtIns, member).ToList(); @@ -450,7 +450,7 @@ namespace Umbraco.Web.Security if (memberType == null) throw new InvalidOperationException("Could not find a member type with alias " + memberTypeAlias); - var builtIns = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); + var builtIns = ConventionsHelper.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); var model = RegisterModel.CreateModel(); model.MemberTypeAlias = memberTypeAlias; model.MemberProperties = GetMemberPropertiesViewModel(memberType, builtIns).ToList(); @@ -497,7 +497,7 @@ namespace Umbraco.Web.Security //// for a given property. ////These are the default built-in MVC template types: “Boolean”, “Decimal”, “EmailAddress”, “HiddenInput”, “HTML”, “Object”, “String”, “Text”, and “Url” //// by default we'll render a text box since we've defined that metadata on the UmbracoProperty.Value property directly. - //if (prop.DataTypeId == new Guid(Constants.PropertyEditors.TrueFalse)) + //if (prop.DataTypeId == new Guid(ConstantsCore.PropertyEditors.TrueFalse)) //{ // viewProperty.EditorTemplate = "UmbracoBoolean"; //} diff --git a/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UsersMembershipProvider.cs index c148cdf5e5..f3aa5dd838 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 => ConstantsCore.Security.UserMembershipProviderName; + public override string ProviderName => Constants.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 fb9990326b..30c5ea98c9 100644 --- a/src/Umbraco.Web/Security/SessionIdValidator.cs +++ b/src/Umbraco.Web/Security/SessionIdValidator.cs @@ -96,7 +96,7 @@ namespace Umbraco.Web.Security if (user == null) return false; - var sessionId = currentIdentity.FindFirstValue(ConstantsCore.Security.SessionIdClaimType); + var sessionId = currentIdentity.FindFirstValue(Constants.Security.SessionIdClaimType); if (await manager.ValidateSessionIdAsync(userId, sessionId) == false) return false; diff --git a/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs b/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs index d73b0bf77b..83735ad93f 100644 --- a/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs +++ b/src/Umbraco.Web/Security/UmbracoBackOfficeCookieAuthOptions.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Security { var secureDataFormat1 = secureDataFormat ?? throw new ArgumentNullException(nameof(secureDataFormat)); LoginTimeoutMinutes = globalSettings.TimeOutInMinutes; - AuthenticationType = ConstantsCore.Security.BackOfficeAuthenticationType; + AuthenticationType = Constants.Security.BackOfficeAuthenticationType; SlidingExpiration = true; ExpireTimeSpan = TimeSpan.FromMinutes(LoginTimeoutMinutes); diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 1b47d85cb3..a22a70740d 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -86,7 +86,7 @@ namespace Umbraco.Web.Security { var owinCtx = _httpContext.GetOwinContext(); //ensure it's done for owin too - owinCtx.Authentication.SignOut(ConstantsCore.Security.BackOfficeExternalAuthenticationType); + owinCtx.Authentication.SignOut(Constants.Security.BackOfficeExternalAuthenticationType); var user = UserManager.FindByIdAsync(userId).Result; @@ -104,8 +104,8 @@ namespace Umbraco.Web.Security { _httpContext.UmbracoLogout(); _httpContext.GetOwinContext().Authentication.SignOut( - Core.ConstantsCore.Security.BackOfficeAuthenticationType, - Core.ConstantsCore.Security.BackOfficeExternalAuthenticationType); + Core.Constants.Security.BackOfficeAuthenticationType, + Core.Constants.Security.BackOfficeExternalAuthenticationType); } /// diff --git a/src/Umbraco.Web/Services/DashboardService.cs b/src/Umbraco.Web/Services/DashboardService.cs index 0e25325874..9080a92893 100644 --- a/src/Umbraco.Web/Services/DashboardService.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -67,7 +67,7 @@ namespace Umbraco.Web.Services private bool CheckUserAccessByRules(IUser user, ISectionService sectionService, IEnumerable rules) { - if (user.Id == ConstantsCore.Security.SuperUserId) + if (user.Id == Constants.Security.SuperUserId) return true; var (denyRules, grantRules, grantBySectionRules) = GroupRules(rules); diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index 4602942be1..bf7f04a2f4 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -39,7 +39,7 @@ namespace Umbraco.Web.Templates _languageService = textService ?? throw new ArgumentNullException(nameof(textService)); _webRoutingSection = webRoutingSection ?? throw new ArgumentNullException(nameof(webRoutingSection)); } - + public void Render(int pageId, int? altTemplateId, StringWriter writer) { if (writer == null) throw new ArgumentNullException(nameof(writer)); diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs index f889e94acb..ca42361faf 100644 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ b/src/Umbraco.Web/Templates/TemplateUtilities.cs @@ -226,7 +226,7 @@ namespace Umbraco.Web.Templates if (uploadedImages.ContainsKey(tmpImgPath) == false) { if (mediaParentFolder == Guid.Empty) - mediaFile = mediaService.CreateMedia(mediaItemName, ConstantsCore.System.Root, Constants.Conventions.MediaTypes.Image, userId); + mediaFile = mediaService.CreateMedia(mediaItemName, Constants.System.Root, Constants.Conventions.MediaTypes.Image, userId); else mediaFile = mediaService.CreateMedia(mediaItemName, mediaParentFolder, Constants.Conventions.MediaTypes.Image, userId); diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index b3d3c670a8..f0a860496e 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(ConstantsCore.System.RootString, null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(Constants.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, ConstantsCore.System.Root, queryStrings); + var treeRootNode = await GetTreeRootNode(t, Constants.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(ConstantsCore.System.RootString, null, null, name, TreeNodeCollection.Empty, true); + return TreeRootNode.CreateSingleTreeRoot(Constants.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( - ConstantsCore.System.RootString, + Constants.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 413d0ed5d1..ac75fd831d 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(ConstantsCore.Applications.Content)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.ContentBlueprints, SortOrder = 12, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoApplicationAuthorize(Constants.Applications.Content)] + [Tree(Constants.Applications.Settings, Constants.Trees.ContentBlueprints, SortOrder = 12, TreeGroup = Constants.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 = $"{ConstantsCore.Applications.Settings}/{ConstantsCore.Trees.ContentBlueprints}/intro"; + root.RoutePath = $"{Constants.Applications.Settings}/{Constants.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(ConstantsCore.System.Root, UmbracoObjectTypes.DocumentBlueprint).ToArray(); + var entities = Services.EntityService.GetChildren(Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.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, ConstantsCore.ObjectTypes.DocumentBlueprint, id, queryStrings, ConstantsCore.Icons.ContentType, true); + var treeNode = CreateTreeNode(entity, Constants.ObjectTypes.DocumentBlueprint, id, queryStrings, Constants.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, ConstantsCore.ObjectTypes.DocumentBlueprint, id, queryStrings, "icon-blueprint", false); + var treeNode = CreateTreeNode(entity, Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.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 223cda53ad..1ef0683916 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -14,24 +14,24 @@ using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Search; -using Constants = Umbraco.Core.Constants; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; +using Constants = Umbraco.Core.Constants; 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( - 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)] + 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)] [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 => ConstantsCore.System.RecycleBinContent; + protected override int RecycleBinId => Constants.System.RecycleBinContent; protected override bool RecycleBinSmells => Services.ContentService.RecycleBinSmells(); @@ -68,7 +68,7 @@ namespace Umbraco.Web.Trees var node = CreateTreeNode( entity, - ConstantsCore.ObjectTypes.Document, + Constants.ObjectTypes.Document, parentId, queryStrings, entity.HasChildren); @@ -114,12 +114,12 @@ namespace Umbraco.Web.Trees protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings) { - if (id == ConstantsCore.System.RootString) + if (id == Constants.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(ConstantsCore.System.Root) == false) + if (UserStartNodes.Contains(Constants.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, ConstantsCore.System.Root).First(); + var permission = Services.UserService.GetPermissions(Security.CurrentUser, Constants.System.Root).First(); var nodeActions = _actions.FromEntityPermission(permission) .Select(x => new MenuItem(x)); diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index cc18d9e161..4efbc2adc8 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(ConstantsCore.System.Root) == false && IgnoreUserStartNodes(queryStrings) == false) + if (IsDialog(queryStrings) && UserStartNodes.Contains(Constants.System.Root) == false && IgnoreUserStartNodes(queryStrings) == false) { node.AdditionalData["noAccess"] = true; } @@ -125,11 +125,11 @@ namespace Umbraco.Web.Trees { switch (RecycleBinId) { - case ConstantsCore.System.RecycleBinMedia: + case Constants.System.RecycleBinMedia: startNodeIds = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService); startNodePaths = Security.CurrentUser.GetMediaStartNodePaths(Services.EntityService); break; - case ConstantsCore.System.RecycleBinContent: + case Constants.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 = ConstantsCore.System.RootString; - var hasAccessToRoot = UserStartNodes.Contains(ConstantsCore.System.Root); + var rootIdString = Constants.System.RootString; + var hasAccessToRoot = UserStartNodes.Contains(Constants.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 == ConstantsCore.System.Root && UserStartNodes.Contains(ConstantsCore.System.Root) == false) + if (!ignoreUserStartNodes && entityId == Constants.System.Root && UserStartNodes.Contains(Constants.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 == ConstantsCore.System.RecycleBinContent + return RecycleBinId == Constants.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 == ConstantsCore.System.RootString && UserStartNodes.Contains(ConstantsCore.System.Root)) + if (id == Constants.System.RootString && UserStartNodes.Contains(Constants.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 != ConstantsCore.System.RootString) + if (string.IsNullOrEmpty(altStartId) == false && altStartId != "undefined" && altStartId != Constants.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 == ConstantsCore.System.RootString) + if (IsDialog(queryStrings) == false && id == Constants.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(ConstantsCore.System.Root) == false) + if (isContainer && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.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(ConstantsCore.System.RecycleBinContentString, Services.UserService); + var perms = Security.CurrentUser.GetPermissions(Constants.System.RecycleBinContentString, Services.UserService); deleteAllowed = perms.FirstOrDefault(x => x.Contains(deleteAction.Letter)) != null; } diff --git a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs index d65ee9a4cf..e8f8fb9f75 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(ConstantsCore.Trees.DocumentTypes)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.DocumentTypes, SortOrder = 0, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.DocumentTypes)] + [Tree(Constants.Applications.Settings, Constants.Trees.DocumentTypes, SortOrder = 0, TreeGroup = Constants.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, ConstantsCore.ObjectTypes.DocumentType, id, queryStrings, ConstantsCore.Icons.ContentType, hasChildren); + var node = CreateTreeNode(dt, Constants.ObjectTypes.DocumentType, id, queryStrings, Constants.Icons.ContentType, hasChildren); node.Path = dt.Path; @@ -91,7 +91,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.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 d60fc5c4a5..b39feeae6c 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -11,17 +11,17 @@ using Umbraco.Web.WebApi.Filters; using Umbraco.Core.Services; using Umbraco.Web.Actions; using Umbraco.Web.Models.ContentEditing; -using Constants = Umbraco.Core.Constants; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Web.Search; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(ConstantsCore.Trees.DataTypes)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.DataTypes, SortOrder = 3, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.DataTypes)] + [Tree(Constants.Applications.Settings, Constants.Trees.DataTypes, SortOrder = 3, TreeGroup = Constants.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, ConstantsCore.ObjectTypes.DataType, id, queryStrings, "icon-folder", dt.HasChildren); + var node = CreateTreeNode(dt, Constants.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, ConstantsCore.Icons.DataType, false); + var node = CreateTreeNode(dt.Id.ToInvariantString(), id, queryStrings, dt.Name, Constants.Icons.DataType, false); node.Path = dt.Path; if (systemListViewDataTypeIds.Contains(dt.Id)) { - node.Icon = ConstantsCore.Icons.ListView; + node.Icon = Constants.Icons.ListView; } return node; })); @@ -84,15 +84,15 @@ namespace Umbraco.Web.Trees { var systemIds = new[] { - 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" + 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" }; return systemIds.Concat(GetNonDeletableSystemListViewDataTypeIds()); @@ -105,9 +105,9 @@ namespace Umbraco.Web.Trees { return new[] { - ConstantsCore.DataTypes.DefaultContentListView, - ConstantsCore.DataTypes.DefaultMediaListView, - ConstantsCore.DataTypes.DefaultMembersListView + Constants.DataTypes.DefaultContentListView, + Constants.DataTypes.DefaultMediaListView, + Constants.DataTypes.DefaultMembersListView }; } @@ -115,7 +115,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.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 c627ec3b16..3f7b89bcdf 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -11,14 +11,14 @@ namespace Umbraco.Web.Trees { [UmbracoTreeAuthorize( - ConstantsCore.Trees.Dictionary, - ConstantsCore.Trees.Templates + Constants.Trees.Dictionary, + Constants.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(ConstantsCore.Applications.Translation, ConstantsCore.Trees.Dictionary, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, TreeGroup = Constants.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 = ConstantsCore.Applications.Translation; + var section = Constants.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}/{ConstantsCore.Trees.Dictionary}/list"; + root.RoutePath = $"{section}/{Constants.Trees.Dictionary}/list"; return root; } @@ -58,7 +58,7 @@ namespace Umbraco.Web.Trees Func ItemSort() => item => item.ItemKey; - if (id == ConstantsCore.System.RootString) + if (id == Constants.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 != ConstantsCore.System.RootString) + if (id != Constants.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 69167fca02..9bbe05b0ce 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -8,8 +8,6 @@ using Umbraco.Core.IO; using Umbraco.Web.Actions; using Umbraco.Web.Models.Trees; -using Constants = Umbraco.Core.Constants; - namespace Umbraco.Web.Trees { public abstract class FileSystemTreeController : TreeController @@ -35,7 +33,7 @@ namespace Umbraco.Web.Trees protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { - var path = string.IsNullOrEmpty(id) == false && id != ConstantsCore.System.RootString + var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; @@ -84,7 +82,7 @@ namespace Umbraco.Web.Trees { var root = base.CreateRootNode(queryStrings); //check if there are any children - root.HasChildren = GetTreeNodes(ConstantsCore.System.RootString, queryStrings).Any(); + root.HasChildren = GetTreeNodes(Constants.System.RootString, queryStrings).Any(); return root; } @@ -139,14 +137,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 == ConstantsCore.System.RootString) + if (id == Constants.System.RootString) { return GetMenuForRootNode(queryStrings); } var menu = new MenuItemCollection(); - var path = string.IsNullOrEmpty(id) == false && id != ConstantsCore.System.RootString + var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString ? HttpUtility.UrlDecode(id).TrimStart("/") : ""; diff --git a/src/Umbraco.Web/Trees/FilesTreeController.cs b/src/Umbraco.Web/Trees/FilesTreeController.cs index 8feb183805..ae951bebf4 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(ConstantsCore.Applications.Settings, "files", TreeTitle = "Files", TreeUse = TreeUse.Dialog)] + [Tree(Constants.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 => ConstantsCore.Icons.MediaFile; + protected override string FileIcon => Constants.Icons.MediaFile; } } diff --git a/src/Umbraco.Web/Trees/LanguageTreeController.cs b/src/Umbraco.Web/Trees/LanguageTreeController.cs index 9c932ccf34..944cbd103c 100644 --- a/src/Umbraco.Web/Trees/LanguageTreeController.cs +++ b/src/Umbraco.Web/Trees/LanguageTreeController.cs @@ -3,7 +3,7 @@ using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.ConstantsCore; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { @@ -34,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 = $"{ConstantsCore.Applications.Settings}/{ConstantsCore.Trees.Languages}/overview"; + root.RoutePath = $"{Constants.Applications.Settings}/{Constants.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 f7da2a48be..6f274babeb 100644 --- a/src/Umbraco.Web/Trees/LogViewerTreeController.cs +++ b/src/Umbraco.Web/Trees/LogViewerTreeController.cs @@ -7,8 +7,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(ConstantsCore.Trees.LogViewer)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.LogViewer, SortOrder= 9, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.LogViewer)] + [Tree(Constants.Applications.Settings, Constants.Trees.LogViewer, SortOrder= 9, TreeGroup = Constants.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class LogViewerTreeController : TreeController @@ -34,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}", ConstantsCore.Applications.Settings, ConstantsCore.Trees.LogViewer, "overview"); + root.RoutePath = string.Format("{0}/{1}/{2}", Constants.Applications.Settings, Constants.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 f18bf9a5cf..cbe1946779 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(ConstantsCore.Trees.Macros)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Macros, TreeTitle = "Macros", SortOrder = 4, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.Macros)] + [Tree(Constants.Applications.Settings, Constants.Trees.Macros, TreeTitle = "Macros", SortOrder = 4, TreeGroup = Constants.Trees.Groups.Settings)] [PluginController("UmbracoTrees")] [CoreTree] public class MacrosTreeController : TreeController @@ -27,7 +27,7 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.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, - ConstantsCore.Icons.Macro, + Constants.Icons.Macro, false)); } } @@ -48,7 +48,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.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 4b854fa8f0..d3ca44a0ac 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -14,24 +14,24 @@ using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Search; -using Constants = Umbraco.Core.Constants; using Umbraco.Core.Services.Implement; using Umbraco.Core.Cache; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; +using Constants = Umbraco.Core.Constants; 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( - ConstantsCore.Applications.Content, - ConstantsCore.Applications.Media, - ConstantsCore.Applications.Settings, - ConstantsCore.Applications.Packages, - ConstantsCore.Applications.Members)] - [Tree(ConstantsCore.Applications.Media, ConstantsCore.Trees.Media)] + Constants.Applications.Content, + Constants.Applications.Media, + Constants.Applications.Settings, + Constants.Applications.Packages, + Constants.Applications.Members)] + [Tree(Constants.Applications.Media, Constants.Trees.Media)] [PluginController("UmbracoTrees")] [CoreTree] [SearchableTree("searchResultFormatter", "configureMediaResult", 20)] @@ -44,7 +44,7 @@ namespace Umbraco.Web.Trees _treeSearcher = treeSearcher; } - protected override int RecycleBinId => ConstantsCore.System.RecycleBinMedia; + protected override int RecycleBinId => Constants.System.RecycleBinMedia; protected override bool RecycleBinSmells => Services.MediaService.RecycleBinSmells(); @@ -63,7 +63,7 @@ namespace Umbraco.Web.Trees { var node = CreateTreeNode( entity, - ConstantsCore.ObjectTypes.Media, + Constants.ObjectTypes.Media, parentId, queryStrings, entity.HasChildren); @@ -90,10 +90,10 @@ namespace Umbraco.Web.Trees //set the default menu.DefaultMenuAlias = ActionNew.ActionAlias; - if (id == ConstantsCore.System.RootString) + if (id == Constants.System.RootString) { // if the user's start node is not the root then the only menu item to display is refresh - if (UserStartNodes.Contains(ConstantsCore.System.Root) == false) + if (UserStartNodes.Contains(Constants.System.Root) == false) { menu.Items.Add(new RefreshNode(Services.TextService, true)); return menu; diff --git a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs index 3cb25eff5b..f85aefcace 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(ConstantsCore.Trees.MediaTypes)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.MediaTypes, SortOrder = 1, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.MediaTypes)] + [Tree(Constants.Applications.Settings, Constants.Trees.MediaTypes, SortOrder = 1, TreeGroup = Constants.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, ConstantsCore.ObjectTypes.MediaType, id, queryStrings, ConstantsCore.Icons.MediaType, hasChildren); + var node = CreateTreeNode(dt, Constants.ObjectTypes.MediaType, id, queryStrings, Constants.Icons.MediaType, hasChildren); node.Path = dt.Path; return node; @@ -75,7 +75,7 @@ namespace Umbraco.Web.Trees { var menu = new MenuItemCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.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 fd783a9065..54c499d717 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(ConstantsCore.Trees.MemberGroups)] - [Tree(ConstantsCore.Applications.Members, ConstantsCore.Trees.MemberGroups, SortOrder = 1)] + [UmbracoTreeAuthorize(Constants.Trees.MemberGroups)] + [Tree(Constants.Applications.Members, Constants.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, ConstantsCore.Icons.MemberGroup, false)); + .Select(dt => CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, Constants.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 3284fdc964..c0a9d15cfa 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( - ConstantsCore.Applications.Content, - ConstantsCore.Applications.Media, - ConstantsCore.Applications.Members)] - [Tree(ConstantsCore.Applications.Members, ConstantsCore.Trees.Members, SortOrder = 0)] + Constants.Applications.Content, + Constants.Applications.Media, + Constants.Applications.Members)] + [Tree(Constants.Applications.Members, Constants.Trees.Members, SortOrder = 0)] [PluginController("UmbracoTrees")] [CoreTree] [SearchableTree("searchResultFormatter", "configureMemberResult")] @@ -80,10 +80,10 @@ namespace Umbraco.Web.Trees "-1", queryStrings, member.Name, - ConstantsCore.Icons.Member, + Constants.Icons.Member, false, "", - Udi.Create(ObjectTypes.GetUdiType(ConstantsCore.ObjectTypes.Member), member.Key)); + Udi.Create(ObjectTypes.GetUdiType(Constants.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, - ConstantsCore.Icons.Member, + Constants.Icons.Member, false); return node; @@ -121,17 +121,17 @@ namespace Umbraco.Web.Trees { var nodes = new TreeNodeCollection(); - if (id == ConstantsCore.System.RootString) + if (id == Constants.System.RootString) { nodes.Add( - CreateTreeNode(Constants.Conventions.MemberTypes.AllMembersListId, id, queryStrings, Services.TextService.Localize("member/allMembers"), ConstantsCore.Icons.MemberType, true, + CreateTreeNode(Constants.Conventions.MemberTypes.AllMembersListId, id, queryStrings, Services.TextService.Localize("member/allMembers"), Constants.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(ConstantsCore.Icons.Member), true, + CreateTreeNode(memberType.Alias, id, queryStrings, memberType.Name, memberType.Icon.IfNullOrWhiteSpace(Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.System.RootString) { // root actions if (_provider.IsUmbracoMembershipProvider()) diff --git a/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs b/src/Umbraco.Web/Trees/MemberTypeAndGroupTreeControllerBase.cs index cbf48fd394..5e71266bca 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 == ConstantsCore.System.RootString) + if (id == Constants.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 1363c4af1c..bd80f63897 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(ConstantsCore.Trees.MemberTypes)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.MemberTypes, SortOrder = 2, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.MemberTypes)] + [Tree(Constants.Applications.Settings, Constants.Trees.MemberTypes, SortOrder = 2, TreeGroup = Constants.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, ConstantsCore.ObjectTypes.MemberType, id, queryStrings, ConstantsCore.Icons.MemberType, false)); + .Select(dt => CreateTreeNode(dt, Constants.ObjectTypes.MemberType, id, queryStrings, Constants.Icons.MemberType, false)); } } } diff --git a/src/Umbraco.Web/Trees/PackagesTreeController.cs b/src/Umbraco.Web/Trees/PackagesTreeController.cs index a41b030edb..90a41c050c 100644 --- a/src/Umbraco.Web/Trees/PackagesTreeController.cs +++ b/src/Umbraco.Web/Trees/PackagesTreeController.cs @@ -3,8 +3,7 @@ using Umbraco.Core; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; - -using Constants = Umbraco.Core.ConstantsCore; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { @@ -23,7 +22,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 = $"{ConstantsCore.Applications.Packages}/{ConstantsCore.Trees.Packages}/repo"; + root.RoutePath = $"{Constants.Applications.Packages}/{Constants.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 22e249a71c..41fecefef3 100644 --- a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs @@ -4,7 +4,7 @@ using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.ConstantsCore; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { diff --git a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs index 74f4ae88e9..9fa0c025d6 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs @@ -3,14 +3,14 @@ using Umbraco.Web.Composing; using Umbraco.Web.Models.Trees; using Umbraco.Web.Mvc; using Umbraco.Web.WebApi.Filters; -using Constants = Umbraco.Core.ConstantsCore; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { /// /// Tree for displaying partial views in the settings app /// - [Tree(Constants.Applications.Settings, Constants.Trees.PartialViews, SortOrder = 7, TreeGroup = Constants.Trees.Groups.Templating)] + [Tree(Core.Constants.Applications.Settings, Core.Constants.Trees.PartialViews, SortOrder = 7, TreeGroup = Core.Constants.Trees.Groups.Templating)] [UmbracoTreeAuthorize(Constants.Trees.PartialViews)] [PluginController("UmbracoTrees")] [CoreTree] diff --git a/src/Umbraco.Web/Trees/RelationTypeTreeController.cs b/src/Umbraco.Web/Trees/RelationTypeTreeController.cs index 7a0bff5997..ab6dd39820 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(ConstantsCore.Trees.RelationTypes)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.RelationTypes, SortOrder = 5, TreeGroup = ConstantsCore.Trees.Groups.Settings)] + [UmbracoTreeAuthorize(Constants.Trees.RelationTypes)] + [Tree(Constants.Applications.Settings, Constants.Trees.RelationTypes, SortOrder = 5, TreeGroup = Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.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 22da0a2796..7c00d085b7 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(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Scripts, TreeTitle = "Scripts", SortOrder = 10, TreeGroup = ConstantsCore.Trees.Groups.Templating)] + [Tree(Constants.Applications.Settings, Constants.Trees.Scripts, TreeTitle = "Scripts", SortOrder = 10, TreeGroup = Constants.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 15bd6e637a..f96a83018d 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(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Stylesheets, TreeTitle = "Stylesheets", SortOrder = 9, TreeGroup = ConstantsCore.Trees.Groups.Templating)] + [Tree(Constants.Applications.Settings, Constants.Trees.Stylesheets, TreeTitle = "Stylesheets", SortOrder = 9, TreeGroup = Constants.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 13ca08bfc9..d0ca8d1b2e 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(ConstantsCore.Trees.Templates)] - [Tree(ConstantsCore.Applications.Settings, ConstantsCore.Trees.Templates, SortOrder = 6, TreeGroup = ConstantsCore.Trees.Groups.Templating)] + [UmbracoTreeAuthorize(Constants.Trees.Templates)] + [Tree(Constants.Applications.Settings, Constants.Trees.Templates, SortOrder = 6, TreeGroup = Constants.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 == ConstantsCore.System.RootString + var found = id == Constants.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(ConstantsCore.ObjectTypes.TemplateType), template.Key) + Udi.Create(ObjectTypes.GetUdiType(Constants.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 == ConstantsCore.System.RootString) + if (id == Constants.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 = ConstantsCore.ObjectTypes.Template, + NodeObjectType = Constants.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 25c59cbd5e..77e5ebef62 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 = ConstantsCore.System.RootString; + var rootNodeAsString = Constants.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 41109d57ce..475fbad2a8 100644 --- a/src/Umbraco.Web/Trees/UserTreeController.cs +++ b/src/Umbraco.Web/Trees/UserTreeController.cs @@ -7,8 +7,8 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { - [UmbracoTreeAuthorize(ConstantsCore.Trees.Users)] - [Tree(ConstantsCore.Applications.Users, ConstantsCore.Trees.Users, SortOrder = 0, IsSingleNodeTree = true)] + [UmbracoTreeAuthorize(Constants.Trees.Users)] + [Tree(Constants.Applications.Users, Constants.Trees.Users, SortOrder = 0, IsSingleNodeTree = true)] [PluginController("UmbracoTrees")] [CoreTree] public class UserTreeController : TreeController @@ -22,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 = $"{ConstantsCore.Applications.Users}/{ConstantsCore.Trees.Users}/users"; - root.Icon = ConstantsCore.Icons.UserGroup; + root.RoutePath = $"{Constants.Applications.Users}/{Constants.Trees.Users}/users"; + root.Icon = Constants.Icons.UserGroup; root.HasChildren = false; return root; diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 367d90a504..705d72f3dd 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -12,7 +12,6 @@ using Umbraco.Core.Xml; using Umbraco.Web.Composing; using Umbraco.Web.Mvc; using Umbraco.Web.Security; -using Constants = Umbraco.Core.Constants; namespace Umbraco.Web { @@ -241,7 +240,7 @@ namespace Umbraco.Web var guidUdi = udi as GuidUdi; if (guidUdi == null) return null; - var umbracoType = Constants.UdiEntityType.ToUmbracoObjectType(udi.EntityType); + var umbracoType = UdiEntityTypeHelper.ToUmbracoObjectType(udi.EntityType); switch (umbracoType) { diff --git a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingContentAttribute.cs index 36be5b8a8f..8c20d437d7 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 ConstantsCore.System.RecycleBinContent; } + get { return Constants.System.RecycleBinContent; } } internal void FilterBasedOnPermissions(IList items, IUser user) diff --git a/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FilterAllowedOutgoingMediaAttribute.cs index b5a49d9b73..21dc60e6cc 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 => ConstantsCore.System.RecycleBinMedia; + protected virtual int RecycleBinId => Constants.System.RecycleBinMedia; public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) {