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

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -