mirror of
https://github.com/janickiy/yii2-nomer
synced 2025-03-09 15:39:59 +00:00
29 lines
791 B
PHP
29 lines
791 B
PHP
<?php
|
|
|
|
namespace app\modules\admin\controllers;
|
|
|
|
use yii\filters\AccessControl;
|
|
use yii\web\Controller;
|
|
|
|
class AdminController extends Controller
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
'access' => [
|
|
'class' => AccessControl::className(),
|
|
'rules' => [
|
|
[
|
|
'allow' => true,
|
|
'roles' => ['@'],
|
|
'matchCallback' => function ($rule, $action) {
|
|
/* @var $identity \app\models\User */
|
|
$identity = \Yii::$app->getUser()->getIdentity();
|
|
return $identity->is_admin;
|
|
}
|
|
],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
}
|