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

Process 'command 'F:\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1 -

apache - setting document root in antoher partition on ubuntu -

java - Updating to mongo 3.0 -