php - "accessRules()" in YII -


i use yii framework , limiting access pages accessrules , filter. there information of how limit access without db or how getting access variable, how can getting role database , access filters in controller.

public function filters() {     return array(         'accesscontrol', // perform access control crud operations         'postonly + delete', // allow deletion via post request     ); }   public function accessrules() {     return array(         array('allow', // allow authenticated user perform 'create' , 'update' actions             'actions'=>array('create','update', 'view', 'index'),             'users'=>array('@'),         ),         array('allow', // allow admin user perform 'admin' , 'delete' actions             'actions'=>array('admin','delete', 'view', 'index'),             'users'=>array('admin'),         ),         array('deny',  // deny users             'users'=>array('*'),         ),     ); } 

have set role based hierachy? if not check yii docu: http://www.yiiframework.com/doc/guide/1.1/en/topics.auth if so, simple that:

public function accessrules() {     return array(         array('allow', // allow authenticated user perform 'create' , 'update' actions             'actions'=>array('create','update', 'view', 'index'),             'roles'=>array('role1'),         ),         array('allow', // allow admin user perform 'admin' , 'delete' actions             'actions'=>array('admin','delete', 'view', 'index'),             'roles'=>array('role2'),         ),         array('deny',  // deny users             'users'=>array('*'),         ),     ); } 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -