Created
July 16, 2014 17:30
-
-
Save mkusher/7213f8f47346c5fbf718 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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