From c110175236afacbd46915aa55b1be6088ee66775 Mon Sep 17 00:00:00 2001 From: stes Date: Mon, 7 Aug 2017 12:38:57 +0300 Subject: [PATCH] access control --- controllers/ArticleController.php | 17 +++++++++++++++++ controllers/CategoryController.php | 17 +++++++++++++++++ controllers/TagController.php | 17 +++++++++++++++++ 3 files changed, 51 insertions(+), 0 deletions(-) diff --git a/controllers/ArticleController.php b/controllers/ArticleController.php index 6e8e56e..832b421 100755 --- a/controllers/ArticleController.php +++ b/controllers/ArticleController.php @@ -12,6 +12,7 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\web\Response; + use yii\filters\AccessControl; /** * BlogArticleController implements the CRUD actions for BlogArticle model. @@ -38,6 +39,22 @@ 'delete' => [ 'POST' ], ], ], + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + [ + 'allow' => true, + 'roles' => [ '@' ], + ], + ], + ], ]; } diff --git a/controllers/CategoryController.php b/controllers/CategoryController.php index 0f4480a..2784769 100755 --- a/controllers/CategoryController.php +++ b/controllers/CategoryController.php @@ -10,6 +10,7 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\web\Response; + use yii\filters\AccessControl; /** * BlogCategoryController implements the CRUD actions for BlogCategory model. @@ -36,6 +37,22 @@ 'delete' => [ 'POST' ], ], ], + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + [ + 'allow' => true, + 'roles' => [ '@' ], + ], + ], + ], ]; } diff --git a/controllers/TagController.php b/controllers/TagController.php index f313d3a..60f3182 100755 --- a/controllers/TagController.php +++ b/controllers/TagController.php @@ -9,6 +9,7 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\web\Response; + use yii\filters\AccessControl; /** * BlogTagController implements the CRUD actions for BlogTag model. @@ -32,6 +33,22 @@ 'delete' => [ 'POST' ], ], ], + 'access' => [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + [ + 'allow' => true, + 'roles' => [ '@' ], + ], + ], + ], ]; } -- libgit2 0.21.4