From 1cd4862803e878ef41edf2705c2ff97cf36432cf Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 31 May 2018 16:52:38 +1000 Subject: [PATCH] Fixes user Id is 0 everywhere --- .../Migrations/Install/DatabaseDataCreator.cs | 68 +++++++++---------- .../Packaging/PackageInstallation.cs | 12 ++-- .../Services/ContentServiceExtensions.cs | 2 +- src/Umbraco.Core/Services/IContentService.cs | 56 +++++++-------- .../Services/IContentTypeServiceBase.cs | 16 ++--- src/Umbraco.Core/Services/IDataTypeService.cs | 14 ++-- src/Umbraco.Core/Services/IFileService.cs | 30 ++++---- .../Services/ILocalizationService.cs | 8 +-- src/Umbraco.Core/Services/IMacroService.cs | 4 +- src/Umbraco.Core/Services/IMediaService.cs | 38 +++++------ .../Services/IPackagingService.cs | 14 ++-- .../Services/Implement/ContentService.cs | 52 +++++++------- ...peServiceBaseOfTRepositoryTItemTService.cs | 16 ++--- .../Services/Implement/DataTypeService.cs | 14 ++-- .../Services/Implement/EntityService.cs | 2 +- .../Services/Implement/FileService.cs | 36 +++++----- .../Services/Implement/LocalizationService.cs | 8 +-- .../Services/Implement/MacroService.cs | 4 +- .../Services/Implement/MediaService.cs | 34 +++++----- .../Services/Implement/PackagingService.cs | 18 ++--- .../Querying/ContentTypeSqlMappingTests.cs | 20 +++--- .../NotificationsRepositoryTest.cs | 12 ++-- .../Services/ContentServiceTests.cs | 2 +- .../Services/PerformanceTests.cs | 2 +- .../TestHelpers/TestObjects-Mocks.cs | 14 ++-- .../EnsureListViewDataTypeIsCreated.cs | 6 +- .../Models/Mapping/MemberMapperProfile.cs | 2 +- 27 files changed, 252 insertions(+), 252 deletions(-) diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index 77bd1f6280..385c2979d4 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -81,44 +81,44 @@ namespace Umbraco.Core.Migrations.Install private void CreateNodeData() { - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = 0, 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 = 0, 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 = 0, 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 }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -92, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-92", SortOrder = 35, UniqueId = new Guid("f0bc4bfb-b499-40d6-ba86-058885a5178c"), Text = "Label", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = new Guid("84c6b441-31df-4ffe-b67e-67d5bc3ae65a"), Text = "Upload", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textarea", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae"), Text = "Textstring", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad"), 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 = 0, Level = 1, Path = "-1,-51", SortOrder = 2, UniqueId = new Guid("2e6d3631-066e-44b8-aec4-96f09099b2b5"), Text = "Numeric", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -49, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-49", SortOrder = 2, UniqueId = new Guid("92897bc6-a5f3-4ffe-ae27-f2e7e33dda49"), 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 = 0, Level = 1, Path = "-1,-43", SortOrder = 2, UniqueId = new Guid("fbaf13a8-4036-41f2-93a3-974f678c312a"), Text = "Checkbox list", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -42, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-42", SortOrder = 2, UniqueId = new Guid("0b6a45e7-44ba-430d-9da5-4e46060b9e03"), 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 = 0, Level = 1, Path = "-1,-41", SortOrder = 2, UniqueId = new Guid("5046194e-4237-453c-a547-15db3a07c4e1"), 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 = 0, Level = 1, Path = "-1,-40", SortOrder = 2, UniqueId = new Guid("bb5f57c9-ce2b-4bb9-b697-4caca783a805"), Text = "Radiobox", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -39, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-39", SortOrder = 2, UniqueId = new Guid("f38f0ac7-1d27-439c-9f3f-089cd8825a53"), 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 = 0, Level = 1, Path = "-1,-37", SortOrder = 2, UniqueId = new Guid("0225af17-b302-49cb-9176-b9f35cab9c17"), Text = "Approved Color", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -36, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-36", SortOrder = 2, UniqueId = new Guid("e4d66c0f-b935-4200-81f0-025f7256b89a"), 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 = 0, Level = 1, Path = "-1,-95", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), 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 = 0, Level = 1, Path = "-1,-96", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), 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 = 0, Level = 1, Path = "-1,-97", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), 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 = 0, 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 = 0, 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 = 0, 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 = 1041, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1041", 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 = 1043, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1043", 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 = 0, Level = 1, Path = "-1,1044", SortOrder = 0, UniqueId = new Guid("d59be02f-1df9-4228-aa1e-01917d806cda"), Text = Constants.Conventions.MemberTypes.DefaultAlias, NodeObjectType = Constants.ObjectTypes.MemberType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -1, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1", SortOrder = 0, UniqueId = new Guid("916724a5-173d-4619-b97e-b9de133dd6f5"), Text = "SYSTEM DATA: umbraco master root", NodeObjectType = 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 }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -92, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-92", SortOrder = 35, UniqueId = new Guid("f0bc4bfb-b499-40d6-ba86-058885a5178c"), Text = "Label", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -90, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-90", SortOrder = 34, UniqueId = new Guid("84c6b441-31df-4ffe-b67e-67d5bc3ae65a"), Text = "Upload", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -89, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-89", SortOrder = 33, UniqueId = new Guid("c6bac0dd-4ab9-45b1-8e30-e4b619ee5da3"), Text = "Textarea", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -88, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-88", SortOrder = 32, UniqueId = new Guid("0cc0eba1-9960-42c9-bf9b-60e150b429ae"), Text = "Textstring", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -87, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-87", SortOrder = 4, UniqueId = new Guid("ca90c950-0aff-4e72-b976-a30b1ac57dad"), 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 = new Guid("2e6d3631-066e-44b8-aec4-96f09099b2b5"), Text = "Numeric", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -49, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-49", SortOrder = 2, UniqueId = new Guid("92897bc6-a5f3-4ffe-ae27-f2e7e33dda49"), 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 = new Guid("fbaf13a8-4036-41f2-93a3-974f678c312a"), Text = "Checkbox list", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -42, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-42", SortOrder = 2, UniqueId = new Guid("0b6a45e7-44ba-430d-9da5-4e46060b9e03"), 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 = new Guid("5046194e-4237-453c-a547-15db3a07c4e1"), 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 = new Guid("bb5f57c9-ce2b-4bb9-b697-4caca783a805"), Text = "Radiobox", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -39, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-39", SortOrder = 2, UniqueId = new Guid("f38f0ac7-1d27-439c-9f3f-089cd8825a53"), 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 = new Guid("0225af17-b302-49cb-9176-b9f35cab9c17"), Text = "Approved Color", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = -36, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-36", SortOrder = 2, UniqueId = new Guid("e4d66c0f-b935-4200-81f0-025f7256b89a"), 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,-95", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), 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,-96", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), 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,-97", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), 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 = 1041, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1041", 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 = 1043, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1043", 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 = 0, 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 = 0, 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 = 0, 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 = 0, 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 = 0, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Related Links", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1046, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1046", SortOrder = 2, UniqueId = new Guid("FD1E0DA5-5606-4862-B679-5D0CF3A52A59"), Text = "Content Picker", NodeObjectType = 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 = "Related Links", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); //TODO: We're not creating these for 7.0 - //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1039, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1039", SortOrder = 2, UniqueId = new Guid("06f349a9-c949-4b6a-8660-59c10451af42"), Text = "Ultimate Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1038, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1038", SortOrder = 2, UniqueId = new Guid("1251c96c-185c-4e9b-93f4-b48205573cbd"), Text = "Simple Editor", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1042, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,1042", SortOrder = 2, UniqueId = new Guid("0a452bd5-83f9-4bc3-8403-1286e13fb77e"), Text = "Macro Container", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1039, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1039", SortOrder = 2, UniqueId = new Guid("06f349a9-c949-4b6a-8660-59c10451af42"), Text = "Ultimate Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1038, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1038", SortOrder = 2, UniqueId = new Guid("1251c96c-185c-4e9b-93f4-b48205573cbd"), Text = "Simple Editor", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + //_database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1042, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1042", SortOrder = 2, UniqueId = new Guid("0a452bd5-83f9-4bc3-8403-1286e13fb77e"), Text = "Macro Container", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); } private void CreateLockData() diff --git a/src/Umbraco.Core/Packaging/PackageInstallation.cs b/src/Umbraco.Core/Packaging/PackageInstallation.cs index 2e33bfbf2b..bee9efb612 100644 --- a/src/Umbraco.Core/Packaging/PackageInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageInstallation.cs @@ -309,7 +309,7 @@ namespace Umbraco.Core.Packaging }).ToArray(); } - private IEnumerable InstallDocuments(XElement documentsElement, int userId = 0) + private IEnumerable InstallDocuments(XElement documentsElement, int userId = -1) { if ((string.Equals(Constants.Packaging.DocumentSetNodeName, documentsElement.Name.LocalName) == false) && (string.Equals(Constants.Packaging.DocumentsNodeName, documentsElement.Name.LocalName) == false)) @@ -341,7 +341,7 @@ namespace Umbraco.Core.Packaging throw new NotImplementedException("The packaging service do not yes have a method for importing stylesheets"); } - private IEnumerable InstallDocumentTypes(XElement documentTypes, int userId = 0) + private IEnumerable InstallDocumentTypes(XElement documentTypes, int userId = -1) { if (string.Equals(Constants.Packaging.DocumentTypesNodeName, documentTypes.Name.LocalName) == false) { @@ -355,7 +355,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportContentTypes(documentTypes, userId); } - private IEnumerable InstallTemplats(XElement templateElement, int userId = 0) + private IEnumerable InstallTemplats(XElement templateElement, int userId = -1) { if (string.Equals(Constants.Packaging.TemplatesNodeName, templateElement.Name.LocalName) == false) { @@ -382,7 +382,7 @@ namespace Umbraco.Core.Packaging sd => new KeyValuePair(sd.Key, Path.Combine(fullpathToRoot, sd.Value))).ToArray(); } - private IEnumerable InstallMacros(XElement macroElements, int userId = 0) + private IEnumerable InstallMacros(XElement macroElements, int userId = -1) { if (string.Equals(Constants.Packaging.MacrosNodeName, macroElements.Name.LocalName) == false) { @@ -403,7 +403,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportDictionaryItems(dictionaryItemsElement); } - private IEnumerable InstallLanguages(XElement languageElement, int userId = 0) + private IEnumerable InstallLanguages(XElement languageElement, int userId = -1) { if (string.Equals(Constants.Packaging.LanguagesNodeName, languageElement.Name.LocalName) == false) { @@ -412,7 +412,7 @@ namespace Umbraco.Core.Packaging return _packagingService.ImportLanguages(languageElement, userId); } - private IEnumerable InstallDataTypes(XElement dataTypeElements, int userId = 0) + private IEnumerable InstallDataTypes(XElement dataTypeElements, int userId = -1) { if (string.Equals(Constants.Packaging.DataTypesNodeName, dataTypeElements.Name.LocalName) == false) { diff --git a/src/Umbraco.Core/Services/ContentServiceExtensions.cs b/src/Umbraco.Core/Services/ContentServiceExtensions.cs index 2f6e043c88..8ae3b921ad 100644 --- a/src/Umbraco.Core/Services/ContentServiceExtensions.cs +++ b/src/Umbraco.Core/Services/ContentServiceExtensions.cs @@ -34,7 +34,7 @@ namespace Umbraco.Core.Services /// /// /// - public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string mediaTypeAlias, int userId = 0) + public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string mediaTypeAlias, int userId = -1) { var guidUdi = parentId as GuidUdi; if (guidUdi == null) diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index a08f2291b4..2b39a6002c 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -32,27 +32,27 @@ namespace Umbraco.Core.Services /// /// Saves a blueprint. /// - void SaveBlueprint(IContent content, int userId = 0); + void SaveBlueprint(IContent content, int userId = -1); /// /// Deletes a blueprint. /// - void DeleteBlueprint(IContent content, int userId = 0); + void DeleteBlueprint(IContent content, int userId = -1); /// /// Creates a new content item from a blueprint. /// - IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0); + IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1); /// /// Deletes blueprints for a content type. /// - void DeleteBlueprintsOfType(int contentTypeId, int userId = 0); + void DeleteBlueprintsOfType(int contentTypeId, int userId = -1); /// /// Deletes blueprints for content types. /// - void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = 0); + void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = -1); #endregion @@ -251,13 +251,13 @@ namespace Umbraco.Core.Services /// /// Saves a document. /// - OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true); + OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true); /// /// Saves documents. /// // fixme why only 1 result not 1 per content?! - OperationResult Save(IEnumerable contents, int userId = 0, bool raiseEvents = true); + OperationResult Save(IEnumerable contents, int userId = -1, bool raiseEvents = true); /// /// Deletes a document. @@ -266,7 +266,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 = 0); + OperationResult Delete(IContent content, int userId = -1); /// /// Deletes all documents of a given document type. @@ -275,7 +275,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 = 0); + void DeleteOfType(int documentTypeId, int userId = -1); /// /// Deletes all documents of given document types. @@ -284,17 +284,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 = 0); + void DeleteOfTypes(IEnumerable contentTypeIds, int userId = -1); /// /// Deletes versions of a document prior to a given date. /// - void DeleteVersions(int id, DateTime date, int userId = 0); + void DeleteVersions(int id, DateTime date, int userId = -1); /// /// Deletes a version of a document. /// - void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1); #endregion @@ -303,7 +303,7 @@ namespace Umbraco.Core.Services /// /// Moves a document under a new parent. /// - void Move(IContent content, int parentId, int userId = 0); + void Move(IContent content, int parentId, int userId = -1); /// /// Copies a document. @@ -311,7 +311,7 @@ namespace Umbraco.Core.Services /// /// Recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0); + IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1); /// /// Copies a document. @@ -319,12 +319,12 @@ namespace Umbraco.Core.Services /// /// Optionaly recursively copies all children. /// - IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = 0); + IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1); /// /// Moves a document to the recycle bin. /// - OperationResult MoveToRecycleBin(IContent content, int userId = 0); + OperationResult MoveToRecycleBin(IContent content, int userId = -1); /// /// Empties the recycle bin. @@ -334,12 +334,12 @@ namespace Umbraco.Core.Services /// /// Sorts documents. /// - bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true); /// /// Sorts documents. /// - bool Sort(IEnumerable ids, int userId = 0, bool raiseEvents = true); + bool Sort(IEnumerable ids, int userId = -1, bool raiseEvents = true); #endregion @@ -349,22 +349,22 @@ namespace Umbraco.Core.Services /// Saves and publishes a document. /// /// Property values must first be published at document level. - PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true); + PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true); /// /// Saves and publishes a document branch. /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0); + IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1); /// /// Saves and publishes a document branch. /// - IEnumerable SaveAndPublishBranch(IContent content, bool force, Func editing, Func publishValues, int userId = 0); + IEnumerable SaveAndPublishBranch(IContent content, bool force, Func editing, Func publishValues, int userId = -1); /// /// Unpublishes a document or optionally unpublishes a culture and/or segment for the document. /// - UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = 0); + UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = -1); /// /// Gets a value indicating whether a document is path-publishable. @@ -381,7 +381,7 @@ namespace Umbraco.Core.Services /// /// Saves a document and raises the "sent to publication" events. /// - bool SendToPublication(IContent content, int userId = 0); + bool SendToPublication(IContent content, int userId = -1); /// /// Publishes and unpublishes scheduled documents. @@ -416,27 +416,27 @@ namespace Umbraco.Core.Services /// /// Creates a document. /// - IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = 0); + IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = -1); /// /// Creates a document. /// - IContent Create(string name, int parentId, string documentTypeAlias, int userId = 0); + IContent Create(string name, int parentId, string documentTypeAlias, int userId = -1); /// /// Creates a document. /// - IContent Create(string name, IContent parent, string documentTypeAlias, int userId = 0); + IContent Create(string name, IContent parent, string documentTypeAlias, int userId = -1); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0); + IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1); /// /// Creates and saves a document. /// - IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0); + IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1); #endregion } diff --git a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs index bc091535d3..020387e099 100644 --- a/src/Umbraco.Core/Services/IContentTypeServiceBase.cs +++ b/src/Umbraco.Core/Services/IContentTypeServiceBase.cs @@ -25,11 +25,11 @@ namespace Umbraco.Core.Services IEnumerable GetChildren(int id); bool HasChildren(int id); - void Save(TItem item, int userId = 0); - void Save(IEnumerable items, int userId = 0); + void Save(TItem item, int userId = -1); + void Save(IEnumerable items, int userId = -1); - void Delete(TItem item, int userId = 0); - void Delete(IEnumerable item, int userId = 0); + void Delete(TItem item, int userId = -1); + void Delete(IEnumerable item, int userId = -1); Attempt ValidateComposition(TItem compo); @@ -41,15 +41,15 @@ namespace Umbraco.Core.Services /// bool HasContainerInPath(string contentPath); - Attempt> CreateContainer(int parentContainerId, string name, int userId = 0); - Attempt SaveContainer(EntityContainer container, int userId = 0); + Attempt> CreateContainer(int parentContainerId, string name, int userId = -1); + Attempt SaveContainer(EntityContainer container, int userId = -1); 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 = 0); - Attempt> RenameContainer(int id, string name, int userId = 0); + Attempt DeleteContainer(int containerId, int userId = -1); + Attempt> RenameContainer(int id, string name, int userId = -1); 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 fef7065571..fef3d6278e 100644 --- a/src/Umbraco.Core/Services/IDataTypeService.cs +++ b/src/Umbraco.Core/Services/IDataTypeService.cs @@ -9,15 +9,15 @@ namespace Umbraco.Core.Services /// public interface IDataTypeService : IService { - Attempt> CreateContainer(int parentId, string name, int userId = 0); - Attempt SaveContainer(EntityContainer container, int userId = 0); + Attempt> CreateContainer(int parentId, string name, int userId = -1); + Attempt SaveContainer(EntityContainer container, int userId = -1); 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 = 0); - Attempt> RenameContainer(int id, string name, int userId = 0); + Attempt DeleteContainer(int containerId, int userId = -1); + Attempt> RenameContainer(int id, string name, int userId = -1); /// /// Gets a by its Name @@ -52,14 +52,14 @@ namespace Umbraco.Core.Services /// /// to save /// Id of the user issueing the save - void Save(IDataType dataType, int userId = 0); + void Save(IDataType dataType, int userId = -1); /// /// Saves a collection of /// /// to save /// Id of the user issueing the save - void Save(IEnumerable dataTypeDefinitions, int userId = 0); + void Save(IEnumerable dataTypeDefinitions, int userId = -1); /// /// Saves a collection of @@ -78,7 +78,7 @@ namespace Umbraco.Core.Services /// /// to delete /// Id of the user issueing the deletion - void Delete(IDataType dataType, int userId = 0); + void Delete(IDataType dataType, int userId = -1); /// /// Gets a by its control Id diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index 1f938c8e27..31e510c75a 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 = 0); - Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0); - bool DeletePartialView(string path, int userId = 0); - bool DeletePartialViewMacro(string path, int userId = 0); - Attempt SavePartialView(IPartialView partialView, int userId = 0); - Attempt SavePartialViewMacro(IPartialView partialView, int userId = 0); + Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1); + Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1); + bool DeletePartialView(string path, int userId = -1); + bool DeletePartialViewMacro(string path, int userId = -1); + Attempt SavePartialView(IPartialView partialView, int userId = -1); + Attempt SavePartialViewMacro(IPartialView partialView, int userId = -1); 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 = 0); + void SaveStylesheet(Stylesheet stylesheet, int userId = -1); /// /// 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 = 0); + void DeleteStylesheet(string path, int userId = -1); /// /// 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 = 0); + void SaveScript(Script script, int userId = -1); /// /// 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 = 0); + void DeleteScript(string path, int userId = -1); /// /// Validates a @@ -189,7 +189,7 @@ namespace Umbraco.Core.Services /// /// to save /// Optional id of the user saving the template - void SaveTemplate(ITemplate template, int userId = 0); + void SaveTemplate(ITemplate template, int userId = -1); /// /// Creates a template for a content type @@ -200,16 +200,16 @@ namespace Umbraco.Core.Services /// /// The template created /// - Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0); + Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1); - ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = 0); + ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = -1); /// /// 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 = 0); + void DeleteTemplate(string alias, int userId = -1); /// /// Validates a @@ -223,7 +223,7 @@ namespace Umbraco.Core.Services /// /// List of to save /// Optional id of the user - void SaveTemplate(IEnumerable templates, int userId = 0); + void SaveTemplate(IEnumerable templates, int userId = -1); /// /// This checks what the default rendering engine is set in config but then also ensures that there isn't already diff --git a/src/Umbraco.Core/Services/ILocalizationService.cs b/src/Umbraco.Core/Services/ILocalizationService.cs index aedf84f804..91ce301e83 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 = 0); + void Save(IDictionaryItem dictionaryItem, int userId = -1); /// /// 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 = 0); + void Delete(IDictionaryItem dictionaryItem, int userId = -1); /// /// 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 = 0); + void Save(ILanguage language, int userId = -1); /// /// 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 = 0); + void Delete(ILanguage language, int userId = -1); /// /// Gets the full dictionary key map. diff --git a/src/Umbraco.Core/Services/IMacroService.cs b/src/Umbraco.Core/Services/IMacroService.cs index 1655ffc64d..1bf8bff2e3 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 = 0); + void Delete(IMacro macro, int userId = -1); /// /// Saves an /// /// to save /// Optional id of the user saving the macro - void Save(IMacro macro, int userId = 0); + void Save(IMacro macro, int userId = -1); ///// ///// Gets a list all available plugins diff --git a/src/Umbraco.Core/Services/IMediaService.cs b/src/Umbraco.Core/Services/IMediaService.cs index 3fd4199490..42f771ca54 100644 --- a/src/Umbraco.Core/Services/IMediaService.cs +++ b/src/Umbraco.Core/Services/IMediaService.cs @@ -25,7 +25,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - Attempt MoveToRecycleBin(IMedia media, int userId = 0); + Attempt MoveToRecycleBin(IMedia media, int userId = -1); /// /// Permanently deletes an object @@ -36,7 +36,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - Attempt Delete(IMedia media, int userId = 0); + Attempt Delete(IMedia media, int userId = -1); /// /// Saves a single object @@ -44,7 +44,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 = 0, bool raiseEvents = true); + Attempt Save(IMedia media, int userId = -1, bool raiseEvents = true); /// /// Saves a collection of objects @@ -52,7 +52,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 = 0, bool raiseEvents = true); + Attempt Save(IEnumerable medias, int userId = -1, bool raiseEvents = true); } /// @@ -82,7 +82,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 = 0); + IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1); /// /// Creates an object using the alias of the @@ -98,7 +98,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 = 0); + IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1); /// /// Creates an object using the alias of the @@ -114,7 +114,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 = 0); + IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1); /// /// Gets an object by Id @@ -236,14 +236,14 @@ namespace Umbraco.Core.Services /// The to move /// Id of the Media's new Parent /// Id of the User moving the Media - void Move(IMedia media, int parentId, int userId = 0); + void Move(IMedia media, int parentId, int userId = -1); /// /// Deletes an object by moving it to the Recycle Bin /// /// The to delete /// Id of the User deleting the Media - void MoveToRecycleBin(IMedia media, int userId = 0); + void MoveToRecycleBin(IMedia media, int userId = -1); /// /// Empties the Recycle Bin by deleting all that resides in the bin @@ -256,7 +256,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 = 0); + void DeleteMediaOfType(int mediaTypeId, int userId = -1); /// /// Deletes all media of the specified types. All Descendants of deleted media that is not of these types is moved to Recycle Bin. @@ -264,7 +264,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 issueing the delete operation - void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = 0); + void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = -1); /// /// Permanently deletes an object @@ -275,7 +275,7 @@ namespace Umbraco.Core.Services /// /// The to delete /// Id of the User deleting the Media - void Delete(IMedia media, int userId = 0); + void Delete(IMedia media, int userId = -1); /// /// Saves a single object @@ -283,7 +283,7 @@ namespace Umbraco.Core.Services /// The to save /// Id of the User saving the Media /// Optional boolean indicating whether or not to raise events. - void Save(IMedia media, int userId = 0, bool raiseEvents = true); + void Save(IMedia media, int userId = -1, bool raiseEvents = true); /// /// Saves a collection of objects @@ -291,7 +291,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. - void Save(IEnumerable medias, int userId = 0, bool raiseEvents = true); + void Save(IEnumerable medias, int userId = -1, bool raiseEvents = true); /// /// Gets an object by its 'UniqueId' @@ -334,7 +334,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 = 0); + void DeleteVersions(int id, DateTime versionDate, int userId = -1); /// /// Permanently deletes specific version(s) from an object. @@ -343,7 +343,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 = 0); + void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1); /// /// Gets an object from the path stored in the 'umbracoFile' property. @@ -395,7 +395,7 @@ namespace Umbraco.Core.Services /// /// /// True if sorting succeeded, otherwise False - bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true); + bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true); /// /// Creates an object using the alias of the @@ -410,7 +410,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 = 0); + IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1); /// /// Creates an object using the alias of the @@ -425,7 +425,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 = 0); + IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1); /// /// 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 ceab6e94bf..ffeaf0b496 100644 --- a/src/Umbraco.Core/Services/IPackagingService.cs +++ b/src/Umbraco.Core/Services/IPackagingService.cs @@ -15,7 +15,7 @@ namespace Umbraco.Core.Services /// Optional Id of the user performing the import /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated content - IEnumerable ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true); + IEnumerable ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -24,7 +24,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - IEnumerable ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true); + IEnumerable ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -34,7 +34,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true); + IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -43,7 +43,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated DataTypeDefinitions - IEnumerable ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true); + IEnumerable ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true); /// /// Imports and saves the 'DictionaryItems' part of the package xml as a list of @@ -60,7 +60,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumerable list of generated languages - IEnumerable ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true); + IEnumerable ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true); /// /// Imports and saves the 'Macros' part of a package xml as a list of @@ -69,7 +69,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// - IEnumerable ImportMacros(XElement element, int userId = 0, bool raiseEvents = true); + IEnumerable ImportMacros(XElement element, int userId = -1, bool raiseEvents = true); /// /// Imports and saves package xml as @@ -78,7 +78,7 @@ namespace Umbraco.Core.Services /// Optional id of the User performing the operation. Default is zero (admin) /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated Templates - IEnumerable ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true); + IEnumerable ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true); /// /// Exports an to xml as an diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index b1ff14899c..646c26dd6a 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -162,7 +162,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 = 0) + public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = -1) { //fixme - what about culture? @@ -182,7 +182,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 = 0) + public IContent Create(string name, int parentId, string contentTypeAlias, int userId = -1) { //fixme - what about culture? @@ -215,7 +215,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 = 0) + public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = -1) { //fixme - what about culture? @@ -246,7 +246,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 = 0) + public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1) { //fixme - what about culture? @@ -280,7 +280,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 = 0) + public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1) { //fixme - what about culture? @@ -858,7 +858,7 @@ namespace Umbraco.Core.Services.Implement // fixme - kill all those raiseEvents /// - public OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true) + public OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true) { var publishedState = content.PublishedState; if (publishedState != PublishedState.Published && publishedState != PublishedState.Unpublished) @@ -900,7 +900,7 @@ namespace Umbraco.Core.Services.Implement } /// - public OperationResult Save(IEnumerable contents, int userId = 0, bool raiseEvents = true) + public OperationResult Save(IEnumerable contents, int userId = -1, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); var contentsA = contents.ToArray(); @@ -942,7 +942,7 @@ namespace Umbraco.Core.Services.Implement } /// - public PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true) + public PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true) { var evtMsgs = EventMessagesFactory.Get(); PublishResult result; @@ -1026,7 +1026,7 @@ namespace Umbraco.Core.Services.Implement } /// - public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = 0) + public UnpublishResult Unpublish(IContent content, string culture = null, string segment = null, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); @@ -1189,7 +1189,7 @@ namespace Umbraco.Core.Services.Implement } /// - public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0) + public IEnumerable SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1) { segment = segment?.ToLowerInvariant(); @@ -1201,7 +1201,7 @@ namespace Umbraco.Core.Services.Implement /// public IEnumerable SaveAndPublishBranch(IContent document, bool force, - Func editing, Func publishValues, int userId = 0) + Func editing, Func publishValues, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); var results = new List(); @@ -1372,7 +1372,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 = 0) + public void DeleteVersions(int id, DateTime versionDate, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -1402,7 +1402,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 = 0) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -1489,7 +1489,7 @@ 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 = 0) + public void Move(IContent content, int parentId, int userId = -1) { // if moving to the recycle bin then use the proper method if (parentId == Constants.System.RecycleBinContent) @@ -1660,7 +1660,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 = 0) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1) { return Copy(content, parentId, relateToOriginal, true, userId); } @@ -1675,7 +1675,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 = 0) + public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1) { var copy = content.DeepCloneWithResetIdentities(); copy.ParentId = parentId; @@ -1771,7 +1771,7 @@ namespace Umbraco.Core.Services.Implement /// The to send to publication /// Optional Id of the User issueing the send to publication /// True if sending publication was succesfull otherwise false - public bool SendToPublication(IContent content, int userId = 0) + public bool SendToPublication(IContent content, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -1806,7 +1806,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true) { var itemsA = items.ToArray(); if (itemsA.Length == 0) return true; @@ -1833,7 +1833,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable ids, int userId = 0, bool raiseEvents = true) + public bool Sort(IEnumerable ids, int userId = -1, bool raiseEvents = true) { var idsA = ids.ToArray(); if (idsA.Length == 0) return true; @@ -2211,7 +2211,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional Id of the user issueing the delete operation - public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = 0) + public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = -1) { //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. @@ -2287,7 +2287,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 = 0) + public void DeleteOfType(int contentTypeId, int userId = -1) { DeleteOfTypes(new[] { contentTypeId }, userId); } @@ -2345,7 +2345,7 @@ namespace Umbraco.Core.Services.Implement } } - public void SaveBlueprint(IContent content, int userId = 0) + public void SaveBlueprint(IContent content, int userId = -1) { //always ensure the blueprint is at the root if (content.ParentId != -1) @@ -2376,7 +2376,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprint(IContent content, int userId = 0) + public void DeleteBlueprint(IContent content, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -2387,7 +2387,7 @@ namespace Umbraco.Core.Services.Implement } } - public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0) + public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1) { if (blueprint == null) throw new ArgumentNullException(nameof(blueprint)); @@ -2421,7 +2421,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = 0) + public void DeleteBlueprintsOfTypes(IEnumerable contentTypeIds, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -2448,7 +2448,7 @@ namespace Umbraco.Core.Services.Implement } } - public void DeleteBlueprintsOfType(int contentTypeId, int userId = 0) + public void DeleteBlueprintsOfType(int contentTypeId, int userId = -1) { DeleteBlueprintsOfTypes(new[] { contentTypeId }, userId); } diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs index 8ed0a0f645..9227a5b713 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs @@ -377,7 +377,7 @@ namespace Umbraco.Core.Services.Implement #region Save - public void Save(TItem item, int userId = 0) + public void Save(TItem item, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -415,7 +415,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Save(IEnumerable items, int userId = 0) + public void Save(IEnumerable items, int userId = -1) { var itemsA = items.ToArray(); @@ -461,7 +461,7 @@ namespace Umbraco.Core.Services.Implement #region Delete - public void Delete(TItem item, int userId = 0) + public void Delete(TItem item, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -515,7 +515,7 @@ namespace Umbraco.Core.Services.Implement } } - public void Delete(IEnumerable items, int userId = 0) + public void Delete(IEnumerable items, int userId = -1) { var itemsA = items.ToArray(); @@ -736,7 +736,7 @@ namespace Umbraco.Core.Services.Implement protected Guid ContainerObjectType => EntityContainer.GetContainerObjectType(ContainedObjectType); - public Attempt> CreateContainer(int parentId, string name, int userId = 0) + public Attempt> CreateContainer(int parentId, string name, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -776,7 +776,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = 0) + public Attempt SaveContainer(EntityContainer container, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); @@ -870,7 +870,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt DeleteContainer(int containerId, int userId = 0) + public Attempt DeleteContainer(int containerId, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -907,7 +907,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt> RenameContainer(int id, string name, int userId = 0) + public Attempt> RenameContainer(int id, string name, int userId = -1) { 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 c105b6cfe6..016438d8ec 100644 --- a/src/Umbraco.Core/Services/Implement/DataTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/DataTypeService.cs @@ -38,7 +38,7 @@ namespace Umbraco.Core.Services.Implement #region Containers - public Attempt> CreateContainer(int parentId, string name, int userId = 0) + public Attempt> CreateContainer(int parentId, string name, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -119,7 +119,7 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt SaveContainer(EntityContainer container, int userId = 0) + public Attempt SaveContainer(EntityContainer container, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); @@ -153,7 +153,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Succeed(evtMsgs); } - public Attempt DeleteContainer(int containerId, int userId = 0) + public Attempt DeleteContainer(int containerId, int userId = -1) { 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 = 0) + public Attempt> RenameContainer(int id, string name, int userId = -1) { var evtMsgs = EventMessagesFactory.Get(); using (var scope = ScopeProvider.CreateScope()) @@ -331,7 +331,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issueing the save - public void Save(IDataType dataType, int userId = 0) + public void Save(IDataType dataType, int userId = -1) { dataType.CreatorId = userId; @@ -363,7 +363,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// Id of the user issueing the save - public void Save(IEnumerable dataTypeDefinitions, int userId = 0) + public void Save(IEnumerable dataTypeDefinitions, int userId = -1) { Save(dataTypeDefinitions, userId, true); } @@ -413,7 +413,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional Id of the user issueing the deletion - public void Delete(IDataType dataType, int userId = 0) + public void Delete(IDataType dataType, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/EntityService.cs b/src/Umbraco.Core/Services/Implement/EntityService.cs index 09eab551ae..0c94df19ed 100644 --- a/src/Umbraco.Core/Services/Implement/EntityService.cs +++ b/src/Umbraco.Core/Services/Implement/EntityService.cs @@ -604,7 +604,7 @@ namespace Umbraco.Core.Services.Implement NodeObjectType = Constants.ObjectTypes.IdReservation, CreateDate = DateTime.Now, - UserId = 0, + UserId = -1, ParentId = -1, Level = 1, Path = "-1", diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 09bd096f8e..5dd112f883 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -75,7 +75,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveStylesheet(Stylesheet stylesheet, int userId = 0) + public void SaveStylesheet(Stylesheet stylesheet, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -101,7 +101,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Stylesheet to delete /// - public void DeleteStylesheet(string path, int userId = 0) + public void DeleteStylesheet(string path, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -200,7 +200,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveScript(Script script, int userId = 0) + public void SaveScript(Script script, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -225,7 +225,7 @@ namespace Umbraco.Core.Services.Implement /// /// Name incl. extension of the Script to delete /// - public void DeleteScript(string path, int userId = 0) + public void DeleteScript(string path, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -321,7 +321,7 @@ namespace Umbraco.Core.Services.Implement /// /// The template created /// - public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0) + public Attempt> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = -1) { 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 @@ -362,7 +362,7 @@ namespace Umbraco.Core.Services.Implement return OperationResult.Attempt.Succeed(OperationResultType.Success, evtMsgs, template); } - public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = 0) + public ITemplate CreateTemplateWithIdentity(string name, string content, ITemplate masterTemplate = null, int userId = -1) { var template = new Template(name, name) { @@ -523,7 +523,7 @@ namespace Umbraco.Core.Services.Implement /// /// to save /// - public void SaveTemplate(ITemplate template, int userId = 0) + public void SaveTemplate(ITemplate template, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -547,7 +547,7 @@ namespace Umbraco.Core.Services.Implement /// /// List of to save /// Optional id of the user - public void SaveTemplate(IEnumerable templates, int userId = 0) + public void SaveTemplate(IEnumerable templates, int userId = -1) { var templatesA = templates.ToArray(); using (var scope = ScopeProvider.CreateScope()) @@ -594,7 +594,7 @@ namespace Umbraco.Core.Services.Implement /// /// Alias of the to delete /// - public void DeleteTemplate(string alias, int userId = 0) + public void DeleteTemplate(string alias, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -722,17 +722,17 @@ namespace Umbraco.Core.Services.Implement } } - public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0) + public Attempt CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1) { return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId); } - public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0) + public Attempt CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1) { return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId); } - private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = 0) + private Attempt CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = -1) { string partialViewHeader; switch (partialViewType) @@ -792,17 +792,17 @@ namespace Umbraco.Core.Services.Implement return Attempt.Succeed(partialView); } - public bool DeletePartialView(string path, int userId = 0) + public bool DeletePartialView(string path, int userId = -1) { return DeletePartialViewMacro(path, PartialViewType.PartialView, userId); } - public bool DeletePartialViewMacro(string path, int userId = 0) + public bool DeletePartialViewMacro(string path, int userId = -1) { return DeletePartialViewMacro(path, PartialViewType.PartialViewMacro, userId); } - private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = 0) + private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -832,17 +832,17 @@ namespace Umbraco.Core.Services.Implement return true; } - public Attempt SavePartialView(IPartialView partialView, int userId = 0) + public Attempt SavePartialView(IPartialView partialView, int userId = -1) { return SavePartialView(partialView, PartialViewType.PartialView, userId); } - public Attempt SavePartialViewMacro(IPartialView partialView, int userId = 0) + public Attempt SavePartialViewMacro(IPartialView partialView, int userId = -1) { return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId); } - private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = 0) + private Attempt SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/LocalizationService.cs b/src/Umbraco.Core/Services/Implement/LocalizationService.cs index 663ecf586c..fccea94230 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 = 0) + public void Save(IDictionaryItem dictionaryItem, int userId = -1) { 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 = 0) + public void Delete(IDictionaryItem dictionaryItem, int userId = -1) { 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 = 0) + public void Save(ILanguage language, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -382,7 +382,7 @@ namespace Umbraco.Core.Services.Implement /// /// to delete /// Optional id of the user deleting the language - public void Delete(ILanguage language, int userId = 0) + public void Delete(ILanguage language, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MacroService.cs b/src/Umbraco.Core/Services/Implement/MacroService.cs index fdcc8e2ee0..aa4aa0a66b 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 = 0) + public void Delete(IMacro macro, int userId = -1) { 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 = 0) + public void Save(IMacro macro, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs index 504750874c..f13f207371 100644 --- a/src/Umbraco.Core/Services/Implement/MediaService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaService.cs @@ -112,7 +112,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 = 0) + public IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1) { var parent = GetById(parentId); return CreateMedia(name, parent, mediaTypeAlias, userId); @@ -130,7 +130,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 = 0) + public IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1) { var mediaType = GetMediaType(mediaTypeAlias); if (mediaType == null) @@ -160,7 +160,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 = 0) + public IMedia CreateMedia(string name, string mediaTypeAlias, int userId = -1) { // not locking since not saving anything @@ -190,7 +190,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 = 0) + public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -219,7 +219,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 = 0) + public IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -251,7 +251,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 = 0) + public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1) { if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -749,7 +749,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 void Save(IMedia media, int userId = 0, bool raiseEvents = true) + public void Save(IMedia media, int userId = -1, bool raiseEvents = true) { ((IMediaServiceOperations) this).Save(media, userId, raiseEvents); } @@ -807,7 +807,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 void Save(IEnumerable medias, int userId = 0, bool raiseEvents = true) + public void Save(IEnumerable medias, int userId = -1, bool raiseEvents = true) { ((IMediaServiceOperations) this).Save(medias, userId, raiseEvents); } @@ -869,7 +869,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public void Delete(IMedia media, int userId = 0) + public void Delete(IMedia media, int userId = -1) { ((IMediaServiceOperations) this).Delete(media, userId); } @@ -947,7 +947,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 = 0) + public void DeleteVersions(int id, DateTime versionDate, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -971,7 +971,7 @@ namespace Umbraco.Core.Services.Implement } } - private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = 0) + private void DeleteVersions(IScope scope, bool wlock, int id, DateTime versionDate, int userId = -1) { var args = new DeleteRevisionsEventArgs(id, dateToRetain: versionDate); if (scope.Events.DispatchCancelable(DeletingVersions, this, args)) @@ -994,7 +994,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 = 0) + public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1) { using (var scope = ScopeProvider.CreateScope()) { @@ -1034,7 +1034,7 @@ namespace Umbraco.Core.Services.Implement /// /// The to delete /// Id of the User deleting the Media - public void MoveToRecycleBin(IMedia media, int userId = 0) + public void MoveToRecycleBin(IMedia media, int userId = -1) { ((IMediaServiceOperations) this).MoveToRecycleBin(media, userId); } @@ -1085,7 +1085,7 @@ namespace Umbraco.Core.Services.Implement /// The to move /// Id of the Media's new Parent /// Id of the User moving the Media - public void Move(IMedia media, int parentId, int userId = 0) + public void Move(IMedia media, int parentId, int userId = -1) { // if moving to the recycle bin then use the proper method if (parentId == Constants.System.RecycleBinMedia) @@ -1243,7 +1243,7 @@ namespace Umbraco.Core.Services.Implement /// /// /// True if sorting succeeded, otherwise False - public bool Sort(IEnumerable items, int userId = 0, bool raiseEvents = true) + public bool Sort(IEnumerable items, int userId = -1, bool raiseEvents = true) { var itemsA = items.ToArray(); if (itemsA.Length == 0) return true; @@ -1432,7 +1432,7 @@ namespace Umbraco.Core.Services.Implement /// /// Id of the /// Optional id of the user deleting the media - public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = 0) + public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = -1) { //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. @@ -1497,7 +1497,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 = 0) + public void DeleteMediaOfType(int mediaTypeId, int userId = -1) { DeleteMediaOfTypes(new[] { mediaTypeId }, userId); } diff --git a/src/Umbraco.Core/Services/Implement/PackagingService.cs b/src/Umbraco.Core/Services/Implement/PackagingService.cs index 1e585053da..291598a359 100644 --- a/src/Umbraco.Core/Services/Implement/PackagingService.cs +++ b/src/Umbraco.Core/Services/Implement/PackagingService.cs @@ -127,7 +127,7 @@ namespace Umbraco.Core.Services.Implement /// Optional Id of the user performing the import /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated content - public IEnumerable ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -337,7 +337,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - public IEnumerable ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true) { return ImportContentTypes(element, true, userId); } @@ -350,7 +350,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation. Default is zero (admin). /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated ContentTypes - public IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -856,7 +856,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the user /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated DataTypeDefinitions - public IEnumerable ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -1190,7 +1190,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// An enumerable list of generated languages - public IEnumerable ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the User performing the operation /// Optional parameter indicating whether or not to raise events /// - public IEnumerable ImportMacros(XElement element, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportMacros(XElement element, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -1502,7 +1502,7 @@ namespace Umbraco.Core.Services.Implement /// Optional user id /// Optional parameter indicating whether or not to raise events /// An enumrable list of generated Templates - public IEnumerable ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true) { if (raiseEvents) { @@ -1579,7 +1579,7 @@ namespace Umbraco.Core.Services.Implement } - public IEnumerable ImportStylesheets(XElement element, int userId = 0, bool raiseEvents = true) + public IEnumerable ImportStylesheets(XElement element, int userId = -1, bool raiseEvents = true) { if (raiseEvents) @@ -1670,7 +1670,7 @@ namespace Umbraco.Core.Services.Implement set { _packageInstallation = value; } } - internal InstallationSummary InstallPackage(string packageFilePath, int userId = 0, bool raiseEvents = false) + internal InstallationSummary InstallPackage(string packageFilePath, int userId = -1, bool raiseEvents = false) { var metaData = GetPackageMetaData(packageFilePath); diff --git a/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs b/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs index 1274a4ee90..64e8d41669 100644 --- a/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs +++ b/src/Umbraco.Tests/Persistence/Querying/ContentTypeSqlMappingTests.cs @@ -27,11 +27,11 @@ namespace Umbraco.Tests.Persistence.Querying using (var scope = ScopeProvider.CreateScope()) { scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55554, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,55554", SortOrder = 1, UniqueId = new Guid("87D1EAB6-AB27-4852-B3DF-DE8DBA4A1AA0"), Text = "Template 1", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Template 2", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Content Type 1", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55554, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55554", SortOrder = 1, UniqueId = new Guid("87D1EAB6-AB27-4852-B3DF-DE8DBA4A1AA0"), Text = "Template 1", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Template 2", NodeObjectType = Constants.ObjectTypes.Template, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Content Type 1", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Content Type 2", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsTemplate")))); @@ -92,9 +92,9 @@ namespace Umbraco.Tests.Persistence.Querying using (var scope = ScopeProvider.CreateScope()) { scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Media Type 1", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99997, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99997", SortOrder = 0, UniqueId = new Guid("BB3241D5-6842-4EFA-A82A-5F56885CF528"), Text = "Test Media Type 1", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99998, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99998", SortOrder = 0, UniqueId = new Guid("EEA66B06-302E-49BA-A8B2-EDF07248BC59"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("C45CC083-BB27-4C1C-B448-6F703CC9B799"), Text = "Test Media Type 2", NodeObjectType = Constants.ObjectTypes.MediaType, CreateDate = DateTime.Now }); scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("cmsContentType")))); @@ -144,8 +144,8 @@ namespace Umbraco.Tests.Persistence.Querying using (var scope = ScopeProvider.CreateScope()) { scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} ON ", SqlSyntax.GetQuotedTableName("umbracoNode")))); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Test Data Type", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = 0, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("129241F0-D24E-4FC3-92D1-BC2D48B7C431"), Text = "Test Content Type", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 55555, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,55555", SortOrder = 1, UniqueId = new Guid("3390BDF4-C974-4211-AA95-3812A8CE7C46"), Text = "Test Data Type", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = 99999, Trashed = false, ParentId = -1, UserId = -1, Level = 0, Path = "-1,99999", SortOrder = 0, UniqueId = new Guid("129241F0-D24E-4FC3-92D1-BC2D48B7C431"), Text = "Test Content Type", NodeObjectType = Constants.ObjectTypes.DocumentType, CreateDate = DateTime.Now }); scope.Database.Execute(new Sql(string.Format("SET IDENTITY_INSERT {0} OFF ", SqlSyntax.GetQuotedTableName("umbracoNode")))); scope.Database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 55555, EditorAlias = Constants.PropertyEditors.Aliases.TextBox, DbType = "Nvarchar" }); diff --git a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs index 2b8dde7ad3..cac49613a9 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs @@ -70,7 +70,7 @@ namespace Umbraco.Tests.Persistence.Repositories for (var i = 0; i < 10; i++) { - var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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 = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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 = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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 = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,1", SortOrder = 1, Text = "hello1", Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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 = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1,2", SortOrder = 1, Text = "hello2", Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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); @@ -159,7 +159,7 @@ namespace Umbraco.Tests.Persistence.Repositories for (var i = 0; i < 10; i++) { - var node = new NodeDto { CreateDate = DateTime.Now, Level = 1, NodeObjectType = Constants.ObjectTypes.ContentItem, ParentId = -1, Path = "-1," + i, SortOrder = 1, Text = "hello" + i, Trashed = false, UniqueId = Guid.NewGuid(), UserId = 0 }; + 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/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 4ff2d05678..6c9fbdd875 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -963,7 +963,7 @@ namespace Umbraco.Tests.Services // Assert Assert.That(content, Is.Not.Null); Assert.That(content.HasIdentity, Is.False); - Assert.That(content.CreatorId, Is.EqualTo(0));//Default to zero/administrator + Assert.That(content.CreatorId, Is.EqualTo(-1)); //Default to -1 administrator } [Test] diff --git a/src/Umbraco.Tests/Services/PerformanceTests.cs b/src/Umbraco.Tests/Services/PerformanceTests.cs index dd84c49ef0..090198330b 100644 --- a/src/Umbraco.Tests/Services/PerformanceTests.cs +++ b/src/Umbraco.Tests/Services/PerformanceTests.cs @@ -290,7 +290,7 @@ namespace Umbraco.Tests.Services ParentId = -1, NodeObjectType = customObjectType, Text = i.ToString(CultureInfo.InvariantCulture), - UserId = 0, + UserId = -1, CreateDate = DateTime.Now, Trashed = false, SortOrder = 0, diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index 5745e501ab..6750ad9792 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -196,12 +196,12 @@ namespace Umbraco.Tests.TestHelpers public Dictionary DataTypes { get; } - public Attempt> CreateContainer(int parentId, string name, int userId = 0) + public Attempt> CreateContainer(int parentId, string name, int userId = -1) { throw new NotImplementedException(); } - public Attempt SaveContainer(EntityContainer container, int userId = 0) + public Attempt SaveContainer(EntityContainer container, int userId = -1) { throw new NotImplementedException(); } @@ -231,12 +231,12 @@ namespace Umbraco.Tests.TestHelpers throw new NotImplementedException(); } - public Attempt DeleteContainer(int containerId, int userId = 0) + public Attempt DeleteContainer(int containerId, int userId = -1) { throw new NotImplementedException(); } - public Attempt> RenameContainer(int id, string name, int userId = 0) + public Attempt> RenameContainer(int id, string name, int userId = -1) { throw new NotImplementedException(); } @@ -263,12 +263,12 @@ namespace Umbraco.Tests.TestHelpers return ids.Select(x => DataTypes.TryGetValue(x, out var dataType) ? dataType : null).WhereNotNull(); } - public void Save(IDataType dataType, int userId = 0) + public void Save(IDataType dataType, int userId = -1) { throw new NotImplementedException(); } - public void Save(IEnumerable dataTypeDefinitions, int userId = 0) + public void Save(IEnumerable dataTypeDefinitions, int userId = -1) { throw new NotImplementedException(); } @@ -278,7 +278,7 @@ namespace Umbraco.Tests.TestHelpers throw new NotImplementedException(); } - public void Delete(IDataType dataType, int userId = 0) + public void Delete(IDataType dataType, int userId = -1) { throw new NotImplementedException(); } diff --git a/src/Umbraco.Web/Migrations/EnsureListViewDataTypeIsCreated.cs b/src/Umbraco.Web/Migrations/EnsureListViewDataTypeIsCreated.cs index 9632737515..2dbe6bd867 100644 --- a/src/Umbraco.Web/Migrations/EnsureListViewDataTypeIsCreated.cs +++ b/src/Umbraco.Web/Migrations/EnsureListViewDataTypeIsCreated.cs @@ -37,9 +37,9 @@ namespace Umbraco.Web.Migrations return; } - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-95", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-96", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = 0, Level = 1, Path = "-1,-97", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultContentListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-95", SortOrder = 2, UniqueId = new Guid("C0808DD3-8133-4E4B-8CE8-E2BEA84A96A4"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Content", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMediaListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-96", SortOrder = 2, UniqueId = new Guid("3A0156C4-3B8C-4803-BDC1-6871FAA83FFF"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Media", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + scope.Database.Insert("umbracoNode", "id", false, new NodeDto { NodeId = Constants.DataTypes.DefaultMembersListView, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,-97", SortOrder = 2, UniqueId = new Guid("AA2C52A0-CE87-4E65-A47C-7DF09358585D"), Text = Constants.Conventions.DataTypes.ListViewPrefix + "Members", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); } finally { diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs index a8fd2f3603..621fa0b95f 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs @@ -102,7 +102,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(dest => dest.CreateDate, opt => opt.MapFrom(src => src.CreationDate)) .ForMember(dest => dest.UpdateDate, opt => opt.MapFrom(src => src.LastActivityDate)) .ForMember(dest => dest.Key, opt => opt.MapFrom(src => src.ProviderUserKey.TryConvertTo().Result.ToString("N"))) - .ForMember(dest => dest.Owner, opt => opt.UseValue(new UserProfile {Name = "Admin", UserId = 0})) + .ForMember(dest => dest.Owner, opt => opt.UseValue(new UserProfile {Name = "Admin", UserId = -1 })) .ForMember(dest => dest.Icon, opt => opt.UseValue("icon-user")) .ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.UserName)) .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.Email))