Skip to content

Commit c016a40

Browse files
Disabled import / export feature for now
1 parent 7f59b2a commit c016a40

File tree

1 file changed

+55
-12
lines changed

1 file changed

+55
-12
lines changed

src/Umbraco.Commerce.Deploy/Composing/UmbracoCommerceDeployComponent.cs

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using Umbraco.Extensions;
1111
using Umbraco.Cms.Core;
1212
using System.Linq;
13-
using Umbraco.Deploy.Core;
1413

1514
namespace Umbraco.Commerce.Deploy.Composing
1615
{
@@ -20,7 +19,8 @@ public partial class UmbracoCommerceDeployComponent : IComponent
2019
private readonly IServiceConnectorFactory _serviceConnectorFactory;
2120
private readonly ITransferEntityService _transferEntityService;
2221

23-
public UmbracoCommerceDeployComponent(IDiskEntityService diskEntityService,
22+
public UmbracoCommerceDeployComponent(
23+
IDiskEntityService diskEntityService,
2424
IServiceConnectorFactory serviceConnectorFactory,
2525
ITransferEntityService transferEntityService)
2626
{
@@ -70,20 +70,36 @@ private void InitializeIntegratedEntities()
7070
SupportsRestore = true,
7171
PermittedToRestore = true,
7272
SupportsPartialRestore = true,
73-
SupportsImportExport = true
73+
//SupportsImportExport = true,
74+
//SupportsExportOfDescendants = true
7475
},
7576
false,
7677
Cms.Constants.Trees.Stores.Alias,
7778
(string routePath, HttpContext httpContext) => MatchesRoutePath(routePath, "productattribute"),
7879
(string nodeId, HttpContext httpContext) => MatchesNodeId(
7980
nodeId,
8081
httpContext,
81-
new Cms.Constants.Trees.Stores.NodeType[]
82-
{
82+
[
8383
Cms.Constants.Trees.Stores.NodeType.ProductAttributes,
8484
Cms.Constants.Trees.Stores.NodeType.ProductAttribute
85-
}),
86-
(string nodeId, HttpContext httpContext, out Guid entityId) => Guid.TryParse(nodeId, out entityId));
85+
]),
86+
(string nodeId, HttpContext httpContext, out Guid entityId) =>
87+
{
88+
if (Guid.TryParse(nodeId, out entityId))
89+
{
90+
return true;
91+
}
92+
else if (int.TryParse(nodeId, out int id) && id == Cms.Constants.Trees.Stores.Ids[Cms.Constants.Trees.Stores.NodeType.ProductAttributes])
93+
{
94+
entityId = Guid.Empty;
95+
return true;
96+
}
97+
else
98+
{
99+
entityId = Guid.Empty;
100+
return false;
101+
}
102+
});
87103
// TODO: , new DeployTransferRegisteredEntityTypeDetail.RemoteTreeDetail(FormsTreeHelper.GetExampleTree, "example", "externalExampleTree"));
88104

89105
_transferEntityService.RegisterTransferEntityType<ProductAttributePresetReadOnly>(
@@ -96,20 +112,36 @@ private void InitializeIntegratedEntities()
96112
SupportsRestore = true,
97113
PermittedToRestore = true,
98114
SupportsPartialRestore = true,
99-
SupportsImportExport = true
115+
//SupportsImportExport = true,
116+
//SupportsExportOfDescendants = true
100117
},
101118
false,
102119
Cms.Constants.Trees.Stores.Alias,
103120
(string routePath, HttpContext httpContext) => MatchesRoutePath(routePath, "productattributepreset"),
104121
(string nodeId, HttpContext httpContext) => MatchesNodeId(
105122
nodeId,
106123
httpContext,
107-
new Cms.Constants.Trees.Stores.NodeType[]
108-
{
124+
[
109125
Cms.Constants.Trees.Stores.NodeType.ProductAttributePresets,
110126
Cms.Constants.Trees.Stores.NodeType.ProductAttributePreset
111-
}),
112-
(string nodeId, HttpContext httpContext, out Guid entityId) => Guid.TryParse(nodeId, out entityId));
127+
]),
128+
(string nodeId, HttpContext httpContext, out Guid entityId) =>
129+
{
130+
if (Guid.TryParse(nodeId, out entityId))
131+
{
132+
return true;
133+
}
134+
else if (int.TryParse(nodeId, out int id) && id == Cms.Constants.Trees.Stores.Ids[Cms.Constants.Trees.Stores.NodeType.ProductAttributePresets])
135+
{
136+
entityId = Guid.Empty;
137+
return true;
138+
}
139+
else
140+
{
141+
entityId = Guid.Empty;
142+
return false;
143+
}
144+
});
113145
// TODO: , new DeployTransferRegisteredEntityTypeDetail.RemoteTreeDetail(FormsTreeHelper.GetExampleTree, "example", "externalExampleTree"));
114146
}
115147

@@ -118,6 +150,17 @@ private static bool MatchesRoutePath(string routePath, string routePartPrefix)
118150

119151
private static bool MatchesNodeId(string nodeId, HttpContext httpContext, Cms.Constants.Trees.Stores.NodeType[] nodeTypes)
120152
{
153+
if (int.TryParse(nodeId, out int id))
154+
{
155+
foreach (var nt in nodeTypes)
156+
{
157+
if (Cms.Constants.Trees.Stores.Ids.ContainsKey(nt) && Cms.Constants.Trees.Stores.Ids[nt] == id)
158+
{
159+
return true;
160+
}
161+
}
162+
}
163+
121164
var nodeType = httpContext.Request.Query["nodeType"].ToString();
122165
return nodeTypes.Select(x => x.ToString()).InvariantContains(nodeType);
123166
}

0 commit comments

Comments
 (0)