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' => [