Created
April 13, 2014 12:46
-
-
Save ruliarmando/10582633 to your computer and use it in GitHub Desktop.
AdminModule
This file contains hidden or 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 | |
| class AdminModule extends CWebModule | |
| { | |
| public function init() | |
| { | |
| // this method is called when the module is being created | |
| // you may place code here to customize the module or the application | |
| // import the module-level models and components | |
| $this->setImport(array( | |
| 'admin.models.*', | |
| 'admin.components.*', | |
| )); | |
| Yii::app()->theme = 'shadow_dancer'; | |
| } | |
| public function beforeControllerAction($controller, $action) | |
| { | |
| if(parent::beforeControllerAction($controller, $action)) | |
| { | |
| if(!Yii::app()->authManager->checkAccess('Admin', Yii::app()->user->id)){ | |
| Yii::app()->theme = 'yourblog'; | |
| throw new CHttpException(403,Yii::t('yii','You are not authorized to perform this action.')); | |
| }else{ | |
| return true; | |
| } | |
| } | |
| else | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment