File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/code/Magento/Backend/App Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ abstract class AbstractAction extends \Magento\Framework\App\Action\Action
22
22
*/
23
23
const SESSION_NAMESPACE = 'adminhtml ' ;
24
24
25
+ /**
26
+ * Authorization level of a basic admin session
27
+ */
28
+ const ADMIN_RESOURCE = 'Magento_Backend::admin ' ;
29
+
25
30
/**
26
31
* Array of actions which can be processed without secret key validation
27
32
*
@@ -76,10 +81,17 @@ abstract class AbstractAction extends \Magento\Framework\App\Action\Action
76
81
*/
77
82
protected $ _formKeyValidator ;
78
83
84
+ /**
85
+ * Resource used to authorize access to the controller
86
+ *
87
+ * @var string
88
+ */
89
+ protected $ resource ;
90
+
79
91
/**
80
92
* @param \Magento\Backend\App\Action\Context $context
81
93
*/
82
- public function __construct (Action \Context $ context )
94
+ public function __construct (Action \Context $ context, $ resource = '' )
83
95
{
84
96
parent ::__construct ($ context );
85
97
$ this ->_authorization = $ context ->getAuthorization ();
@@ -97,7 +109,7 @@ public function __construct(Action\Context $context)
97
109
*/
98
110
protected function _isAllowed ()
99
111
{
100
- return true ;
112
+ return $ this -> _authorization -> isAllowed ( $ this -> resource ?: self :: ADMIN_RESOURCE ) ;
101
113
}
102
114
103
115
/**
You can’t perform that action at this time.
0 commit comments