Commit c110175236afacbd46915aa55b1be6088ee66775

Authored by Anastasia
1 parent 6c741c3c

access control

controllers/ArticleController.php
... ... @@ -12,6 +12,7 @@
12 12 use yii\web\NotFoundHttpException;
13 13 use yii\filters\VerbFilter;
14 14 use yii\web\Response;
  15 + use yii\filters\AccessControl;
15 16  
16 17 /**
17 18 * BlogArticleController implements the CRUD actions for BlogArticle model.
... ... @@ -38,6 +39,22 @@
38 39 'delete' => [ 'POST' ],
39 40 ],
40 41 ],
  42 + 'access' => [
  43 + 'class' => AccessControl::className(),
  44 + 'rules' => [
  45 + [
  46 + 'actions' => [
  47 + 'login',
  48 + 'error',
  49 + ],
  50 + 'allow' => true,
  51 + ],
  52 + [
  53 + 'allow' => true,
  54 + 'roles' => [ '@' ],
  55 + ],
  56 + ],
  57 + ],
41 58 ];
42 59 }
43 60  
... ...
controllers/CategoryController.php
... ... @@ -10,6 +10,7 @@
10 10 use yii\web\NotFoundHttpException;
11 11 use yii\filters\VerbFilter;
12 12 use yii\web\Response;
  13 + use yii\filters\AccessControl;
13 14  
14 15 /**
15 16 * BlogCategoryController implements the CRUD actions for BlogCategory model.
... ... @@ -36,6 +37,22 @@
36 37 'delete' => [ 'POST' ],
37 38 ],
38 39 ],
  40 + 'access' => [
  41 + 'class' => AccessControl::className(),
  42 + 'rules' => [
  43 + [
  44 + 'actions' => [
  45 + 'login',
  46 + 'error',
  47 + ],
  48 + 'allow' => true,
  49 + ],
  50 + [
  51 + 'allow' => true,
  52 + 'roles' => [ '@' ],
  53 + ],
  54 + ],
  55 + ],
39 56 ];
40 57 }
41 58  
... ...
controllers/TagController.php
... ... @@ -9,6 +9,7 @@
9 9 use yii\web\NotFoundHttpException;
10 10 use yii\filters\VerbFilter;
11 11 use yii\web\Response;
  12 + use yii\filters\AccessControl;
12 13  
13 14 /**
14 15 * BlogTagController implements the CRUD actions for BlogTag model.
... ... @@ -32,6 +33,22 @@
32 33 'delete' => [ 'POST' ],
33 34 ],
34 35 ],
  36 + 'access' => [
  37 + 'class' => AccessControl::className(),
  38 + 'rules' => [
  39 + [
  40 + 'actions' => [
  41 + 'login',
  42 + 'error',
  43 + ],
  44 + 'allow' => true,
  45 + ],
  46 + [
  47 + 'allow' => true,
  48 + 'roles' => [ '@' ],
  49 + ],
  50 + ],
  51 + ],
35 52 ];
36 53 }
37 54  
... ...