php - Close backend with AccessControl -
i can trying simple code.
i have accesscontroller having behaviors():
class accesscontroller extends backendcontroller { public function behaviors() { return [ 'access' => [ 'class' => accesscontrol::classname(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ] ], ]; } /*public function init() { parent::init(); if( yii::$app->getuser()->getisguest() ) { return $this->redirect('/auth'); } return true; }*/ public function actions() { return [ 'wysiwygupload' => [ 'class' => wysiwygupload::classname(), ] ]; } }
as understand, if didn't declare 'only' key, mean to all actions , controllers.
but nothing happen: no 1 error, nothing
your controller accesscontroller work yourapp/backend/access request not controlleraction..
if want deny access guest in admincontroller shuold apply behavior of admincontroller
class admincontroller extends controller { public function behaviors() { return [ 'access' => [ 'class' => accesscontrol::classname(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ] ], ]; } ........
then when guest try accessing yourapp/backend/admin not permitted
Comments
Post a Comment