douweibiao8471 2016-09-20 13:09
浏览 12
已采纳

Cakedc.users =>始终重定向到主页

I'm using the plugins "CakeDC/Users" on a brain new Cakephp installation. I've got two controllers : PagesController.php, CardsController.php. Pages has 1 action (Beta, it's the homepage), and Cards two actions (index, and single).

Here is the setup in the bootstrap :

Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);

And the configuration of the plugin in config/users.php :

return [
'Users' => [
    'Email' => [
        'validate' => false
    ]
],
'Auth' => [
    'loginAction' => [
        'plugin' => null,
        'controller' => 'Members',
        'action' => 'login',
        'prefix' => null
    ],
    'logoutAction' => [
        'plugin' => null,
        'controller' => 'Members',
        'action' => 'logout',
        'prefix' => null
    ],
    'authenticate' => [
        'all' => [
            'finder' => 'auth',
        ],
        'CakeDC/Users.ApiKey',
        'CakeDC/Users.RememberMe',
        'Form',
    ],
    'authorize' => [
        //'CakeDC/Users.Superuser',
        //'CakeDC/Users.SimpleRbac',
    ],
],

];

I've only have one route configured :

$routes->connect('/', ['controller' => 'Pages', 'action' => 'Beta', 'home']);

And here is my AppController.php :

    public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('CakeDC/Users.UsersAuth');
    }

The homepage is Allowed :

$this->Auth->allow('beta');

When not logged in, I can only access /pages/beta, which is ok. I can register, login, and logout with the plugin, no problem on this side.

Once I'm logged, I can't access any other pages than the homepage. If I got to /cards/index, or /cards/single, I'm always redirect to the homepage. If I disabled the plugin, pages access is ok.

I'm stuck on this since a while now, any help ? Thanks, Best Regards

  • 写回答

1条回答 默认 最新

  • douzhaocheng4533 2016-09-20 13:13
    关注

    Nevermind, I've replaced :

    'authorize' => [
           //'CakeDC/Users.Superuser',
           //'CakeDC/Users.SimpleRbac',
    ],
    

    By :

    'authorize' => false,
    

    The plugin used authorize with a component by default, so if you're not going to use it, you have the set "false" to be sure you don't have issues. Or you have to setup the authorized controllers and actions by setting up the good setup.

    Thanks,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 qgcomp混合物线性模型分析的代码出现错误:Model aliasing occurred
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'