Skip to content

Commit 699e86a

Browse files
authored
ENGCOM-3995: Granular Magento_Customer ACL #20436
2 parents 77ed839 + 007e8f5 commit 699e86a

File tree

8 files changed

+54
-4
lines changed

8 files changed

+54
-4
lines changed

app/code/Magento/Customer/Block/Adminhtml/Edit/DeleteButton.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
/**
1212
* Class DeleteButton
13+
*
1314
* @package Magento\Customer\Block\Adminhtml\Edit
1415
*/
1516
class DeleteButton extends GenericButton implements ButtonProviderInterface
@@ -36,6 +37,8 @@ public function __construct(
3637
}
3738

3839
/**
40+
* Get button data.
41+
*
3942
* @return array
4043
*/
4144
public function getButtonData()
@@ -53,12 +56,15 @@ public function getButtonData()
5356
],
5457
'on_click' => '',
5558
'sort_order' => 20,
59+
'aclResource' => 'Magento_Customer::delete',
5660
];
5761
}
5862
return $data;
5963
}
6064

6165
/**
66+
* Get delete url.
67+
*
6268
* @return string
6369
*/
6470
public function getDeleteUrl()

app/code/Magento/Customer/Block/Adminhtml/Edit/InvalidateTokenButton.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99

1010
/**
1111
* Class InvalidateTokenButton
12+
*
1213
* @package Magento\Customer\Block\Adminhtml\Edit
1314
*/
1415
class InvalidateTokenButton extends GenericButton implements ButtonProviderInterface
1516
{
1617
/**
18+
* Get button data.
19+
*
1720
* @return array
1821
*/
1922
public function getButtonData()
@@ -27,12 +30,15 @@ public function getButtonData()
2730
'class' => 'invalidate-token',
2831
'on_click' => 'deleteConfirm("' . $deleteConfirmMsg . '", "' . $this->getInvalidateTokenUrl() . '")',
2932
'sort_order' => 65,
33+
'aclResource' => 'Magento_Customer::invalidate_tokens',
3034
];
3135
}
3236
return $data;
3337
}
3438

3539
/**
40+
* Get invalidate token url.
41+
*
3642
* @return string
3743
*/
3844
public function getInvalidateTokenUrl()

app/code/Magento/Customer/Block/Adminhtml/Edit/ResetPasswordButton.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function getButtonData()
2727
'class' => 'reset reset-password',
2828
'on_click' => sprintf("location.href = '%s';", $this->getResetPasswordUrl()),
2929
'sort_order' => 60,
30+
'aclResource' => 'Magento_Customer::reset_password',
3031
];
3132
}
3233
return $data;

app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Customer\Controller\Adminhtml\Customer;
99

10+
use Magento\Framework\App\Action\HttpGetActionInterface;
1011
use Magento\Integration\Api\CustomerTokenServiceInterface;
1112
use Magento\Customer\Api\AccountManagementInterface;
1213
use Magento\Customer\Api\AddressRepositoryInterface;
@@ -25,8 +26,15 @@
2526
* @SuppressWarnings(PHPMD.TooManyFields)
2627
* @SuppressWarnings(PHPMD.NumberOfChildren)
2728
*/
28-
class InvalidateToken extends \Magento\Customer\Controller\Adminhtml\Index
29+
class InvalidateToken extends \Magento\Customer\Controller\Adminhtml\Index implements HttpGetActionInterface
2930
{
31+
/**
32+
* Authorization level of a basic admin session
33+
*
34+
* @see _isAllowed()
35+
*/
36+
const ADMIN_RESOURCE = 'Magento_Customer::invalidate_tokens';
37+
3038
/**
3139
* @var CustomerTokenServiceInterface
3240
*/

app/code/Magento/Customer/Controller/Adminhtml/Index/Delete.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@
88
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
99
use Magento\Framework\Controller\ResultFactory;
1010

11+
/**
12+
* Delete customer action.
13+
*/
1114
class Delete extends \Magento\Customer\Controller\Adminhtml\Index implements HttpPostActionInterface
1215
{
16+
/**
17+
* Authorization level of a basic admin session
18+
*
19+
* @see _isAllowed()
20+
*/
21+
const ADMIN_RESOURCE = 'Magento_Customer::delete';
22+
1323
/**
1424
* Delete customer action
1525
*

app/code/Magento/Customer/Controller/Adminhtml/Index/MassDelete.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
*/
1919
class MassDelete extends AbstractMassAction implements HttpPostActionInterface
2020
{
21+
/**
22+
* Authorization level of a basic admin session
23+
*
24+
* @see _isAllowed()
25+
*/
26+
const ADMIN_RESOURCE = 'Magento_Customer::delete';
27+
2128
/**
2229
* @var CustomerRepositoryInterface
2330
*/
@@ -40,8 +47,7 @@ public function __construct(
4047
}
4148

4249
/**
43-
* @param AbstractCollection $collection
44-
* @return \Magento\Backend\Model\View\Result\Redirect
50+
* @inheritdoc
4551
*/
4652
protected function massAction(AbstractCollection $collection)
4753
{

app/code/Magento/Customer/Controller/Adminhtml/Index/ResetPassword.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
*/
1717
class ResetPassword extends \Magento\Customer\Controller\Adminhtml\Index implements HttpGetActionInterface
1818
{
19+
/**
20+
* Authorization level of a basic admin session
21+
*
22+
* @see _isAllowed()
23+
*/
24+
const ADMIN_RESOURCE = 'Magento_Customer::reset_password';
25+
1926
/**
2027
* Reset password handler
2128
*

app/code/Magento/Customer/etc/acl.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
<resources>
1111
<resource id="Magento_Backend::admin">
1212
<resource id="Magento_Customer::customer" title="Customers" translate="title" sortOrder="40">
13-
<resource id="Magento_Customer::manage" title="All Customers" translate="title" sortOrder="10" />
13+
<resource id="Magento_Customer::manage" title="All Customers" translate="title" sortOrder="10">
14+
<resource id="Magento_Customer::actions" title="Actions" translate="title" sortOrder="10">
15+
<resource id="Magento_Customer::delete" title="Delete" translate="title" sortOrder="10" />
16+
<resource id="Magento_Customer::reset_password" title="Reset password" translate="title" sortOrder="20" />
17+
<resource id="Magento_Customer::invalidate_tokens" title="Invalidate tokens" translate="title" sortOrder="30" />
18+
</resource>
19+
</resource>
1420
<resource id="Magento_Customer::online" title="Now Online" translate="title" sortOrder="20" />
1521
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="30" />
1622
</resource>

0 commit comments

Comments
 (0)