マルチステップのtravelrequestアプリがあります。ユーザーは、最後のステップlocalhost / intraweb / travel_requests / step / 5に到達するまで、最初のステップ(localhost / intraweb / travel_requests / step / 1など)に移動します。私が今抱えている問題は、管理者だけが手順にアクセスでき、通常のユーザーはアクセスできないことです。私の場合、ユーザーは私のグループテーブルにID=10を持っています
これは、UsersControllerでACLを使用する方法です。
//allow users to do a travel request
public function initDB() {
$group = $this->User->Group;
$group->id = 10;
$this->Acl->allow($group, 'controllers/TravelRequests/step($stepNumber');
}
これが私のTravelRequestsControllerのコードです
public function beforeRender() {
parent::beforeRender();
$params = $this->Session->read('form.params');
$this->Auth->allow('step($stepNumber)');
$this->set('params', $params);
}
public function setup() {
$steps = 5;
$this->Session->write('form.params.steps', $steps);
$this->Session->write('form.params.maxProgress', 0);
$this->redirect(array('action' => 'step', 1));
}
public function step($stepNumber) {
if($this->Session->read('form.params.steps') != 5) {
$this->redirect(array('action'=>'index'));
}
if (!file_exists(APP.'View'.DS.'TravelRequests'.DS.'step_'.$stepNumber.'.ctp')) {
$this->redirect('/travel_requests/index');
}
$maxAllowed = $this->Session->read('form.params.maxProgress') + 1;
if ($stepNumber > $maxAllowed) {
$this->redirect('/travel_requests/step/'.$maxAllowed);
} else {
$this->Session->write('form.params.currentStep', $stepNumber);
}
}
私が自分のコードで何を見逃しているのかについての考えを持っている人はいますか?
前もって感謝します