Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions plugins/baser-core/src/Model/Table/PermissionGroupsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public function validationDefault(Validator $validator): Validator
->maxLength('name', 60, __d('baser_core', 'ルールグループ名は60文字以内で入力してください。'))
->notEmptyString('name', __d('baser_core', 'ルールグループ名を入力してください。'));

$validator
->requirePresence('permissions', 'update', __d('baser_core', 'ルールが設定されていません。'))
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirePresence の第2引数が 'update' になっていますが、これでは新規作成時('create')にバリデーションが実行されません。必須項目であれば 'create' または true に変更する必要があります。現在の実装では、新規作成時にルールが未設定でも保存できてしまう可能性があります。

Suggested change
->requirePresence('permissions', 'update', __d('baser_core', 'ルールが設定されていません。'))
->requirePresence('permissions', true, __d('baser_core', 'ルールが設定されていません。'))

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

@CUhamachi CUhamachi Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新規作成時はルールの欄が無い為、updateにしています。

【新規作成時の画面】
スクリーンショット 2025-11-14 16 49 38

->notEmptyArray('permissions', __d('baser_core', 'ルールが設定されていません。'));

return $validator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@
'data-bca-btn-type' => 'add',
'data-bca-btn-size' => 'sm',
]) ?>

<?php echo $this->BcAdminForm->error('permissions') ?>
</td>
</tr>
<?php endif ?>
Expand Down
Loading