Skip to content

Commit 3d1526a

Browse files
author
igor-chepurnoi
committed
add "accessControlConfig" property to ManageController
1 parent d07d331 commit 3d1526a

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\cms\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;
@@ -42,6 +41,19 @@ class ManageController extends Controller
4241
*/
4342
public $modelClass = 'yii2mod\cms\models\CmsModel';
4443

44+
/**
45+
* @var array access control config
46+
*/
47+
public $accessControlConfig = [
48+
'class' => 'yii\filters\AccessControl',
49+
'rules' => [
50+
[
51+
'allow' => true,
52+
'roles' => ['admin'],
53+
],
54+
],
55+
];
56+
4557
/**
4658
* @inheritdoc
4759
*/
@@ -57,15 +69,7 @@ public function behaviors()
5769
'delete' => ['post'],
5870
],
5971
],
60-
'access' => [
61-
'class' => AccessControl::class,
62-
'rules' => [
63-
[
64-
'allow' => true,
65-
'roles' => ['admin'],
66-
],
67-
],
68-
],
72+
'access' => $this->accessControlConfig,
6973
];
7074
}
7175

0 commit comments

Comments
 (0)