2

我的 Auth 使用的是默认模型Player而不是默认User模型。我最近为我的应用程序配置了 ACL,并尝试return false在我的isAuthorized($player)函数中进行测试时,出现以下错误:

AclNode::node() - Couldn't find Aro node identified by
Array ( [Aro0.model] => User [Aro0.foreign_key] => 1 )

Aro0.model应该是Player吗?我找不到要换的地方Auth->authorizeAuth-authenticate在我设法登录时工作正常,因为有一个userModel选项允许我为用户登录指定自定义模型。

这是我的 AppController

class AppController extends Controller
{
    public $components = array(
        'Session',
        'Acl',
        'RequestHandler',
        'Auth' => array(

            'authorize' => array(
                'controller',
                'Actions' => array('actionPath' => 'controllers'),
            ),

            'authenticate' => array(
                'Form' => array(
                    'userModel' => 'Player',
                    'fields' => array('username' => 'email', 'password' => 'password'),
                    )
                )
            ),
        );
    public $helpers = array('Html', 'Form', 'Session');

    function isAuthorized($player)
    {
        //var_dump($player); die;
        return false;
        return $this->Auth->loggedIn();
    }

}
4

1 回答 1

2

解决了。它是与userModel一起追加的actionPath

$this->Auth->authorize = array(
    AuthComponent::ALL => array('actionPath' => 'controllers/', 'userModel' => 'Player'),
    'Actions',
    'Controller'
);
于 2012-10-19T06:51:54.340 回答