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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -