Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 6c33d20

Browse files
theroolmage2pratik
authored andcommitted
Correctly convert config integration api resources
1 parent ab5c07d commit 6c33d20

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

app/code/Magento/Integration/Model/Config/Consolidated/Converter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ public function convert($source)
8080
$result[$integrationName][self::API_RESOURCES][] = $name;
8181
}
8282
}
83+
84+
// Add root resource if any child has been added
85+
if (! empty($result[$integrationName][self::API_RESOURCES])) {
86+
array_unshift($result[$integrationName][self::API_RESOURCES], $allResources[1]['id']);
87+
}
88+
8389
// Remove any duplicates added parents
8490
$result[$integrationName][self::API_RESOURCES] =
8591
array_values(array_unique($result[$integrationName][self::API_RESOURCES]));

app/code/Magento/Integration/Test/Unit/Model/Config/Consolidated/_files/acl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
return [
77
[],
88
[
9+
'id' => 'Magento_Backend::admin',
10+
'title' => 'Magento Admin (Root)',
911
'children' =>
1012
[
1113
[

app/code/Magento/Integration/Test/Unit/Model/Config/Consolidated/_files/integration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'endpoint_url' => 'http://endpoint.com',
1010
'identity_link_url' => 'http://www.example.com/identity',
1111
'resource' => [
12+
'Magento_Backend::admin',
1213
'Magento_Customer::manageParent',
1314
'Magento_Customer::manage',
1415
'Magento_SalesRule::quoteParent',
@@ -17,6 +18,9 @@
1718
],
1819
'TestIntegration2' => [
1920
'email' => '[email protected]',
20-
'resource' => ['Magento_Sales::sales']
21+
'resource' => [
22+
'Magento_Backend::admin',
23+
'Magento_Sales::sales'
24+
]
2125
]
2226
];

app/code/Magento/Integration/Test/Unit/Model/Config/Consolidated/_files/integration.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<integration name="TestIntegration2">
1919
<email>[email protected]</email>
2020
<resources>
21+
<resource name="Magento_Backend::admin" />
2122
<resource name="Magento_Sales::sales" />
2223
</resources>
2324
</integration>

0 commit comments

Comments
 (0)