Allowing a Specific Page in Cakephp

后端 未结 2 759
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 23:09

I understand how to allow certain controller actions for non-logged in users. But, I can\'t find any documentation on how to allow access to specific pages. The controller

2条回答
  •  执念已碎
    2020-12-21 00:09

    In CakePHP 3.x you can accomplish your goal by specifying the full action in the PagesController beforeFilter action:

    public function beforeFilter(Event $event) {
      parent::beforeFilter($event);
    
      $this->Auth->allow(
        ['controller' => 'pages', 'action' => 'display', 'about']
      );
    }
    

提交回复
热议问题