Skip to content

Instantly share code, notes, and snippets.

@marcuzy
Created February 29, 2016 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcuzy/279954778af65a87b56b to your computer and use it in GitHub Desktop.
Save marcuzy/279954778af65a87b56b to your computer and use it in GitHub Desktop.
Оторбражение дебагера Yii2 только для юзера с ролью админ
<?php
//из config.php
if (YII_DEBUG) {
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
'allowedIPs' => ['127.0.0.1', '::1', '192.168.33.1', '*'],
'on beforeAction'=>function($event) {
//суть
$event->isValid = nil(Yii::$app->user->getIdentity())->hasRole(\common\models\User::ROLE_ADMINISTRATOR);
},
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment