Skip to content

Commit 665ca1f

Browse files
author
Bryant Luk
committed
MAGETWO-36063: Update REST and SOAP controllers to filter out attributes based on ACL
- Use specific DataObjectProcessor when serializing the response. This is to isolate the times whenever we write out a data array in the system. Only do permission checks on the serialization of the outbound response.
1 parent 6f12219 commit 665ca1f

File tree

2 files changed

+43
-0
lines changed
  • app/code/Magento/Webapi/etc

2 files changed

+43
-0
lines changed

app/code/Magento/Webapi/etc/webapi_rest/di.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,25 @@
7171
<type name="Magento\Framework\Authorization">
7272
<plugin name="guestAuthorization" type="Magento\Webapi\Model\Plugin\GuestAuthorization" />
7373
</type>
74+
75+
<!-- Configuration to check that the permissions are checked on fields -->
76+
<virtualType name="Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked" type="Magento\Framework\Reflection\ExtensionAttributesProcessor">
77+
<arguments>
78+
<argument name="isPermissionChecked" xsi:type="boolean">true</argument>
79+
<argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessor\Proxy</argument>
80+
</arguments>
81+
</virtualType>
82+
<virtualType name="Magento\Framework\Reflection\DataObjectProcessorPermissionChecked" type="Magento\Framework\Reflection\DataObjectProcessor">
83+
<arguments>
84+
<argument name="extensionAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked</argument>
85+
<argument name="customAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\CustomAttributesProcessor\Proxy</argument>
86+
</arguments>
87+
</virtualType>
88+
89+
<type name="Magento\Framework\Webapi\ServiceOutputProcessor">
90+
<arguments>
91+
<argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessorPermissionChecked</argument>
92+
</arguments>
93+
</type>
94+
<!-- End of configuration to check that permissions are checked on fields -->
7495
</config>

app/code/Magento/Webapi/etc/webapi_soap/di.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,26 @@
3939
<type name="Magento\Framework\Authorization">
4040
<plugin name="guestAuthorization" type="Magento\Webapi\Model\Plugin\GuestAuthorization" />
4141
</type>
42+
43+
<!-- Configuration to check that the permissions are checked on fields -->
44+
<virtualType name="Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked" type="Magento\Framework\Reflection\ExtensionAttributesProcessor">
45+
<arguments>
46+
<argument name="isPermissionChecked" xsi:type="boolean">true</argument>
47+
<argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessor\Proxy</argument>
48+
</arguments>
49+
</virtualType>
50+
<virtualType name="Magento\Framework\Reflection\DataObjectProcessorPermissionChecked" type="Magento\Framework\Reflection\DataObjectProcessor">
51+
<arguments>
52+
<argument name="extensionAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\ExtensionAttributesProcessorPermissionChecked</argument>
53+
<argument name="customAttributesProcessor" xsi:type="object">Magento\Framework\Reflection\CustomAttributesProcessor\Proxy</argument>
54+
</arguments>
55+
</virtualType>
56+
57+
<type name="Magento\Webapi\Controller\Soap\Request\Handler">
58+
<arguments>
59+
<argument name="dataObjectProcessor" xsi:type="object">Magento\Framework\Reflection\DataObjectProcessorPermissionChecked</argument>
60+
</arguments>
61+
</type>
62+
<!-- End of configuration to check that permissions are checked on fields -->
63+
4264
</config>

0 commit comments

Comments
 (0)