Skip to content

Commit c14aed1

Browse files
author
igor-chepurnoi
committed
add "accessControlConfig" property to ManageController
1 parent cba63fd commit c14aed1

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

controllers/ManageController.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace yii2mod\comments\controllers;
44

55
use Yii;
6-
use yii\filters\AccessControl;
76
use yii\filters\VerbFilter;
87
use yii\web\Controller;
98
use yii\web\NotFoundHttpException;
@@ -34,6 +33,19 @@ class ManageController extends Controller
3433
*/
3534
public $searchClass = 'yii2mod\comments\models\search\CommentSearch';
3635

36+
/**
37+
* @var array access control config
38+
*/
39+
public $accessControlConfig = [
40+
'class' => 'yii\filters\AccessControl',
41+
'rules' => [
42+
[
43+
'allow' => true,
44+
'roles' => ['admin'],
45+
],
46+
],
47+
];
48+
3749
/**
3850
* @inheritdoc
3951
*/
@@ -48,15 +60,7 @@ public function behaviors()
4860
'delete' => ['post'],
4961
],
5062
],
51-
'access' => [
52-
'class' => AccessControl::class,
53-
'rules' => [
54-
[
55-
'allow' => true,
56-
'roles' => ['admin'],
57-
],
58-
],
59-
],
63+
'access' => $this->accessControlConfig,
6064
];
6165
}
6266

0 commit comments

Comments
 (0)