/** * beforeFilter * * @return void */ public function beforeFilter() { parent::beforeFilter(); $this->Auth->deny('index'); // 設定画面を表示する前にこのルームの登録フォームブロックがあるか確認 // 万が一、まだ存在しない場合には作成しておく // afterFrameSaveが呼ばれないような状況の想定 // このタイミングで作るのはやめてみる by Ryuji AMANO //$frame['Frame'] = Current::read('Frame'); //$this->Registration->afterFrameSave($frame); }
/** * beforeFilter * * @return void */ public function beforeFilter() { // 登録通知メール //$this->MailSettings->permission = // array('mail_answer_receivable'); //$this->MailSettings->typeKeys = // array(MailSettingFixedPhrase::ANSWER_TYPE); // parent::beforeFilter(); // セッションインデックスパラメータ $sessionName = self::REGISTRATION_EDIT_SESSION_INDEX . $this->_getRegistrationEditSessionIndex(); if ($this->request->is('post') || $this->request->is('put')) { // ウィザード画面なのでセッションに記録された前画面データが必要 $this->_registration = $this->Session->read($sessionName); if (!$this->_registration) { // セッションタイムアウトの場合 return; } } else { // redirectで来るか、もしくは本当に直接のURL指定で来るかのどちらか // セッションに記録された値がある場合はそちらを優先 if ($this->Session->check($sessionName)) { $this->_registration = $this->Session->read($sessionName); } else { // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている // まずは、そのキーを取り出す // 登録フォームキー $registrationKey = $this->_getRegistrationKeyFromPass(); if ($registrationKey) { $conditions = [$this->Registration->alias . '.key' => $registrationKey]; } else { // 登録フォームキーが指定されてなければブロックIDから。編集時にブロックタブから遷移したとき $blockId = Current::read('Block.id'); $conditions = [$this->Registration->alias . '.block_id' => $blockId]; } // 登録フォームキーの指定がある場合は過去データ編集と判断 // 指定された登録フォームデータを取得 // NetCommonsお約束:履歴を持つタイプのコンテンツデータはgetWorkflowContentsで取り出す $this->_registration = $this->Registration->getWorkflowContents('first', array('recursive' => 0, 'conditions' => $conditions)); // NetCommonsお約束:編集の場合には改めて編集権限をチェックする必要がある // getWorkflowContentsはとりあえず自分が「見られる」コンテンツデータを取ってきてしまうので if (!$this->Registration->canEditWorkflowContent($this->_registration)) { $this->_registration = null; } } } if ($this->_registration === null || !Hash::check($this->_registration, 'Registration.id')) { // 登録フォーム新規作成時はブロック設定以外のタブは表示しない unset($this->helpers['Blocks.BlockTabs']['blockTabs']['role_permissions']); unset($this->helpers['Blocks.BlockTabs']['blockTabs']['mail_settings']); unset($this->helpers['Blocks.BlockTabs']['blockTabs']['answer_list']); } // ここへは設定画面の一覧から来たのか、一般画面の一覧から来たのか $this->_decideSettingLayout(); }
/** * beforeFilter * NetCommonsお約束:できることならControllerのbeforeFilterで実行可/不可の判定して流れを変える * * @return void */ public function beforeFilter() { // ゲストアクセスOKのアクションを設定 $this->Auth->allow('view', 'confirm', 'thanks', 'no_more_answer', 'key_auth', 'img_auth', 'empty_form'); // 親クラスのbeforeFilterを済ませる parent::beforeFilter(); // NetCommonsお約束:編集画面へのURLに編集対象のコンテンツキーが含まれている // まずは、そのキーを取り出す // 登録フォームキー //$registrationKey = $this->_getRegistrationKeyFromPass(); // キーで指定された登録フォームデータを取り出しておく $conditions = $this->Registration->getWorkflowConditions(array('Registration.block_id' => Current::read('Block.id'))); $this->__registration = $this->Registration->find('first', array('conditions' => $conditions, 'recursive' => 1)); if (!$this->__registration) { // 権限が無くて表示できないブロックがページに配置されることもあるので、emptyRenderにする。 if ($this->action === 'view') { $this->setAction('empty_form'); return; } //$this->setAction('throwBadRequest'); // returnをつけるとテストコードが通らない } // 現在の表示形態を調べておく //list($this->__displayType) = $this->RegistrationFrameSetting->getRegistrationFrameSetting( // Current::read('Frame.key') //); // 以下のisAbleto..の内部関数にてNetCommonsお約束である編集権限、参照権限チェックを済ませています // 閲覧可能か if (!$this->isAbleTo($this->__registration)) { // 不可能な時は「登録できません」画面を出すだけ $this->setAction('no_more_answer'); return; } if (in_array($this->action, $this->__ableToAnswerAction)) { // 登録可能か if (!$this->isAbleToAnswer($this->__registration)) { // 登録が不可能な時は「登録できません」画面を出すだけ $this->setAction('no_more_answer'); return; } } }
/** * beforeFilter * * @return void */ public function beforeFilter() { parent::beforeFilter(); // ここへは設定画面の一覧から来たのか、一般画面の一覧から来たのか $this->_decideSettingLayout(); }
/** * beforeFilter * * @return void */ public function beforeFilter() { parent::beforeFilter(); }