更改消息“您无权访问该位置。” 在cakedc 3.x的cakedc /用户插件中

Jos*_*ejo 0 authentication cakephp cakedc cakephp-3.0

我正在尝试更改消息

您无权访问该位置。

与cakedc 3.1的cakedc / users插件一起使用,但我找不到方法。

这是我在src / Controller / AppController中的配置:

public function initialize()
    {
        parent::initialize();
        $this->loadComponent('Flash');
        $this->loadComponent('CakeDC/Users.UsersAuth', [
         'authError' => 'Did you really think you are allowed to see that?',
      ]
     );
    }
Run Code Online (Sandbox Code Playgroud)

但是消息仍然是:

您无权访问该位置。

我在做什么错?

谢谢。

ndm*_*ndm 5

我在做什么错?

您没有按预期配置插件。如文档中所述:

[...]

该插件是通过Configure类配置的。检查以vendor/cakedc/users/config/users.php获取所有配置键的完整列表。

https://github.com/CakeDC/users/blob/3.1.1/Docs/Documentation/Configuration.md

要配置身份验证组件选项,请使用Auth密钥,该密钥位于链接文档中所述的配置文件中

$config = [
    // ...

    'Auth' => [
        'authError' => 'Did you really think you are allowed to see that?',
        // ...
    ],

    // ...
];
Run Code Online (Sandbox Code Playgroud)

或通过 Configure::write()

Configure::write('Auth.authError', 'Did you really think you are allowed to see that?');
Run Code Online (Sandbox Code Playgroud)