我正在尝试在我的应用程序上启动并运行 aco's / aro。cakePHP 教程说当我添加用户时,它应该自动添加到 aros 表中,但它不起作用。
用户模型
class User extends AppModel {
var $name = 'User';
public $belongsTo = array('Group');
public $actsAs = array('Acl' => array('type' => 'requester'));
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allowedActions = array('*');
}
public function parentNode() {
if (!$this->id && empty($this->data)) {
return null;
}
if (isset($this->data['User']['group_id'])) {
$groupId = $this->data['User']['group_id'];
} else {
$groupId = $this->field('group_id');
}
if (!$groupId) {
return null;
} else {
return array('Group' => array('id' => $groupId));
}
}
public function afterSave() {
$this->Aro->create();
$this->Aro->save(array('alias'=>$this->field('username')));
}
}
不应该线
public $actsAs = array('Acl' => array('type' => 'requester'));
执行 cakePHP 魔术并自动创建 ARO?