login - Access control of a Module in Yii2 -
i having trouble login part. read topic : http://www.yiiframework.com/wiki/771/rbac-super-simple-with-admin-and-user/ . follow steps, in step 6. configs 1 controller. have module called admin many controllers in , don't know how apply access control whole module. can me ? sorry bad english.
you can create admincontroller class, extends yii\web\controller define access rules in behaviors method , make other module controllers extend admincontroller , override behaviors method this:
public function behaviors() { return \yii\helpers\arrayhelper::merge(parent::behaviors(), [ 'verbs' => [ 'class' => verbfilter::classname(), 'actions' => [ 'delete' => ['post'], ], ], ]); } here parent::behaviors() behaviors admincontroller define default access rules, , merge them specific behaviors in child controller. gives flexibility override access rules if need.
Comments
Post a Comment