Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Controller/CircularNoticesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ public function add() {
* edit action
*
* @return void
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function edit() {
$userId = Current::read('User.id');
Expand All @@ -359,6 +360,12 @@ public function edit() {
return $this->throwBadRequest();
}

// フレームから取得したCircularNoticeSetting.keyとコンテンツのcircular_notice_setting_keyが一致しない場合はBadRequest
$settingKey = $this->viewVars['circularNoticeSetting']['CircularNoticeSetting']['key'] ?? null;
if ($content['CircularNoticeContent']['circular_notice_setting_key'] !== $settingKey) {
return $this->throwBadRequest();
}

if ($this->CircularNoticeContent->canEditWorkflowContent($content) === false) {
return $this->throwBadRequest();
}
Expand Down
4 changes: 3 additions & 1 deletion Test/Case/Controller/CircularNoticesController/EditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function dataProviderEdit() {
$results[0] = array(
'urlOptions' => Hash::insert($data, 'frame_id', ''),
'assert' => null,
'exception' => 'BadRequestException'
);
$results[1] = array(
'urlOptions' => Hash::insert($data, 'key', 'A'),
Expand All @@ -105,7 +106,8 @@ public function dataProviderEdit() {
);
$results[3] = array(
'urlOptions' => Hash::insert($data, 'key', 'circular_notice_content_4'),
'assert' => array('method' => 'assertNotEmpty'),
'assert' => null,
'exception' => 'BadRequestException'
);

return $results;
Expand Down