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

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

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