php - Yii2 restrict access by usernames -


i use yii2 login-logout , has funky database no roles. possible restrict users on database accessing website?

can show me how?

one of easy way, can use expression allow key following in controller class.

public function behaviors() {         return [             'access' => [                 'class' => accesscontrol::classname(), //                'only' => ['logout', 'signup', 'dashboard'],                 'rules' => [                     [                         'actions' => ['dashboard', 'send-mail'],                         'allow' => utils::isadmin(),                     ],                 ]         ]; } 

learn more in article: https://github.com/yiisoft/yii2/blob/master/docs/guide/security-authorization.md


Comments

Popular posts from this blog

apache - setting document root in antoher partition on ubuntu -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

r - Quantstrat logical error while running applySignals - missing value where TRUE/FALSE needed -