File tree Expand file tree Collapse file tree 11 files changed +31
-33
lines changed
dev/tests/integration/testsuite/Magento/Review/Controller/Adminhtml/Product Expand file tree Collapse file tree 11 files changed +31
-33
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ protected function _construct()
186
186
) . '\', ' . '\'' . $ this ->getUrl (
187
187
'*/*/delete ' ,
188
188
[$ this ->_objectId => $ this ->getRequest ()->getParam ($ this ->_objectId ), 'ret ' => 'pending ' ]
189
- ) . '\'' . ' ) '
189
+ ) . '\', {data: {}} ) '
190
190
);
191
191
$ this ->_coreRegistry ->register ('ret ' , 'pending ' );
192
192
}
Original file line number Diff line number Diff line change 16
16
*/
17
17
abstract class Product extends Action
18
18
{
19
+ /**
20
+ * Authorization resource
21
+ */
22
+ public const ADMIN_RESOURCE = 'Magento_Review::reviews_all ' ;
23
+
19
24
/**
20
25
* Array of actions which can be processed without secret key validation
21
26
*
@@ -61,12 +66,4 @@ public function __construct(
61
66
$ this ->ratingFactory = $ ratingFactory ;
62
67
parent ::__construct ($ context );
63
68
}
64
-
65
- /**
66
- * @inheritdoc
67
- */
68
- protected function _isAllowed ()
69
- {
70
- return $ this ->_authorization ->isAllowed ('Magento_Review::reviews_all ' );
71
- }
72
69
}
Original file line number Diff line number Diff line change 9
9
use Magento \Review \Controller \Adminhtml \Product as ProductController ;
10
10
use Magento \Framework \Controller \ResultFactory ;
11
11
use Magento \Review \Model \Review ;
12
- use Magento \Framework \App \Action \HttpGetActionInterface ;
13
12
14
13
/**
15
14
* Delete action.
16
15
*/
17
- class Delete extends ProductController implements HttpGetActionInterface, HttpPostActionInterface
16
+ class Delete extends ProductController implements HttpPostActionInterface
18
17
{
19
18
/**
20
19
* @var Review
@@ -55,7 +54,7 @@ public function execute()
55
54
*/
56
55
protected function _isAllowed ()
57
56
{
58
- if ($ this -> _authorization -> isAllowed ( ' Magento_Review::reviews_all ' )) {
57
+ if (parent :: _isAllowed ( )) {
59
58
return true ;
60
59
}
61
60
@@ -81,7 +80,7 @@ protected function _isAllowed()
81
80
*/
82
81
private function getModel (): Review
83
82
{
84
- if (! $ this ->model ) {
83
+ if ($ this ->model === null ) {
85
84
$ this ->model = $ this ->reviewFactory ->create ()
86
85
->load ($ this ->getRequest ()->getParam ('id ' , false ));
87
86
}
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ public function execute()
41
41
*/
42
42
protected function _isAllowed ()
43
43
{
44
- if ($ this -> _authorization -> isAllowed ( ' Magento_Review::reviews_all ' )) {
44
+ if (parent :: _isAllowed ( )) {
45
45
return true ;
46
46
}
47
47
@@ -67,7 +67,7 @@ protected function _isAllowed()
67
67
*/
68
68
private function getModel (): Review
69
69
{
70
- if (! $ this ->review ) {
70
+ if ($ this ->review === null ) {
71
71
$ this ->review = $ this ->reviewFactory ->create ()
72
72
->load ($ this ->getRequest ()->getParam ('id ' , false ));
73
73
}
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ public function execute()
85
85
*/
86
86
protected function _isAllowed ()
87
87
{
88
- if ($ this -> _authorization -> isAllowed ( ' Magento_Review::reviews_all ' )) {
88
+ if (parent :: _isAllowed ( )) {
89
89
return true ;
90
90
}
91
91
@@ -116,7 +116,7 @@ protected function _isAllowed()
116
116
*/
117
117
private function getCollection (): Collection
118
118
{
119
- if (! $ this ->collection ) {
119
+ if ($ this ->collection === null ) {
120
120
$ collection = $ this ->collectionFactory ->create ();
121
121
$ collection ->addFieldToFilter (
122
122
'main_table. ' . $ collection ->getResource ()
Original file line number Diff line number Diff line change @@ -89,20 +89,20 @@ public function execute()
89
89
*/
90
90
protected function _isAllowed ()
91
91
{
92
- if (! $ this -> _authorization -> isAllowed ( ' Magento_Review::pending ' )) {
93
- return false ;
92
+ if (parent :: _isAllowed ( )) {
93
+ return true ;
94
94
}
95
95
96
- if ($ this ->_authorization ->isAllowed ('Magento_Review::reviews_all ' )) {
97
- return true ;
96
+ if (! $ this ->_authorization ->isAllowed ('Magento_Review::pending ' )) {
97
+ return false ;
98
98
}
99
99
100
100
foreach ($ this ->getCollection () as $ model ) {
101
101
if ($ model ->getStatusId () != Review::STATUS_PENDING ) {
102
102
$ this ->messageManager ->addErrorMessage (
103
103
__ (
104
- 'Sorry, You have not permission to do this. '
105
- . ' One or more of the reviews are not in Pending Status. '
104
+ 'Sorry, You have not permission to do this. '
105
+ . 'One or more of the reviews are not in Pending Status. '
106
106
)
107
107
);
108
108
@@ -120,7 +120,7 @@ protected function _isAllowed()
120
120
*/
121
121
private function getCollection (): Collection
122
122
{
123
- if (! $ this ->collection ) {
123
+ if ($ this ->collection === null ) {
124
124
$ collection = $ this ->collectionFactory ->create ();
125
125
$ collection ->addFieldToFilter (
126
126
'main_table. ' . $ collection ->getResource ()
Original file line number Diff line number Diff line change 8
8
use Magento \Review \Controller \Adminhtml \Product as ProductController ;
9
9
use Magento \Framework \Controller \ResultFactory ;
10
10
use Magento \Framework \App \Action \HttpGetActionInterface ;
11
+ use Magento \Framework \App \Action \HttpPostActionInterface ;
11
12
12
13
/**
13
14
* Pending reviews grid.
14
15
*/
15
- class Pending extends ProductController implements HttpGetActionInterface
16
+ class Pending extends ProductController implements HttpGetActionInterface, HttpPostActionInterface
16
17
{
17
18
/**
18
19
* Execute action.
Original file line number Diff line number Diff line change 14
14
use Magento \Framework \Controller \ResultFactory ;
15
15
use Magento \Framework \App \Request \Http ;
16
16
use Magento \Framework \App \Action \HttpGetActionInterface ;
17
+ use Magento \Framework \App \Action \HttpPostActionInterface ;
17
18
18
19
/**
19
20
* Review grid.
20
21
*/
21
- class ReviewGrid extends ProductController implements HttpGetActionInterface
22
+ class ReviewGrid extends ProductController implements HttpGetActionInterface, HttpPostActionInterface
22
23
{
23
24
/**
24
25
* @var \Magento\Framework\View\LayoutFactory
Original file line number Diff line number Diff line change @@ -105,12 +105,12 @@ public function execute()
105
105
*/
106
106
protected function _isAllowed ()
107
107
{
108
- if (! $ this -> _authorization -> isAllowed ( ' Magento_Review::pending ' )) {
109
- return false ;
108
+ if (parent :: _isAllowed ( )) {
109
+ return true ;
110
110
}
111
111
112
- if ($ this ->_authorization ->isAllowed ('Magento_Review::reviews_all ' )) {
113
- return true ;
112
+ if (! $ this ->_authorization ->isAllowed ('Magento_Review::pending ' )) {
113
+ return false ;
114
114
}
115
115
116
116
if ($ this ->getModel ()->getStatusId () != Review::STATUS_PENDING ) {
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class EditTest extends AbstractBackendController
42
42
private $ collectionFactory ;
43
43
44
44
/**
45
- * @inheritDoc
45
+ * @inheritdoc
46
46
*/
47
47
protected function setUp ()
48
48
{
@@ -84,7 +84,7 @@ public function testAclNoAccess(): void
84
84
{
85
85
// Exclude resource from ACL.
86
86
$ this ->resource = ['Magento_Review::reviews_all ' , 'Magento_Review::pending ' ];
87
- $ this ->uri = 'backend/review/product/edit/id/ ' . 'doesnt matter ' ;
87
+ $ this ->uri = 'backend/review/product/edit/id/ ' . 'doesn \' t matter ' ;
88
88
89
89
parent ::testAclNoAccess ();
90
90
}
You can’t perform that action at this time.
0 commit comments