From 7136956576ca86743622104f9acd9104f0ba0c21 Mon Sep 17 00:00:00 2001 From: Jitendra Joshi Date: Mon, 19 Dec 2016 13:03:30 +0530 Subject: [PATCH] Add default access control for controller methods --- generators/crud/default/controller.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/generators/crud/default/controller.php b/generators/crud/default/controller.php index 89f1eed73..d3506e0fd 100644 --- a/generators/crud/default/controller.php +++ b/generators/crud/default/controller.php @@ -39,6 +39,7 @@ use baseControllerClass, '\\') ?>; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; +use yii\filters\AccessControl; /** * implements the CRUD actions for model. @@ -51,6 +52,17 @@ class extends bas public function behaviors() { return [ + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'allow' => true, + 'actions' => ['index', 'view', 'create', 'update', 'delete'], + 'roles' => ['@'], + ], + + ], + ], 'verbs' => [ 'class' => VerbFilter::className(), 'actions' => [