Skip to content

Commit 5b1c86c

Browse files
author
Joan He
committed
Merge remote-tracking branch 'origin/MAGETWO-37981-case-sensitive-actions' into develop
2 parents f15ddf1 + 064d7f3 commit 5b1c86c

File tree

99 files changed

+534
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+534
-141
lines changed

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,6 @@ class Notification extends \Magento\Backend\App\AbstractAction
1414
*/
1515
protected function _isAllowed()
1616
{
17-
switch ($this->getRequest()->getActionName()) {
18-
case 'markAsRead':
19-
$acl = 'Magento_AdminNotification::mark_as_read';
20-
break;
21-
22-
case 'massMarkAsRead':
23-
$acl = 'Magento_AdminNotification::mark_as_read';
24-
break;
25-
26-
case 'remove':
27-
$acl = 'Magento_AdminNotification::adminnotification_remove';
28-
break;
29-
30-
case 'massRemove':
31-
$acl = 'Magento_AdminNotification::adminnotification_remove';
32-
break;
33-
34-
default:
35-
$acl = 'Magento_AdminNotification::show_list';
36-
}
37-
return $this->_authorization->isAllowed($acl);
17+
return $this->_authorization->isAllowed('Magento_AdminNotification::show_list');
3818
}
3919
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MarkAsRead.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ public function execute()
3636
}
3737
$this->_redirect('adminhtml/*/');
3838
}
39+
40+
/**
41+
* @return bool
42+
*/
43+
protected function _isAllowed()
44+
{
45+
return $this->_authorization->isAllowed('Magento_AdminNotification::mark_as_read');
46+
}
3947
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassMarkAsRead.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@ public function execute()
3838
}
3939
$this->_redirect('adminhtml/*/');
4040
}
41+
42+
/**
43+
* @return bool
44+
*/
45+
protected function _isAllowed()
46+
{
47+
return $this->_authorization->isAllowed('Magento_AdminNotification::mark_as_read');
48+
}
4149
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/MassRemove.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,12 @@ public function execute()
3333
}
3434
$this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($this->getUrl('*')));
3535
}
36+
37+
/**
38+
* @return bool
39+
*/
40+
protected function _isAllowed()
41+
{
42+
return $this->_authorization->isAllowed('Magento_AdminNotification::adminnotification_remove');
43+
}
3644
}

app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/Remove.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,12 @@ public function execute()
3535
}
3636
$this->_redirect('adminhtml/*/');
3737
}
38+
39+
/**
40+
* @return bool
41+
*/
42+
protected function _isAllowed()
43+
{
44+
return $this->_authorization->isAllowed('Magento_AdminNotification::adminnotification_remove');
45+
}
3846
}

app/code/Magento/Sales/Controller/Adminhtml/Order.php

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -124,47 +124,10 @@ protected function _initOrder()
124124
}
125125

126126
/**
127-
* Acl check for admin
128-
*
129127
* @return bool
130-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
131128
*/
132129
protected function _isAllowed()
133130
{
134-
$action = strtolower($this->getRequest()->getActionName());
135-
switch ($action) {
136-
case 'hold':
137-
$aclResource = 'Magento_Sales::hold';
138-
break;
139-
case 'unhold':
140-
$aclResource = 'Magento_Sales::unhold';
141-
break;
142-
case 'email':
143-
$aclResource = 'Magento_Sales::email';
144-
break;
145-
case 'cancel':
146-
$aclResource = 'Magento_Sales::cancel';
147-
break;
148-
case 'view':
149-
$aclResource = 'Magento_Sales::actions_view';
150-
break;
151-
case 'addcomment':
152-
$aclResource = 'Magento_Sales::comment';
153-
break;
154-
case 'creditmemos':
155-
$aclResource = 'Magento_Sales::creditmemo';
156-
break;
157-
case 'reviewpayment':
158-
$aclResource = 'Magento_Sales::review_payment';
159-
break;
160-
case 'address':
161-
case 'addresssave':
162-
$aclResource = 'Magento_Sales::actions_edit';
163-
break;
164-
default:
165-
$aclResource = 'Magento_Sales::sales_order';
166-
break;
167-
}
168-
return $this->_authorization->isAllowed($aclResource);
131+
return $this->_authorization->isAllowed('Magento_Sales::sales_order');
169132
}
170133
}

app/code/Magento/Sales/Controller/Adminhtml/Order/AddComment.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,12 @@ public function execute()
5757
}
5858
return $this->resultRedirectFactory->create()->setPath('sales/*/');
5959
}
60+
61+
/**
62+
* @return bool
63+
*/
64+
protected function _isAllowed()
65+
{
66+
return $this->_authorization->isAllowed('Magento_Sales::comment');
67+
}
6068
}

app/code/Magento/Sales/Controller/Adminhtml/Order/Address.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ public function execute()
3131
return $this->resultRedirectFactory->create()->setPath('sales/*/');
3232
}
3333
}
34+
35+
/**
36+
* @return bool
37+
*/
38+
protected function _isAllowed()
39+
{
40+
return $this->_authorization->isAllowed('Magento_Sales::actions_edit');
41+
}
3442
}

app/code/Magento/Sales/Controller/Adminhtml/Order/AddressSave.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,12 @@ public function execute()
3535
return $resultRedirect->setPath('sales/*/');
3636
}
3737
}
38+
39+
/**
40+
* @return bool
41+
*/
42+
protected function _isAllowed()
43+
{
44+
return $this->_authorization->isAllowed('Magento_Sales::actions_edit');
45+
}
3846
}

app/code/Magento/Sales/Controller/Adminhtml/Order/Cancel.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ public function execute()
3131
}
3232
return $resultRedirect->setPath('sales/*/');
3333
}
34+
35+
/**
36+
* @return bool
37+
*/
38+
protected function _isAllowed()
39+
{
40+
return $this->_authorization->isAllowed('Magento_Sales::cancel');
41+
}
3442
}

0 commit comments

Comments
 (0)