Yii RBAC Tutorials

Role Based Access Control For Module

I added the source code for RBAC Module validation. We can check the access role in module level, controller level and action level.add this in config/main.php 'authManager'=>array( 'class'=>'CDbAuthManager', 'itemTable'=>'authitem', 'assignmentTable'=>'authassignment', 'itemChildTable'=>'authitemchild', 'connectionID'=>'db',   ), AdminModule 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 […]... Read More »

Role Based Access Control For Action

I added the source code for RBAC action to validate the permission. We can check the access role in module level, controller level and action leveladd this in config/main.php <?php 'authManager'=>array( 'class'=>'CDbAuthManager', 'itemTable'=>'authitem', 'assignmentTable'=>'authassignment', 'itemChildTable'=>'authitemchild', 'connectionID'=>'db', ), ?>In controller page class YiicontrolController extends Controller { protected function beforeAction($action) { if(Yii::app()->user->checkAccess($this->getAction()->getId().'Post')) { return true; }else { Yii::app()->request->redirect(Yii::app()->user->returnUrl); } } } ?>... Read More »