Add BackendController/AccesControl
Add the BackendController for all the backend controllers. Add AccesControl
This commit is contained in:
40
backend/controllers/BackendController.php
Normal file
40
backend/controllers/BackendController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\City;
|
||||
use backend\models\CitySearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use yii\db\Query;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* CityController implements the CRUD actions for City model.
|
||||
*/
|
||||
class BackendController extends Controller
|
||||
{
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => ['create','index','view','update'],
|
||||
'allow' => true,
|
||||
'roles' => ['@'],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user