Skip to content

Commit 771dc31

Browse files
committed
Introduce granulated Media Gallery ACL resources and enforce for old media gallery
1 parent 18da36b commit 771dc31

File tree

10 files changed

+57
-6
lines changed

10 files changed

+57
-6
lines changed

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFiles.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
*/
1414
class DeleteFiles extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images implements HttpPostActionInterface
1515
{
16+
/**
17+
* @see _isAllowed()
18+
*/
19+
public const ADMIN_RESOURCE = 'Magento_Cms::delete_assets';
20+
1621
/**
1722
* @var \Magento\Framework\Controller\Result\JsonFactory
1823
*/

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
*/
1818
class DeleteFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images implements HttpPostActionInterface
1919
{
20+
/**
21+
* @see _isAllowed()
22+
*/
23+
public const ADMIN_RESOURCE = 'Magento_Cms::delete_folder';
24+
2025
/**
2126
* @var \Magento\Framework\Controller\Result\JsonFactory
2227
*/

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolder.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
*/
1515
class NewFolder extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images implements HttpPostActionInterface
1616
{
17+
/**
18+
* @see _isAllowed()
19+
*/
20+
public const ADMIN_RESOURCE = 'Magento_Cms::create_folder';
21+
1722
/**
1823
* @var \Magento\Framework\Controller\Result\JsonFactory
1924
*/
@@ -65,7 +70,7 @@ public function execute()
6570
}
6671
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
6772
$resultJson = $this->resultJsonFactory->create();
68-
73+
6974
return $resultJson->setData($result);
7075
}
7176
}

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/OnInsert.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
class OnInsert extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images
1010
{
11+
/**
12+
* @see _isAllowed()
13+
*/
14+
public const ADMIN_RESOURCE = 'Magento_Cms::insert_assets';
15+
1116
/**
1217
* @var \Magento\Framework\Controller\Result\RawFactory
1318
*/

app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/Upload.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
*/
1818
class Upload extends \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images implements HttpPostActionInterface
1919
{
20+
/**
21+
* @see _isAllowed()
22+
*/
23+
public const ADMIN_RESOURCE = 'Magento_Cms::upload_assets';
24+
2025
/**
2126
* @var \Magento\Framework\Controller\Result\JsonFactory
2227
*/
@@ -74,7 +79,7 @@ public function execute()
7479
}
7580
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
7681
$resultJson = $this->resultJsonFactory->create();
77-
82+
7883
return $resultJson->setData($response);
7984
}
8085
}

app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/Create.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Create extends Action implements HttpPostActionInterface
2929
/**
3030
* @see _isAllowed()
3131
*/
32-
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
32+
public const ADMIN_RESOURCE = 'Magento_Cms::create_folder';
3333

3434
/**
3535
* @var CreateDirectoriesByPathsInterface

app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Delete extends Action implements HttpPostActionInterface
3030
/**
3131
* @see _isAllowed()
3232
*/
33-
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
33+
public const ADMIN_RESOURCE = 'Magento_Cms::delete_folder';
3434

3535
/**
3636
* @var DeleteAssetsByPathsInterface

app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Image/Delete.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Delete extends Action implements HttpPostActionInterface
3131
/**
3232
* @see _isAllowed()
3333
*/
34-
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
34+
public const ADMIN_RESOURCE = 'Magento_Cms::delete_assets';
3535

3636
/**
3737
* @var DeleteImage

app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Image/Upload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Upload extends Action implements HttpPostActionInterface
2828
/**
2929
* @see _isAllowed()
3030
*/
31-
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
31+
public const ADMIN_RESOURCE = 'Magento_Cms::upload_assets';
3232

3333
/**
3434
* @var UploadImage
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
9+
<acl>
10+
<resources>
11+
<resource id="Magento_Backend::admin">
12+
<resource id="Magento_Backend::content">
13+
<resource id="Magento_Backend::content_elements">
14+
<resource id="Magento_Cms::media_gallery">
15+
<resource id="Magento_Cms::upload_assets" title="Upload Assets" translate="title" sortOrder="70"/>
16+
<resource id="Magento_Cms::delete_assets" title="Delete Assets" translate="title" sortOrder="60"/>
17+
<resource id="Magento_Cms::insert_assets" title="Insert Assets into the content" translate="title" sortOrder="50"/>
18+
<resource id="Magento_Cms::create_folder" title="Create Folder" translate="title" sortOrder="40"/>
19+
<resource id="Magento_Cms::delete_folder" title="Delete Folder" translate="title" sortOrder="40"/>
20+
</resource>
21+
</resource>
22+
</resource>
23+
</resource>
24+
</resources>
25+
</acl>
26+
</config>

0 commit comments

Comments
 (0)