Skip to content

Instantly share code, notes, and snippets.

@mkusher
Created July 16, 2014 17:30
Show Gist options
  • Save mkusher/7213f8f47346c5fbf718 to your computer and use it in GitHub Desktop.
Save mkusher/7213f8f47346c5fbf718 to your computer and use it in GitHub Desktop.
<?php
namespace app\backend;
use yii\filters\AccessControl;
use Yii;
class module extends \yii\base\Module
{
public $controllerNamespace = 'app\backend\controllers';
public $layout = 'main';
public function behaviors()
{
return [
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'allow' => true,
'actions' => ['login', 'forgot', 'change'],
'roles' => ['?'],
],
[
'allow' => false,
'actions' => ['login', 'forgot', 'change'],
'roles' => ['@'],
'denyCallback' => function($rule, $action){
Yii::$app->getResponse()->redirect(
Yii::$app->urlManager->createUrl('backend/default/index')
);
}
],
[
'allow' => true,
'roles' => ['@'],
],
[
'allow' => false
]
],
],
];
}
public function init()
{
parent::init();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment