Merge branch 'temp8' into temp8-U4-11375

This commit is contained in:
Stephan
2018-05-31 11:43:31 +02:00
33 changed files with 512 additions and 288 deletions
@@ -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()
@@ -309,7 +309,7 @@ namespace Umbraco.Core.Packaging
}).ToArray();
}
private IEnumerable<IContent> InstallDocuments(XElement documentsElement, int userId = 0)
private IEnumerable<IContent> 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<IContentType> InstallDocumentTypes(XElement documentTypes, int userId = 0)
private IEnumerable<IContentType> 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<ITemplate> InstallTemplats(XElement templateElement, int userId = 0)
private IEnumerable<ITemplate> 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<string, string>(sd.Key, Path.Combine(fullpathToRoot, sd.Value))).ToArray();
}
private IEnumerable<IMacro> InstallMacros(XElement macroElements, int userId = 0)
private IEnumerable<IMacro> 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<ILanguage> InstallLanguages(XElement languageElement, int userId = 0)
private IEnumerable<ILanguage> 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<IDataType> InstallDataTypes(XElement dataTypeElements, int userId = 0)
private IEnumerable<IDataType> InstallDataTypes(XElement dataTypeElements, int userId = -1)
{
if (string.Equals(Constants.Packaging.DataTypesNodeName, dataTypeElements.Name.LocalName) == false)
{
@@ -916,6 +916,82 @@ namespace Umbraco.Core.Persistence
#endregion
#region Hints
/// <summary>
/// Appends the relevant ForUpdate hint.
/// </summary>
/// <param name="sql">The Sql statement.</param>
/// <returns>The Sql statement.</returns>
public static Sql<ISqlContext> ForUpdate(this Sql<ISqlContext> sql)
{
// MySql wants "FOR UPDATE" at the end, and T-Sql wants "WITH (UPDLOCK)" in the FROM statement,
// and we want to implement it in the least expensive way, so parsing the entire string here is
// a no, so we use reflection to work on the Sql expression before it is built.
// TODO propose a clean way to do that type of thing in NPoco
if (sql.SqlContext.DatabaseType.IsMySql())
{
sql.Append("FOR UPDATE");
return sql;
}
// go find the first FROM clause, and append the lock hint
Sql s = sql;
var updated = false;
while (s != null)
{
var sqlText = SqlInspector.GetSqlText(s);
if (sqlText.StartsWith("FROM ", StringComparison.OrdinalIgnoreCase))
{
SqlInspector.SetSqlText(s, sqlText + " WITH (UPDLOCK)");
updated = true;
break;
}
s = SqlInspector.GetSqlRhs(sql);
}
if (updated)
SqlInspector.Reset(sql);
return sql;
}
#endregion
#region Sql Inspection
private static SqlInspectionUtilities _sqlInspector;
private static SqlInspectionUtilities SqlInspector => _sqlInspector ?? (_sqlInspector = new SqlInspectionUtilities());
private class SqlInspectionUtilities
{
private readonly Func<Sql, string> _getSqlText;
private readonly Action<Sql, string> _setSqlText;
private readonly Func<Sql, Sql> _getSqlRhs;
private readonly Action<Sql, string> _setSqlFinal;
public SqlInspectionUtilities()
{
(_getSqlText, _setSqlText) = ReflectionUtilities.EmitFieldGetterAndSetter<Sql, string>("_sql");
_getSqlRhs = ReflectionUtilities.EmitFieldGetter<Sql, Sql>("_rhs");
_setSqlFinal = ReflectionUtilities.EmitFieldSetter<Sql, string>("_sqlFinal");
}
public string GetSqlText(Sql sql) => _getSqlText(sql);
public void SetSqlText(Sql sql, string sqlText) => _setSqlText(sql, sqlText);
public Sql GetSqlRhs(Sql sql) => _getSqlRhs(sql);
public void Reset(Sql sql) => _setSqlFinal(sql, null);
}
#endregion
#region Utilities
private static string[] GetColumns<TDto>(this Sql<ISqlContext> sql, string tableAlias = null, string referenceName = null, Expression<Func<TDto, object>>[] columnExpressions = null, bool withAlias = true)
@@ -191,7 +191,20 @@ ORDER BY colName";
public bool ValidateLoginSession(int userId, Guid sessionId)
{
var found = Database.FirstOrDefault<UserLoginDto>("WHERE sessionId=@sessionId", new {sessionId = sessionId});
// with RepeatableRead transaction mode, read-then-update operations can
// cause deadlocks, and the ForUpdate() hint is required to tell the database
// to acquire an exclusive lock when reading
// that query is going to run a *lot*, make it a template
var t = SqlContext.Templates.Get("Umbraco.Core.UserRepository.ValidateLoginSession", s => s
.Select<UserLoginDto>()
.From<UserLoginDto>()
.Where<UserLoginDto>(x => x.SessionId == SqlTemplate.Arg<Guid>("sessionId"))
.ForUpdate());
var sql = t.Sql(sessionId);
var found = Database.Query<UserLoginDto>(sql).FirstOrDefault();
if (found == null || found.UserId != userId || found.LoggedOutUtc.HasValue)
return false;
@@ -211,34 +224,21 @@ ORDER BY colName";
public int ClearLoginSessions(int userId)
{
//TODO: I know this doesn't follow the normal repository conventions which would require us to crete a UserSessionRepository
//and also business logic models for these objects but that's just so overkill for what we are doing
//and now that everything is properly in a transaction (Scope) there doesn't seem to be much reason for using that anymore
var count = Database.ExecuteScalar<int>("SELECT COUNT(*) FROM umbracoUserLogin WHERE userId=@userId", new { userId = userId });
Database.Execute("DELETE FROM umbracoUserLogin WHERE userId=@userId", new {userId = userId});
return count;
return Database.Delete<UserLoginDto>(Sql().Where<UserLoginDto>(x => x.UserId == userId));
}
public int ClearLoginSessions(TimeSpan timespan)
{
//TODO: I know this doesn't follow the normal repository conventions which would require us to crete a UserSessionRepository
//and also business logic models for these objects but that's just so overkill for what we are doing
//and now that everything is properly in a transaction (Scope) there doesn't seem to be much reason for using that anymore
var fromDate = DateTime.UtcNow - timespan;
var count = Database.ExecuteScalar<int>("SELECT COUNT(*) FROM umbracoUserLogin WHERE lastValidatedUtc=@fromDate", new { fromDate = fromDate });
Database.Execute("DELETE FROM umbracoUserLogin WHERE lastValidatedUtc=@fromDate", new { fromDate = fromDate });
return count;
return Database.Delete<UserLoginDto>(Sql().Where<UserLoginDto>(x => x.LastValidatedUtc < fromDate));
}
public void ClearLoginSession(Guid sessionId)
{
//TODO: I know this doesn't follow the normal repository conventions which would require us to crete a UserSessionRepository
//and also business logic models for these objects but that's just so overkill for what we are doing
//and now that everything is properly in a transaction (Scope) there doesn't seem to be much reason for using that anymore
Database.Execute("UPDATE umbracoUserLogin SET loggedOutUtc=@now WHERE sessionId=@sessionId",
new { now = DateTime.UtcNow, sessionId = sessionId });
// fixme why is that one updating and not deleting?
Database.Execute(Sql()
.Update<UserLoginDto>(u => u.Set(x => x.LoggedOutUtc, DateTime.UtcNow))
.Where<UserLoginDto>(x => x.SessionId == sessionId));
}
protected override IEnumerable<IUser> PerformGetAll(params int[] ids)
@@ -718,7 +718,7 @@ ORDER BY colName";
if (string.IsNullOrWhiteSpace(orderBy)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(orderBy));
Sql<ISqlContext> filterSql = null;
var customFilterWheres = filter != null ? filter.GetWhereClauses().ToArray() : null;
var customFilterWheres = filter?.GetWhereClauses().ToArray();
var hasCustomFilter = customFilterWheres != null && customFilterWheres.Length > 0;
if (hasCustomFilter
|| includeUserGroups != null && includeUserGroups.Length > 0
+100 -10
View File
@@ -21,6 +21,96 @@ namespace Umbraco.Core
/// </remarks>
public static partial class ReflectionUtilities
{
#region Fields
/// <summary>
/// Emits a field getter.
/// </summary>
/// <typeparam name="TDeclaring">The declaring type.</typeparam>
/// <typeparam name="TValue">The field type.</typeparam>
/// <param name="fieldName">The name of the field.</param>
/// <returns>A field getter function.</returns>
/// <exception cref="ArgumentNullOrEmptyException">Occurs when <paramref name="fieldName"/> is null or empty.</exception>
/// <exception cref="InvalidOperationException">Occurs when the field does not exist.</exception>
/// <exception cref="ArgumentException">Occurs when <typeparamref name="TValue"/> does not match the type of the field.</exception>
public static Func<TDeclaring, TValue> EmitFieldGetter<TDeclaring, TValue>(string fieldName)
{
var field = GetField<TDeclaring, TValue>(fieldName);
return EmitFieldGetter<TDeclaring, TValue>(field);
}
/// <summary>
/// Emits a field setter.
/// </summary>
/// <typeparam name="TDeclaring">The declaring type.</typeparam>
/// <typeparam name="TValue">The field type.</typeparam>
/// <param name="fieldName">The name of the field.</param>
/// <returns>A field setter action.</returns>
/// <exception cref="ArgumentNullOrEmptyException">Occurs when <paramref name="fieldName"/> is null or empty.</exception>
/// <exception cref="InvalidOperationException">Occurs when the field does not exist.</exception>
/// <exception cref="ArgumentException">Occurs when <typeparamref name="TValue"/> does not match the type of the field.</exception>
public static Action<TDeclaring, TValue> EmitFieldSetter<TDeclaring, TValue>(string fieldName)
{
var field = GetField<TDeclaring, TValue>(fieldName);
return EmitFieldSetter<TDeclaring, TValue>(field);
}
/// <summary>
/// Emits a field getter and setter.
/// </summary>
/// <typeparam name="TDeclaring">The declaring type.</typeparam>
/// <typeparam name="TValue">The field type.</typeparam>
/// <param name="fieldName">The name of the field.</param>
/// <returns>A field getter and setter functions.</returns>
/// <exception cref="ArgumentNullOrEmptyException">Occurs when <paramref name="fieldName"/> is null or empty.</exception>
/// <exception cref="InvalidOperationException">Occurs when the field does not exist.</exception>
/// <exception cref="ArgumentException">Occurs when <typeparamref name="TValue"/> does not match the type of the field.</exception>
public static (Func<TDeclaring, TValue>, Action<TDeclaring, TValue>) EmitFieldGetterAndSetter<TDeclaring, TValue>(string fieldName)
{
var field = GetField<TDeclaring, TValue>(fieldName);
return (EmitFieldGetter<TDeclaring, TValue>(field), EmitFieldSetter<TDeclaring, TValue>(field));
}
private static FieldInfo GetField<TDeclaring, TValue>(string fieldName)
{
if (string.IsNullOrWhiteSpace(fieldName)) throw new ArgumentNullOrEmptyException(nameof(fieldName));
// get the field
var field = typeof(TDeclaring).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (field == null) throw new InvalidOperationException($"Could not find field {typeof(TDeclaring)}.{fieldName}.");
// validate field type
if (field.FieldType != typeof(TValue)) // strict
throw new ArgumentException($"Value type {typeof(TValue)} does not match field {typeof(TDeclaring)}.{fieldName} type {field.FieldType}.");
return field;
}
private static Func<TDeclaring, TValue> EmitFieldGetter<TDeclaring, TValue>(FieldInfo field)
{
// emit
var (dm, ilgen) = CreateIlGenerator(field.DeclaringType?.Module, new [] { typeof(TDeclaring) }, typeof(TValue));
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit(OpCodes.Ldfld, field);
ilgen.Return();
return (Func<TDeclaring, TValue>) (object) dm.CreateDelegate(typeof(Func<TDeclaring, TValue>));
}
private static Action<TDeclaring, TValue> EmitFieldSetter<TDeclaring, TValue>(FieldInfo field)
{
// emit
var (dm, ilgen) = CreateIlGenerator(field.DeclaringType?.Module, new [] { typeof(TDeclaring), typeof(TValue) }, typeof(void));
ilgen.Emit(OpCodes.Ldarg_0);
ilgen.Emit(OpCodes.Ldarg_1);
ilgen.Emit(OpCodes.Stfld, field);
ilgen.Return();
return (Action<TDeclaring, TValue>) (object) dm.CreateDelegate(typeof(Action<TDeclaring, TValue>));
}
#endregion
#region Properties
/// <summary>
@@ -207,7 +297,7 @@ namespace Umbraco.Core
/// is specified and does not match the function's returned type.</exception>
public static TLambda EmitCtor<TLambda>(bool mustExist = true, Type declaring = null)
{
(_, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
var (_, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
// determine returned / declaring type
if (declaring == null) declaring = lambdaReturned;
@@ -239,7 +329,7 @@ namespace Umbraco.Core
{
if (ctor == null) throw new ArgumentNullException(nameof(ctor));
(_, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
var (_, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
return EmitCtorSafe<TLambda>(lambdaParameters, lambdaReturned, ctor);
}
@@ -281,7 +371,7 @@ namespace Umbraco.Core
{
if (ctor == null) throw new ArgumentNullException(nameof(ctor));
(_, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
var (_, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(true, true);
// emit - unsafe - use lambda's args and assume they are correct
return EmitCtor<TLambda>(lambdaReturned, lambdaParameters, ctor);
@@ -293,7 +383,7 @@ namespace Umbraco.Core
var ctorParameters = GetParameters(ctor);
// emit
(var dm, var ilgen) = CreateIlGenerator(ctor.DeclaringType?.Module, lambdaParameters, declaring);
var (dm, ilgen) = CreateIlGenerator(ctor.DeclaringType?.Module, lambdaParameters, declaring);
EmitLdargs(ilgen, lambdaParameters, ctorParameters);
ilgen.Emit(OpCodes.Newobj, ctor); // ok to just return, it's only objects
ilgen.Return();
@@ -342,7 +432,7 @@ namespace Umbraco.Core
{
if (string.IsNullOrWhiteSpace(methodName)) throw new ArgumentNullOrEmptyException(nameof(methodName));
(var lambdaDeclaring, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(true, out var isFunction);
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(true, out var isFunction);
// get the method infos
var method = declaring.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, lambdaParameters, null);
@@ -374,7 +464,7 @@ namespace Umbraco.Core
var methodParameters = method.GetParameters().Select(x => x.ParameterType).ToArray();
var isStatic = method.IsStatic;
(var lambdaDeclaring, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(isStatic, out var isFunction);
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(isStatic, out var isFunction);
// if not static, then the first lambda arg must be the method declaring type
if (!isStatic && (methodDeclaring == null || !methodDeclaring.IsAssignableFrom(lambdaDeclaring)))
@@ -408,7 +498,7 @@ namespace Umbraco.Core
if (method == null) throw new ArgumentNullException(nameof(method));
var isStatic = method.IsStatic;
(var lambdaDeclaring, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(isStatic, out _);
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(isStatic, out _);
// emit - unsafe - use lambda's args and assume they are correct
return EmitMethod<TLambda>(lambdaDeclaring, lambdaReturned, lambdaParameters, method);
@@ -433,7 +523,7 @@ namespace Umbraco.Core
throw new ArgumentNullOrEmptyException(nameof(methodName));
// validate lambda type
(var lambdaDeclaring, var lambdaParameters, var lambdaReturned) = AnalyzeLambda<TLambda>(false, out var isFunction);
var (lambdaDeclaring, lambdaParameters, lambdaReturned) = AnalyzeLambda<TLambda>(false, out var isFunction);
// get the method infos
var method = lambdaDeclaring.GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, null, lambdaParameters, null);
@@ -464,7 +554,7 @@ namespace Umbraco.Core
var methodArgTypes = GetParameters(method, withDeclaring: !method.IsStatic);
// emit IL
(var dm, var ilgen) = CreateIlGenerator(method.DeclaringType?.Module, parameters, lambdaReturned);
var (dm, ilgen) = CreateIlGenerator(method.DeclaringType?.Module, parameters, lambdaReturned);
EmitLdargs(ilgen, parameters, methodArgTypes);
ilgen.CallMethod(method);
EmitOutputAdapter(ilgen, lambdaReturned, method.ReturnType);
@@ -486,7 +576,7 @@ namespace Umbraco.Core
{
var typeLambda = typeof(TLambda);
(var declaring, var parameters, var returned) = AnalyzeLambda<TLambda>(isStatic, out var maybeFunction);
var (declaring, parameters, returned) = AnalyzeLambda<TLambda>(isStatic, out var maybeFunction);
if (isFunction)
{
@@ -34,7 +34,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias"></param>
/// <param name="userId"></param>
/// <returns></returns>
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)
+28 -28
View File
@@ -32,27 +32,27 @@ namespace Umbraco.Core.Services
/// <summary>
/// Saves a blueprint.
/// </summary>
void SaveBlueprint(IContent content, int userId = 0);
void SaveBlueprint(IContent content, int userId = -1);
/// <summary>
/// Deletes a blueprint.
/// </summary>
void DeleteBlueprint(IContent content, int userId = 0);
void DeleteBlueprint(IContent content, int userId = -1);
/// <summary>
/// Creates a new content item from a blueprint.
/// </summary>
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0);
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1);
/// <summary>
/// Deletes blueprints for a content type.
/// </summary>
void DeleteBlueprintsOfType(int contentTypeId, int userId = 0);
void DeleteBlueprintsOfType(int contentTypeId, int userId = -1);
/// <summary>
/// Deletes blueprints for content types.
/// </summary>
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = 0);
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = -1);
#endregion
@@ -251,13 +251,13 @@ namespace Umbraco.Core.Services
/// <summary>
/// Saves a document.
/// </summary>
OperationResult Save(IContent content, int userId = 0, bool raiseEvents = true);
OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Saves documents.
/// </summary>
// fixme why only 1 result not 1 per content?!
OperationResult Save(IEnumerable<IContent> contents, int userId = 0, bool raiseEvents = true);
OperationResult Save(IEnumerable<IContent> contents, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Deletes a document.
@@ -266,7 +266,7 @@ namespace Umbraco.Core.Services
/// <para>This method will also delete associated media files, child content and possibly associated domains.</para>
/// <para>This method entirely clears the content from the database.</para>
/// </remarks>
OperationResult Delete(IContent content, int userId = 0);
OperationResult Delete(IContent content, int userId = -1);
/// <summary>
/// Deletes all documents of a given document type.
@@ -275,7 +275,7 @@ namespace Umbraco.Core.Services
/// <para>All non-deleted descendants of the deleted documents are moved to the recycle bin.</para>
/// <para>This operation is potentially dangerous and expensive.</para>
/// </remarks>
void DeleteOfType(int documentTypeId, int userId = 0);
void DeleteOfType(int documentTypeId, int userId = -1);
/// <summary>
/// Deletes all documents of given document types.
@@ -284,17 +284,17 @@ namespace Umbraco.Core.Services
/// <para>All non-deleted descendants of the deleted documents are moved to the recycle bin.</para>
/// <para>This operation is potentially dangerous and expensive.</para>
/// </remarks>
void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = 0);
void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = -1);
/// <summary>
/// Deletes versions of a document prior to a given date.
/// </summary>
void DeleteVersions(int id, DateTime date, int userId = 0);
void DeleteVersions(int id, DateTime date, int userId = -1);
/// <summary>
/// Deletes a version of a document.
/// </summary>
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
/// <summary>
/// Moves a document under a new parent.
/// </summary>
void Move(IContent content, int parentId, int userId = 0);
void Move(IContent content, int parentId, int userId = -1);
/// <summary>
/// Copies a document.
@@ -311,7 +311,7 @@ namespace Umbraco.Core.Services
/// <remarks>
/// <para>Recursively copies all children.</para>
/// </remarks>
IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0);
IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1);
/// <summary>
/// Copies a document.
@@ -319,12 +319,12 @@ namespace Umbraco.Core.Services
/// <remarks>
/// <para>Optionaly recursively copies all children.</para>
/// </remarks>
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);
/// <summary>
/// Moves a document to the recycle bin.
/// </summary>
OperationResult MoveToRecycleBin(IContent content, int userId = 0);
OperationResult MoveToRecycleBin(IContent content, int userId = -1);
/// <summary>
/// Empties the recycle bin.
@@ -334,12 +334,12 @@ namespace Umbraco.Core.Services
/// <summary>
/// Sorts documents.
/// </summary>
bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true);
bool Sort(IEnumerable<IContent> items, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Sorts documents.
/// </summary>
bool Sort(IEnumerable<int> ids, int userId = 0, bool raiseEvents = true);
bool Sort(IEnumerable<int> ids, int userId = -1, bool raiseEvents = true);
#endregion
@@ -349,22 +349,22 @@ namespace Umbraco.Core.Services
/// Saves and publishes a document.
/// </summary>
/// <remarks>Property values must first be published at document level.</remarks>
PublishResult SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true);
PublishResult SaveAndPublish(IContent content, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Saves and publishes a document branch.
/// </summary>
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0);
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = -1);
/// <summary>
/// Saves and publishes a document branch.
/// </summary>
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = 0);
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = -1);
/// <summary>
/// Unpublishes a document or optionally unpublishes a culture and/or segment for the document.
/// </summary>
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);
/// <summary>
/// Gets a value indicating whether a document is path-publishable.
@@ -381,7 +381,7 @@ namespace Umbraco.Core.Services
/// <summary>
/// Saves a document and raises the "sent to publication" events.
/// </summary>
bool SendToPublication(IContent content, int userId = 0);
bool SendToPublication(IContent content, int userId = -1);
/// <summary>
/// Publishes and unpublishes scheduled documents.
@@ -416,27 +416,27 @@ namespace Umbraco.Core.Services
/// <summary>
/// Creates a document.
/// </summary>
IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = 0);
IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = -1);
/// <summary>
/// Creates a document.
/// </summary>
IContent Create(string name, int parentId, string documentTypeAlias, int userId = 0);
IContent Create(string name, int parentId, string documentTypeAlias, int userId = -1);
/// <summary>
/// Creates a document.
/// </summary>
IContent Create(string name, IContent parent, string documentTypeAlias, int userId = 0);
IContent Create(string name, IContent parent, string documentTypeAlias, int userId = -1);
/// <summary>
/// Creates and saves a document.
/// </summary>
IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0);
IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1);
/// <summary>
/// Creates and saves a document.
/// </summary>
IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0);
IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1);
#endregion
}
@@ -25,11 +25,11 @@ namespace Umbraco.Core.Services
IEnumerable<TItem> GetChildren(int id);
bool HasChildren(int id);
void Save(TItem item, int userId = 0);
void Save(IEnumerable<TItem> items, int userId = 0);
void Save(TItem item, int userId = -1);
void Save(IEnumerable<TItem> items, int userId = -1);
void Delete(TItem item, int userId = 0);
void Delete(IEnumerable<TItem> item, int userId = 0);
void Delete(TItem item, int userId = -1);
void Delete(IEnumerable<TItem> item, int userId = -1);
Attempt<string[]> ValidateComposition(TItem compo);
@@ -41,15 +41,15 @@ namespace Umbraco.Core.Services
/// <returns></returns>
bool HasContainerInPath(string contentPath);
Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentContainerId, string name, int userId = 0);
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = 0);
Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentContainerId, string name, int userId = -1);
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1);
EntityContainer GetContainer(int containerId);
EntityContainer GetContainer(Guid containerId);
IEnumerable<EntityContainer> GetContainers(int[] containerIds);
IEnumerable<EntityContainer> GetContainers(TItem contentType);
IEnumerable<EntityContainer> GetContainers(string folderName, int level);
Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0);
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0);
Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1);
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1);
Attempt<OperationResult<MoveOperationStatusType>> Move(TItem moving, int containerId);
Attempt<OperationResult<MoveOperationStatusType, TItem>> Copy(TItem copying, int containerId);
@@ -9,15 +9,15 @@ namespace Umbraco.Core.Services
/// </summary>
public interface IDataTypeService : IService
{
Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0);
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = 0);
Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = -1);
Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1);
EntityContainer GetContainer(int containerId);
EntityContainer GetContainer(Guid containerId);
IEnumerable<EntityContainer> GetContainers(string folderName, int level);
IEnumerable<EntityContainer> GetContainers(IDataType dataType);
IEnumerable<EntityContainer> GetContainers(int[] containerIds);
Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0);
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0);
Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1);
Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1);
/// <summary>
/// Gets a <see cref="IDataType"/> by its Name
@@ -52,14 +52,14 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="dataType"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
void Save(IDataType dataType, int userId = 0);
void Save(IDataType dataType, int userId = -1);
/// <summary>
/// Saves a collection of <see cref="IDataType"/>
/// </summary>
/// <param name="dataTypeDefinitions"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = 0);
void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1);
/// <summary>
/// Saves a collection of <see cref="IDataType"/>
@@ -78,7 +78,7 @@ namespace Umbraco.Core.Services
/// </remarks>
/// <param name="dataType"><see cref="IDataType"/> to delete</param>
/// <param name="userId">Id of the user issueing the deletion</param>
void Delete(IDataType dataType, int userId = 0);
void Delete(IDataType dataType, int userId = -1);
/// <summary>
/// Gets a <see cref="IDataType"/> by its control Id
+15 -15
View File
@@ -18,12 +18,12 @@ namespace Umbraco.Core.Services
IPartialView GetPartialView(string path);
IPartialView GetPartialViewMacro(string path);
IEnumerable<IPartialView> GetPartialViewMacros(params string[] names);
Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0);
Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0);
bool DeletePartialView(string path, int userId = 0);
bool DeletePartialViewMacro(string path, int userId = 0);
Attempt<IPartialView> SavePartialView(IPartialView partialView, int userId = 0);
Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = 0);
Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1);
Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1);
bool DeletePartialView(string path, int userId = -1);
bool DeletePartialViewMacro(string path, int userId = -1);
Attempt<IPartialView> SavePartialView(IPartialView partialView, int userId = -1);
Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = -1);
bool ValidatePartialView(PartialView partialView);
bool ValidatePartialViewMacro(PartialView partialView);
@@ -45,14 +45,14 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="stylesheet"><see cref="Stylesheet"/> to save</param>
/// <param name="userId">Optional id of the user saving the stylesheet</param>
void SaveStylesheet(Stylesheet stylesheet, int userId = 0);
void SaveStylesheet(Stylesheet stylesheet, int userId = -1);
/// <summary>
/// Deletes a stylesheet by its name
/// </summary>
/// <param name="path">Name incl. extension of the Stylesheet to delete</param>
/// <param name="userId">Optional id of the user deleting the stylesheet</param>
void DeleteStylesheet(string path, int userId = 0);
void DeleteStylesheet(string path, int userId = -1);
/// <summary>
/// Validates a <see cref="Stylesheet"/>
@@ -79,14 +79,14 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="script"><see cref="Script"/> to save</param>
/// <param name="userId">Optional id of the user saving the script</param>
void SaveScript(Script script, int userId = 0);
void SaveScript(Script script, int userId = -1);
/// <summary>
/// Deletes a script by its name
/// </summary>
/// <param name="path">Name incl. extension of the Script to delete</param>
/// <param name="userId">Optional id of the user deleting the script</param>
void DeleteScript(string path, int userId = 0);
void DeleteScript(string path, int userId = -1);
/// <summary>
/// Validates a <see cref="Script"/>
@@ -189,7 +189,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="template"><see cref="ITemplate"/> to save</param>
/// <param name="userId">Optional id of the user saving the template</param>
void SaveTemplate(ITemplate template, int userId = 0);
void SaveTemplate(ITemplate template, int userId = -1);
/// <summary>
/// Creates a template for a content type
@@ -200,16 +200,16 @@ namespace Umbraco.Core.Services
/// <returns>
/// The template created
/// </returns>
Attempt<OperationResult<OperationResultType, ITemplate>> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0);
Attempt<OperationResult<OperationResultType, ITemplate>> 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);
/// <summary>
/// Deletes a template by its alias
/// </summary>
/// <param name="alias">Alias of the <see cref="ITemplate"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the template</param>
void DeleteTemplate(string alias, int userId = 0);
void DeleteTemplate(string alias, int userId = -1);
/// <summary>
/// Validates a <see cref="ITemplate"/>
@@ -223,7 +223,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="templates">List of <see cref="Template"/> to save</param>
/// <param name="userId">Optional id of the user</param>
void SaveTemplate(IEnumerable<ITemplate> templates, int userId = 0);
void SaveTemplate(IEnumerable<ITemplate> templates, int userId = -1);
/// <summary>
/// This checks what the default rendering engine is set in config but then also ensures that there isn't already
@@ -86,7 +86,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to save</param>
/// <param name="userId">Optional id of the user saving the dictionary item</param>
void Save(IDictionaryItem dictionaryItem, int userId = 0);
void Save(IDictionaryItem dictionaryItem, int userId = -1);
/// <summary>
/// Deletes a <see cref="IDictionaryItem"/> object and its related translations
@@ -94,7 +94,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the dictionary item</param>
void Delete(IDictionaryItem dictionaryItem, int userId = 0);
void Delete(IDictionaryItem dictionaryItem, int userId = -1);
/// <summary>
/// Gets a <see cref="ILanguage"/> by its id
@@ -153,14 +153,14 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to save</param>
/// <param name="userId">Optional id of the user saving the language</param>
void Save(ILanguage language, int userId = 0);
void Save(ILanguage language, int userId = -1);
/// <summary>
/// Deletes a <see cref="ILanguage"/> by removing it and its usages from the db
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the language</param>
void Delete(ILanguage language, int userId = 0);
void Delete(ILanguage language, int userId = -1);
/// <summary>
/// Gets the full dictionary key map.
+2 -2
View File
@@ -39,14 +39,14 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the macro</param>
void Delete(IMacro macro, int userId = 0);
void Delete(IMacro macro, int userId = -1);
/// <summary>
/// Saves an <see cref="IMacro"/>
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to save</param>
/// <param name="userId">Optional id of the user saving the macro</param>
void Save(IMacro macro, int userId = 0);
void Save(IMacro macro, int userId = -1);
///// <summary>
///// Gets a list all available <see cref="IMacroPropertyType"/> plugins
+19 -19
View File
@@ -25,7 +25,7 @@ namespace Umbraco.Core.Services
/// </summary>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
Attempt<OperationResult> MoveToRecycleBin(IMedia media, int userId = 0);
Attempt<OperationResult> MoveToRecycleBin(IMedia media, int userId = -1);
/// <summary>
/// Permanently deletes an <see cref="IMedia"/> object
@@ -36,7 +36,7 @@ namespace Umbraco.Core.Services
/// </remarks>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
Attempt<OperationResult> Delete(IMedia media, int userId = 0);
Attempt<OperationResult> Delete(IMedia media, int userId = -1);
/// <summary>
/// Saves a single <see cref="IMedia"/> object
@@ -44,7 +44,7 @@ namespace Umbraco.Core.Services
/// <param name="media">The <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
Attempt<OperationResult> Save(IMedia media, int userId = 0, bool raiseEvents = true);
Attempt<OperationResult> Save(IMedia media, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Saves a collection of <see cref="IMedia"/> objects
@@ -52,7 +52,7 @@ namespace Umbraco.Core.Services
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
Attempt<OperationResult> Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
Attempt<OperationResult> Save(IEnumerable<IMedia> medias, int userId = -1, bool raiseEvents = true);
}
/// <summary>
@@ -82,7 +82,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = 0);
IMedia CreateMedia(string name, Guid parentId, string mediaTypeAlias, int userId = -1);
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0);
IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = -1);
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
@@ -114,7 +114,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = -1);
/// <summary>
/// Gets an <see cref="IMedia"/> object by Id
@@ -236,14 +236,14 @@ namespace Umbraco.Core.Services
/// <param name="media">The <see cref="IMedia"/> to move</param>
/// <param name="parentId">Id of the Media's new Parent</param>
/// <param name="userId">Id of the User moving the Media</param>
void Move(IMedia media, int parentId, int userId = 0);
void Move(IMedia media, int parentId, int userId = -1);
/// <summary>
/// Deletes an <see cref="IMedia"/> object by moving it to the Recycle Bin
/// </summary>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
void MoveToRecycleBin(IMedia media, int userId = 0);
void MoveToRecycleBin(IMedia media, int userId = -1);
/// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IMedia"/> that resides in the bin
@@ -256,7 +256,7 @@ namespace Umbraco.Core.Services
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional Id of the user deleting Media</param>
void DeleteMediaOfType(int mediaTypeId, int userId = 0);
void DeleteMediaOfType(int mediaTypeId, int userId = -1);
/// <summary>
/// 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
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="mediaTypeIds">Ids of the <see cref="IMediaType"/>s</param>
/// <param name="userId">Optional Id of the user issueing the delete operation</param>
void DeleteMediaOfTypes(IEnumerable<int> mediaTypeIds, int userId = 0);
void DeleteMediaOfTypes(IEnumerable<int> mediaTypeIds, int userId = -1);
/// <summary>
/// Permanently deletes an <see cref="IMedia"/> object
@@ -275,7 +275,7 @@ namespace Umbraco.Core.Services
/// </remarks>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
void Delete(IMedia media, int userId = 0);
void Delete(IMedia media, int userId = -1);
/// <summary>
/// Saves a single <see cref="IMedia"/> object
@@ -283,7 +283,7 @@ namespace Umbraco.Core.Services
/// <param name="media">The <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
void Save(IMedia media, int userId = 0, bool raiseEvents = true);
void Save(IMedia media, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Saves a collection of <see cref="IMedia"/> objects
@@ -291,7 +291,7 @@ namespace Umbraco.Core.Services
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
void Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
void Save(IEnumerable<IMedia> medias, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Gets an <see cref="IMedia"/> object by its 'UniqueId'
@@ -334,7 +334,7 @@ namespace Umbraco.Core.Services
/// <param name="id">Id of the <see cref="IMedia"/> object to delete versions from</param>
/// <param name="versionDate">Latest version date</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
void DeleteVersions(int id, DateTime versionDate, int userId = 0);
void DeleteVersions(int id, DateTime versionDate, int userId = -1);
/// <summary>
/// Permanently deletes specific version(s) from an <see cref="IMedia"/> object.
@@ -343,7 +343,7 @@ namespace Umbraco.Core.Services
/// <param name="versionId">Id of the version to delete</param>
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = 0);
void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1);
/// <summary>
/// Gets an <see cref="IMedia"/> object from the path stored in the 'umbracoFile' property.
@@ -395,7 +395,7 @@ namespace Umbraco.Core.Services
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true);
bool Sort(IEnumerable<IMedia> items, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
@@ -410,7 +410,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = -1);
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
@@ -425,7 +425,7 @@ namespace Umbraco.Core.Services
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0);
IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = -1);
/// <summary>
/// Gets the content of a media as a stream.
@@ -15,7 +15,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional Id of the user performing the import</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated content</returns>
IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true);
IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves package xml as <see cref="IContentType"/>
@@ -24,7 +24,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true);
IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves package xml as <see cref="IContentType"/>
@@ -34,7 +34,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true);
IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves package xml as <see cref="IDataType"/>
@@ -43,7 +43,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated DataTypeDefinitions</returns>
IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true);
IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves the 'DictionaryItems' part of the package xml as a list of <see cref="IDictionaryItem"/>
@@ -60,7 +60,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumerable list of generated languages</returns>
IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true);
IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves the 'Macros' part of a package xml as a list of <see cref="IMacro"/>
@@ -69,7 +69,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns></returns>
IEnumerable<IMacro> ImportMacros(XElement element, int userId = 0, bool raiseEvents = true);
IEnumerable<IMacro> ImportMacros(XElement element, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Imports and saves package xml as <see cref="ITemplate"/>
@@ -78,7 +78,7 @@ namespace Umbraco.Core.Services
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin)</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated Templates</returns>
IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true);
IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true);
/// <summary>
/// Exports an <see cref="IContentType"/> to xml as an <see cref="XElement"/>
@@ -162,7 +162,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="contentTypeAlias">Alias of the <see cref="IContentType"/></param>
/// <param name="userId">Optional id of the user creating the content</param>
/// <returns><see cref="IContent"/></returns>
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
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
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
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
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
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
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
/// <param name="contentTypeAlias">The alias of the content type.</param>
/// <param name="userId">The optional id of the user creating the content.</param>
/// <returns>The content object.</returns>
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
/// <inheritdoc />
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
}
/// <inheritdoc />
public OperationResult Save(IEnumerable<IContent> contents, int userId = 0, bool raiseEvents = true)
public OperationResult Save(IEnumerable<IContent> contents, int userId = -1, bool raiseEvents = true)
{
var evtMsgs = EventMessagesFactory.Get();
var contentsA = contents.ToArray();
@@ -942,7 +942,7 @@ namespace Umbraco.Core.Services.Implement
}
/// <inheritdoc />
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
}
/// <inheritdoc />
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
}
/// <inheritdoc />
public IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = null, string segment = null, int userId = 0)
public IEnumerable<PublishResult> 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
/// <inheritdoc />
public IEnumerable<PublishResult> SaveAndPublishBranch(IContent document, bool force,
Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = 0)
Func<IContent, bool> editing, Func<IContent, bool> publishValues, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
var results = new List<PublishResult>();
@@ -1372,7 +1372,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="id">Id of the <see cref="IContent"/> object to delete versions from</param>
/// <param name="versionDate">Latest version date</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
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
/// <param name="versionId">Id of the version to delete</param>
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
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
/// <param name="content">The <see cref="IContent"/> to move</param>
/// <param name="parentId">Id of the Content's new Parent</param>
/// <param name="userId">Optional Id of the User moving the Content</param>
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
/// <param name="relateToOriginal">Boolean indicating whether the copy should be related to the original</param>
/// <param name="userId">Optional Id of the User copying the Content</param>
/// <returns>The newly created <see cref="IContent"/> object</returns>
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
/// <param name="recursive">A value indicating whether to recursively copy children.</param>
/// <param name="userId">Optional Id of the User copying the Content</param>
/// <returns>The newly created <see cref="IContent"/> object</returns>
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
/// <param name="content">The <see cref="IContent"/> to send to publication</param>
/// <param name="userId">Optional Id of the User issueing the send to publication</param>
/// <returns>True if sending publication was succesfull otherwise false</returns>
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
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<IContent> 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
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<int> ids, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<int> 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
/// </remarks>
/// <param name="contentTypeId">Id of the <see cref="IContentType"/></param>
/// <param name="userId">Optional Id of the user issueing the delete operation</param>
public void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
public void DeleteOfTypes(IEnumerable<int> 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
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="contentTypeId">Id of the <see cref="IContentType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
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<int> contentTypeIds, int userId = 0)
public void DeleteBlueprintsOfTypes(IEnumerable<int> 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);
}
@@ -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<TItem> items, int userId = 0)
public void Save(IEnumerable<TItem> 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<TItem> items, int userId = 0)
public void Delete(IEnumerable<TItem> 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<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> 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<OperationResult> SaveContainer(EntityContainer container, int userId = 0)
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
@@ -870,7 +870,7 @@ namespace Umbraco.Core.Services.Implement
}
}
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0)
public Attempt<OperationResult> 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<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = -1)
{
var evtMsgs = EventMessagesFactory.Get();
using (var scope = ScopeProvider.CreateScope())
@@ -38,7 +38,7 @@ namespace Umbraco.Core.Services.Implement
#region Containers
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> 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<OperationResult> SaveContainer(EntityContainer container, int userId = 0)
public Attempt<OperationResult> 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<OperationResult> DeleteContainer(int containerId, int userId = 0)
public Attempt<OperationResult> 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<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> 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
/// </summary>
/// <param name="dataType"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
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
/// </summary>
/// <param name="dataTypeDefinitions"><see cref="IDataType"/> to save</param>
/// <param name="userId">Id of the user issueing the save</param>
public void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = 0)
public void Save(IEnumerable<IDataType> dataTypeDefinitions, int userId = -1)
{
Save(dataTypeDefinitions, userId, true);
}
@@ -413,7 +413,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="dataType"><see cref="IDataType"/> to delete</param>
/// <param name="userId">Optional Id of the user issueing the deletion</param>
public void Delete(IDataType dataType, int userId = 0)
public void Delete(IDataType dataType, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -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",
@@ -75,7 +75,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="stylesheet"><see cref="Stylesheet"/> to save</param>
/// <param name="userId"></param>
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
/// </summary>
/// <param name="path">Name incl. extension of the Stylesheet to delete</param>
/// <param name="userId"></param>
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
/// </summary>
/// <param name="script"><see cref="Script"/> to save</param>
/// <param name="userId"></param>
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
/// </summary>
/// <param name="path">Name incl. extension of the Script to delete</param>
/// <param name="userId"></param>
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
/// <returns>
/// The template created
/// </returns>
public Attempt<OperationResult<OperationResultType, ITemplate>> CreateTemplateForContentType(string contentTypeAlias, string contentTypeName, int userId = 0)
public Attempt<OperationResult<OperationResultType, ITemplate>> 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, ITemplate>(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
/// </summary>
/// <param name="template"><see cref="Template"/> to save</param>
/// <param name="userId"></param>
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
/// </summary>
/// <param name="templates">List of <see cref="Template"/> to save</param>
/// <param name="userId">Optional id of the user</param>
public void SaveTemplate(IEnumerable<ITemplate> templates, int userId = 0)
public void SaveTemplate(IEnumerable<ITemplate> templates, int userId = -1)
{
var templatesA = templates.ToArray();
using (var scope = ScopeProvider.CreateScope())
@@ -594,7 +594,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="alias">Alias of the <see cref="ITemplate"/> to delete</param>
/// <param name="userId"></param>
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<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = 0)
public Attempt<IPartialView> CreatePartialView(IPartialView partialView, string snippetName = null, int userId = -1)
{
return CreatePartialViewMacro(partialView, PartialViewType.PartialView, snippetName, userId);
}
public Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = 0)
public Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, string snippetName = null, int userId = -1)
{
return CreatePartialViewMacro(partialView, PartialViewType.PartialViewMacro, snippetName, userId);
}
private Attempt<IPartialView> CreatePartialViewMacro(IPartialView partialView, PartialViewType partialViewType, string snippetName = null, int userId = 0)
private Attempt<IPartialView> 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<IPartialView>.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<IPartialView> SavePartialView(IPartialView partialView, int userId = 0)
public Attempt<IPartialView> SavePartialView(IPartialView partialView, int userId = -1)
{
return SavePartialView(partialView, PartialViewType.PartialView, userId);
}
public Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = 0)
public Attempt<IPartialView> SavePartialViewMacro(IPartialView partialView, int userId = -1)
{
return SavePartialView(partialView, PartialViewType.PartialViewMacro, userId);
}
private Attempt<IPartialView> SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = 0)
private Attempt<IPartialView> SavePartialView(IPartialView partialView, PartialViewType partialViewType, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -227,7 +227,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to save</param>
/// <param name="userId">Optional id of the user saving the dictionary item</param>
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
/// </summary>
/// <param name="dictionaryItem"><see cref="IDictionaryItem"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the dictionary item</param>
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
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to save</param>
/// <param name="userId">Optional id of the user saving the language</param>
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
/// </summary>
/// <param name="language"><see cref="ILanguage"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the language</param>
public void Delete(ILanguage language, int userId = 0)
public void Delete(ILanguage language, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -81,7 +81,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to delete</param>
/// <param name="userId">Optional id of the user deleting the macro</param>
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
/// </summary>
/// <param name="macro"><see cref="IMacro"/> to save</param>
/// <param name="userId">Optional Id of the user deleting the macro</param>
public void Save(IMacro macro, int userId = 0)
public void Save(IMacro macro, int userId = -1)
{
using (var scope = ScopeProvider.CreateScope())
{
@@ -112,7 +112,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
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
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
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
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
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
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
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
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
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
/// <param name="mediaTypeAlias">The alias of the media type.</param>
/// <param name="userId">The optional id of the user creating the media.</param>
/// <returns>The media object.</returns>
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
/// <param name="media">The <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
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
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
/// <param name="userId">Id of the User saving the Media</param>
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
public void Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true)
public void Save(IEnumerable<IMedia> medias, int userId = -1, bool raiseEvents = true)
{
((IMediaServiceOperations) this).Save(medias, userId, raiseEvents);
}
@@ -869,7 +869,7 @@ namespace Umbraco.Core.Services.Implement
/// </remarks>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
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
/// <param name="id">Id of the <see cref="IMedia"/> object to delete versions from</param>
/// <param name="versionDate">Latest version date</param>
/// <param name="userId">Optional Id of the User deleting versions of a Media object</param>
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
/// <param name="versionId">Id of the version to delete</param>
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
/// <param name="userId">Optional Id of the User deleting versions of a Media object</param>
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
/// </summary>
/// <param name="media">The <see cref="IMedia"/> to delete</param>
/// <param name="userId">Id of the User deleting the Media</param>
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
/// <param name="media">The <see cref="IMedia"/> to move</param>
/// <param name="parentId">Id of the Media's new Parent</param>
/// <param name="userId">Id of the User moving the Media</param>
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
/// <param name="userId"></param>
/// <param name="raiseEvents"></param>
/// <returns>True if sorting succeeded, otherwise False</returns>
public bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true)
public bool Sort(IEnumerable<IMedia> 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
/// </remarks>
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteMediaOfTypes(IEnumerable<int> mediaTypeIds, int userId = 0)
public void DeleteMediaOfTypes(IEnumerable<int> 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
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user deleting the media</param>
public void DeleteMediaOfType(int mediaTypeId, int userId = 0)
public void DeleteMediaOfType(int mediaTypeId, int userId = -1)
{
DeleteMediaOfTypes(new[] { mediaTypeId }, userId);
}
@@ -127,7 +127,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional Id of the user performing the import</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated content</returns>
public IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContent> ImportContent(XElement element, int parentId = -1, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -337,7 +337,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
public IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContentType> ImportContentTypes(XElement element, int userId = -1, bool raiseEvents = true)
{
return ImportContentTypes(element, true, userId);
}
@@ -350,7 +350,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation. Default is zero (admin).</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated ContentTypes</returns>
public IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = 0, bool raiseEvents = true)
public IEnumerable<IContentType> ImportContentTypes(XElement element, bool importStructure, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -856,7 +856,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the user</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated DataTypeDefinitions</returns>
public IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IDataType> ImportDataTypeDefinitions(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1190,7 +1190,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumerable list of generated languages</returns>
public IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = 0, bool raiseEvents = true)
public IEnumerable<ILanguage> ImportLanguages(XElement languageElementList, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1231,7 +1231,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional id of the User performing the operation</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns></returns>
public IEnumerable<IMacro> ImportMacros(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IMacro> ImportMacros(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1502,7 +1502,7 @@ namespace Umbraco.Core.Services.Implement
/// <param name="userId">Optional user id</param>
/// <param name="raiseEvents">Optional parameter indicating whether or not to raise events</param>
/// <returns>An enumrable list of generated Templates</returns>
public IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<ITemplate> ImportTemplates(XElement element, int userId = -1, bool raiseEvents = true)
{
if (raiseEvents)
{
@@ -1579,7 +1579,7 @@ namespace Umbraco.Core.Services.Implement
}
public IEnumerable<IFile> ImportStylesheets(XElement element, int userId = 0, bool raiseEvents = true)
public IEnumerable<IFile> 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);
@@ -528,6 +528,26 @@ namespace Umbraco.Tests.Clr
Assert.AreEqual(1, values5D["intValue2"]); // JsonProperty changes property name
}
[Test]
public void EmitFieldGetterSetterEmits()
{
var getter1 = ReflectionUtilities.EmitFieldGetter<Class1, int>("Field1");
var getter2 = ReflectionUtilities.EmitFieldGetter<Class1, int>("Field2");
var c = new Class1();
Assert.AreEqual(33, getter1(c));
Assert.AreEqual(66, getter2(c));
var setter2 = ReflectionUtilities.EmitFieldSetter<Class1, int>("Field2");
setter2(c, 99);
Assert.AreEqual(99, getter2(c));
// works on readonly fields!
var (getter3, setter3) = ReflectionUtilities.EmitFieldGetterAndSetter<Class1, int>("Field3");
Assert.AreEqual(22, getter3(c));
setter3(c, 44);
Assert.AreEqual(44, getter3(c));
}
// fixme - missing tests specifying 'returned' on method, property
#region IL Code
@@ -550,6 +570,12 @@ namespace Umbraco.Tests.Clr
// conv.i4
public void SetIntValue2(Class4 object4, object d) => object4.IntValue = (int) (double) d;
// get field
public int GetIntField(Class1 object1) => object1.Field1;
// set field
public void SetIntField(Class1 object1, int i) => object1.Field1 = i;
#endregion
#region Test Objects
@@ -583,6 +609,10 @@ namespace Umbraco.Tests.Clr
public int Value2 { set { } }
public int Value3 { get { return 42; } set { } }
private int ValueP1 => 42;
public int Field1 = 33;
private int Field2 = 66;
public readonly int Field3 = 22;
}
public class Class2 { }
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Persistence;
@@ -293,5 +294,24 @@ namespace Umbraco.Tests.Persistence.NPocoTests
Debug.Print(sql.SQL);
}
[Test]
public void ForUpdate()
{
var sessionId = Guid.NewGuid();
var sql = Sql()
.SelectAll()
.From<UserLoginDto>()
.Where<UserLoginDto>(x => x.SessionId == sessionId);
sql.WriteToConsole();
Assert.AreEqual("SELECT * FROM [umbracoUserLogin] WHERE (([umbracoUserLogin].[sessionId] = @0))", sql.SQL.NoCrLf());
sql = sql.ForUpdate();
sql.WriteToConsole();
Assert.AreEqual("SELECT * FROM [umbracoUserLogin] WITH (UPDLOCK) WHERE (([umbracoUserLogin].[sessionId] = @0))", sql.SQL.NoCrLf());
}
}
}
@@ -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" });
@@ -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<IEntity>(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<IEntity>(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<IEntity>(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<IEntity>(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<IEntity>(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<IEntity>(e => e.Id == node.NodeId);
var notification = repo.CreateNotification((i%2 == 0) ? userAdmin : userNew, entity, i.ToString(CultureInfo.InvariantCulture));
@@ -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]
@@ -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,
@@ -196,12 +196,12 @@ namespace Umbraco.Tests.TestHelpers
public Dictionary<int, IDataType> DataTypes { get; }
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> CreateContainer(int parentId, string name, int userId = -1)
{
throw new NotImplementedException();
}
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = 0)
public Attempt<OperationResult> SaveContainer(EntityContainer container, int userId = -1)
{
throw new NotImplementedException();
}
@@ -231,12 +231,12 @@ namespace Umbraco.Tests.TestHelpers
throw new NotImplementedException();
}
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = 0)
public Attempt<OperationResult> DeleteContainer(int containerId, int userId = -1)
{
throw new NotImplementedException();
}
public Attempt<OperationResult<OperationResultType, EntityContainer>> RenameContainer(int id, string name, int userId = 0)
public Attempt<OperationResult<OperationResultType, EntityContainer>> 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<IDataType> dataTypeDefinitions, int userId = 0)
public void Save(IEnumerable<IDataType> 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();
}
+12 -4
View File
@@ -83,13 +83,21 @@ namespace Umbraco.Web.Editors
private IEnumerable<AuditLog> MapAvatarsAndNames(IEnumerable<AuditLog> items)
{
var userIds = items.Select(x => x.UserId).ToArray();
var users = Services.UserService.GetUsersById(userIds)
var userAvatars = Services.UserService.GetUsersById(userIds)
.ToDictionary(x => x.Id, x => x.GetUserAvatarUrls(ApplicationCache.RuntimeCache));
var userNames = Services.UserService.GetUsersById(userIds).ToDictionary(x => x.Id, x => x.Name);
foreach (var item in items)
{
item.UserAvatars = users[item.UserId];
item.UserName = userNames[item.UserId];
{
if (userAvatars.TryGetValue(item.UserId, out var avatars))
{
item.UserAvatars = avatars;
}
if (userNames.TryGetValue(item.UserId, out var name))
{
item.UserName = name;
}
}
return items;
}
@@ -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
{
@@ -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<Guid>().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))