public function behaviors() { return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'matchCallback' => function ($rule, $action) { $fullPermission = getFullAction(); if (Yii::$app->user->id == 1) { return true; } if (Yii::$app->user->can($fullPermission)) { return true; } else { return false; } }]]]]; }
use backend\assets\AppAsset; use backend\assets\AceAsset; use yii\helpers\Html; use yii\helpers\Url; use yii\widgets\Breadcrumbs; use sys\models\Menu; /* @var $this \yii\web\View */ /* @var $content string */ $menu = Menu::getList(); // $app = Yii::$app->id; // $m = Yii::$app->controller->module->id; // $c = Yii::$app->controller->id; // $a = Yii::$app->controller->action->id; // $current_menu = $app == $m ? 'backend_'.$c . $a : 'backend@' . $m .'_'. $c .'_'. $a; $current_menu = getFullAction(); AppAsset::register($this); AceAsset::register($this); $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <?php echo Html::csrfMetaTags(); ?>