From 8ebdf3ca7bf82bab617b8ed8d88793647a9355af Mon Sep 17 00:00:00 2001 From: otsuka Date: Thu, 23 Jul 2026 16:55:06 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E7=99=BB=E9=8C=B2=E6=99=82=E3=81=AB=E3=82=B0=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E3=82=92=E9=81=B8=E6=8A=9E=E3=81=9B=E3=81=9A=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AE=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=82=92=E3=80=8C=20=E3=83=87=E3=83=BC=E3=82=BF=E3=83=99?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E5=87=A6=E7=90=86=E4=B8=AD=E3=81=AB=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC?= =?UTF-8?q?=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E3=82=92=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=8F=E3=81=A0=E3=81=95=E3=81=84=E3=80=82?= =?UTF-8?q?=E3=80=8D=E3=81=8B=E3=82=89=E3=80=8C=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E3=82=92=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E3=81=97=E3=81=A6=E3=81=8F=E3=81=A0=E3=81=95=E3=81=84?= =?UTF-8?q?=E3=80=82=E3=80=8D=E3=81=AB=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/baser-core/src/Controller/Admin/UsersController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/baser-core/src/Controller/Admin/UsersController.php b/plugins/baser-core/src/Controller/Admin/UsersController.php index 8acdb66612..3d0fbef2bf 100644 --- a/plugins/baser-core/src/Controller/Admin/UsersController.php +++ b/plugins/baser-core/src/Controller/Admin/UsersController.php @@ -24,6 +24,7 @@ use Cake\Http\Exception\NotFoundException; use Cake\Http\Response; use Cake\ORM\Exception\PersistenceFailedException; +use BaserCore\Error\BcException; use Cake\Routing\Router; use BaserCore\Annotation\NoTodo; use BaserCore\Annotation\Checked; @@ -328,6 +329,8 @@ public function add(UsersAdminServiceInterface $service) } catch (\Cake\ORM\Exception\PersistenceFailedException $e) { $user = $e->getEntity(); $this->BcMessage->setError(__d('baser_core', '入力エラーです。内容を修正してください。')); + } catch (BcException $e) { + $this->BcMessage->setError($e->getMessage()); } catch (\Throwable $e) { $this->BcMessage->setError(__d('baser_core', 'データベース処理中にエラーが発生しました。') . $e->getMessage()); } @@ -377,6 +380,8 @@ public function edit(UsersAdminServiceInterface $service, $id = null) } catch (PersistenceFailedException $e) { $user = $e->getEntity(); $this->BcMessage->setError(__d('baser_core', '入力エラーです。内容を修正してください。')); + } catch (BcException $e) { + $this->BcMessage->setError($e->getMessage()); } catch (\Throwable $e) { $this->BcMessage->setError(__d('baser_core', 'データベース処理中にエラーが発生しました。') . $e->getMessage()); } From 0c0e8fde0de6727d561d49478591a7460df5abdc Mon Sep 17 00:00:00 2001 From: otsuka Date: Tue, 28 Jul 2026 12:30:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?UsersService=E3=81=AEBcException=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4=E2=86=92PersistenceFailedException=20?= =?UTF-8?q?=E3=82=92=E6=8A=95=E3=81=92=E3=82=8B=E4=BB=95=E6=A7=98=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/baser-core/src/Controller/Admin/UsersController.php | 5 ----- plugins/baser-core/src/Service/UsersService.php | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/plugins/baser-core/src/Controller/Admin/UsersController.php b/plugins/baser-core/src/Controller/Admin/UsersController.php index 3d0fbef2bf..8acdb66612 100644 --- a/plugins/baser-core/src/Controller/Admin/UsersController.php +++ b/plugins/baser-core/src/Controller/Admin/UsersController.php @@ -24,7 +24,6 @@ use Cake\Http\Exception\NotFoundException; use Cake\Http\Response; use Cake\ORM\Exception\PersistenceFailedException; -use BaserCore\Error\BcException; use Cake\Routing\Router; use BaserCore\Annotation\NoTodo; use BaserCore\Annotation\Checked; @@ -329,8 +328,6 @@ public function add(UsersAdminServiceInterface $service) } catch (\Cake\ORM\Exception\PersistenceFailedException $e) { $user = $e->getEntity(); $this->BcMessage->setError(__d('baser_core', '入力エラーです。内容を修正してください。')); - } catch (BcException $e) { - $this->BcMessage->setError($e->getMessage()); } catch (\Throwable $e) { $this->BcMessage->setError(__d('baser_core', 'データベース処理中にエラーが発生しました。') . $e->getMessage()); } @@ -380,8 +377,6 @@ public function edit(UsersAdminServiceInterface $service, $id = null) } catch (PersistenceFailedException $e) { $user = $e->getEntity(); $this->BcMessage->setError(__d('baser_core', '入力エラーです。内容を修正してください。')); - } catch (BcException $e) { - $this->BcMessage->setError($e->getMessage()); } catch (\Throwable $e) { $this->BcMessage->setError(__d('baser_core', 'データベース処理中にエラーが発生しました。') . $e->getMessage()); } diff --git a/plugins/baser-core/src/Service/UsersService.php b/plugins/baser-core/src/Service/UsersService.php index 12a6acf3cc..3d57f7d431 100644 --- a/plugins/baser-core/src/Service/UsersService.php +++ b/plugins/baser-core/src/Service/UsersService.php @@ -192,10 +192,7 @@ private function createIndexConditions(Query $query, array $params): Query public function create(array $postData): ?EntityInterface { $loginUser = BcUtil::loginUser(); - if(empty($postData['user_groups']['_ids'])) { - throw new BcException(__d('baser_core', 'ユーザーグループを指定してください。')); - } - if(in_array(Configure::read('BcApp.adminGroupId'), $postData['user_groups']['_ids'])) { + if(!empty($postData['user_groups']['_ids']) && in_array(Configure::read('BcApp.adminGroupId'), $postData['user_groups']['_ids'])) { if(BcUtil::isInstalled() && !$loginUser->isAddableToAdminGroup()) { throw new BcException(__d('baser_core', '特権エラーが発生しました。')); }