0
私は自分のappControllerを拡張している私のUsersControllerを持っています。私は$コンポーネントは以下のような定義されている私のapp_controllerで
:
$components = array('Acl', 'Auth', 'Session', 'RequestHandler');
私は私のユーザーインデックスビューにアクセスしようとすると、私は(エラーを取得するAuthコンポーネントがで活性化されていないことを意味コントローラ)。
しかし
私は私がUserControllerにこの行が直接配置する場合:
$components = array('Acl', 'Auth', 'Session', 'RequestHandler');
期待通りにページが動作します。
リモートサーバーに後者の問題があります。しかし、私のローカルの開発環境は、app_controllerの$ componentsをうまく拡張しているようです。
これはなぜ起こっているのですか?ここで
は私のapp_controllerのソースコードです:
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Session', 'Ajax', 'Javascript');
var $components = array('Auth', 'Acl', 'Session', 'RequestHandler');
function beforeFilter() {
//Configure AuthComponent
$this->Auth->authorize = 'actions';
$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'cms');
$this->Auth->logoutRedirect = array(Configure::read('Routing.admin') => false, 'controller' => 'users', 'action' => 'logout');
$this->Auth->actionPath = 'controllers/';
$this->Auth->allow('display'); // Allows all action => pages for non logged in users.
}
}
あなたのapp_controllerコードを貼り付けることはできますか? cakeはデフォルトで値をマージするので、コントローラの1つで__constructで面白いことをやっているかもしれません。 – dogmatic69
上記の私のapp_controllerコードを追加しました:) – OldWest
あなたのUsersコントローラで 'beforeFilter'も使いますか?もしそうなら、そのコールバックの中から 'parent :: beforeFilter()'を呼び出しますか? – harpax