# これめっちゃ間違ってるので訂正!
# s/$this->Security = false/$this->Security->enabled = false/g

SecurityComponentのAPI見ても全然書いてないけど。
あるコントローラとかアクションのみ、SecurityComponentを無効にしたい。
Controllerにて$this->Security->enabled = falseすればOK。

例えば、ExampleControllerのtestアクションのみ無効化したいとすると、

<?php
class ExampleController extends AppController {
  public $components = array('Security');
  public function beforeFilter() {
    parent::beforeFilter();
    if($this->params['action'] == 'test') {
      $this->Security->enabled = false;
    }
  } 

  public function test() {
    // のっぴきならない事情でSecurityComponentが使えない処理
  }
}

フォームで入力する値が動的に変わっちゃう上に項目数の多い画面だとdisableFieldsだけでえらいことになってしまうので。
もっと良い方法ありそうだけど力尽きた。
知ってる方いらっしゃったら教えて下さい。

© 2011 sanojimaru.com Suffusion theme by Sayontan Sinha