diff --git a/resources/lang/en/exment.php b/resources/lang/en/exment.php index 3b959a6c3..84d1386cc 100644 --- a/resources/lang/en/exment.php +++ b/resources/lang/en/exment.php @@ -1196,6 +1196,7 @@ 'all_user_viewable_flg' => 'All Users Can View', 'all_user_accessable_flg' => 'All Users Can Access', 'inherit_parent_permission' => 'Viewable with Permissions of Parent data', + 'editable_with_parent' => 'Need Edit Permission for Parend data', 'add_parent_menu_flg' => 'Add Menu', 'add_notify_flg' => 'Add To Notification', 'add_parent_menu' => 'Target Parent Menu', @@ -1278,6 +1279,7 @@ 'all_user_viewable_flg' => 'If set to YES, all users will be able to view all the data in this table.', 'all_user_accessable_flg' => 'If set to YES, all users will be able to see all the data in this table.
*It is not displayed on the menu or list page, it can be displayed only with internal data or reference from another table.', 'inherit_parent_permission' => 'If set to YES, the data can be viewed based on the the parent data(1:N) permissions. However, you must have viewing or similar permissions for this table itself.', + 'editable_with_parent' => 'If set to YES, you need edit permissions for the parent data(1:N) to edit the data in this table.', 'add_parent_menu_flg' => 'After creating custom table, you can add it to the menu. To add it, please set it to YES. *It will be displayed after updating the browser.
*It can be set only when new table is created. When updating please set it from "Menu" page.', 'add_parent_menu' => 'Please select the menu name to be parent.', 'add_notify_flg' => 'You can add settings for performing in-system notification to authorized users when creating/updating/sharing/commenting data, after creating a new table. Please add YES if you want to add.
* It can be set only when creating a new table. Please set from the "notification" page when updating.', diff --git a/resources/lang/ja/exment.php b/resources/lang/ja/exment.php index 713a41358..d8998a146 100644 --- a/resources/lang/ja/exment.php +++ b/resources/lang/ja/exment.php @@ -1197,6 +1197,7 @@ 'all_user_viewable_flg' => '全ユーザーが閲覧可能', 'all_user_accessable_flg' => '全ユーザーが参照可能', 'inherit_parent_permission' => '親データの権限で閲覧可能', + 'editable_with_parent' => '親データの編集権限が必要', 'add_parent_menu_flg' => 'メニューに追加する', 'add_notify_flg' => '通知に追加する', 'add_parent_menu' => '追加先の親メニュー', @@ -1279,6 +1280,7 @@ 'all_user_viewable_flg' => 'YESにした場合、すべてのユーザーが、このテーブルのすべてのデータを閲覧可能になります。', 'all_user_accessable_flg' => 'YESにした場合、すべてのユーザーが、このテーブルのすべてのデータを参照可能になります。
※メニューや一覧画面では表示されず、内部データや、他のテーブルからの参照でのみ表示できます。', 'inherit_parent_permission' => 'YESにした場合、親データ(1対多)の権限でデータを閲覧できます。ただし、このテーブル自体に担当者の閲覧等の権限を持っている必要があります。', + 'editable_with_parent' => 'YESにした場合、このテーブルのデータを編集するには親データ(1対多)の編集権限が必要になります。', 'add_parent_menu_flg' => '新規作成後、メニューに追加することができます。追加する場合はYESにしてください。
※ブラウザ更新後に表示されます。
※テーブルの新規作成時のみ設定できます。更新時は「メニュー」画面より設定してください。', 'add_parent_menu' => '親にするメニュー名を選択してください。', 'add_notify_flg' => 'データの新規作成・更新・共有、コメント時に、権限のあるユーザーに、システム内通知を行う設定を、テーブルの新規作成後に追加することができます。追加する場合はYESにしてください。
※テーブルの新規作成時のみ設定できます。更新時は「通知」画面より設定してください。', diff --git a/src/Controllers/CustomTableController.php b/src/Controllers/CustomTableController.php index ceadd0fdf..339bceede 100644 --- a/src/Controllers/CustomTableController.php +++ b/src/Controllers/CustomTableController.php @@ -318,6 +318,9 @@ protected function form($id = null) if ($has_parent) { $form->switchbool('inherit_parent_permission', exmtrans("custom_table.inherit_parent_permission"))->help(exmtrans("custom_table.help.inherit_parent_permission")) ->default("0"); + + $form->switchbool('editable_with_parent', exmtrans("custom_table.editable_with_parent"))->help(exmtrans("custom_table.help.editable_with_parent")) + ->default("1"); } })->disableHeader(); diff --git a/src/DataItems/Grid/DefaultGrid.php b/src/DataItems/Grid/DefaultGrid.php index 140f7584f..087ca1141 100644 --- a/src/DataItems/Grid/DefaultGrid.php +++ b/src/DataItems/Grid/DefaultGrid.php @@ -558,10 +558,18 @@ protected function manageRowAction($grid) $enableCreate = false; } - if (!is_null($parent_value = $actions->row->getParentValue(null, true)) && $parent_value->enableEdit(true) !== true) { - $enableCreate = false; - $enableEdit = false; - $enableDelete = false; + if (!is_null($parent_value = $actions->row->getParentValue(null, true))) { + if (boolval($custom_table->getOption('editable_with_parent')??1)) { + if ($parent_value->enableEdit(true) !== true) { + $enableCreate = false; + $enableEdit = false; + $enableDelete = false; + } + } elseif ($parent_value->enableAccess() !== true) { + $enableCreate = false; + $enableEdit = false; + $enableDelete = false; + } } if (!$enableEdit) { diff --git a/src/DataItems/Show/DefaultShow.php b/src/DataItems/Show/DefaultShow.php index ec99bb5fa..a3afdb806 100644 --- a/src/DataItems/Show/DefaultShow.php +++ b/src/DataItems/Show/DefaultShow.php @@ -170,9 +170,16 @@ public function createShowForm() $tools->disableList(); } - if (!is_null($parent_value = $this->custom_value->getParentValue(null, true)) && $parent_value->enableEdit(true) !== true) { - $tools->disableEdit(); - $tools->disableDelete(); + if (!is_null($parent_value = $this->custom_value->getParentValue(null, true))) { + if (boolval($this->custom_table->getOption('editable_with_parent')??1)) { + if ($parent_value->enableEdit(true) !== true) { + $tools->disableEdit(); + $tools->disableDelete(); + } + } elseif ($parent_value->enableAccess() !== true) { + $tools->disableEdit(); + $tools->disableDelete(); + } } if ($this->modal) { diff --git a/src/Model/CustomValue.php b/src/Model/CustomValue.php index 8b6718241..27c02193b 100644 --- a/src/Model/CustomValue.php +++ b/src/Model/CustomValue.php @@ -1794,8 +1794,17 @@ public function enableEdit($checkFormAction = false) return ErrorCode::WORKFLOW_LOCK(); } - if (!is_null($parent_value = $this->getParentValue()) && ($code = $parent_value->enableEdit($checkFormAction)) !== true) { - return $code; + // check parent permission + if (!is_null($parent_value = $this->getParentValue())) { + if (boolval($this->custom_table->getOption('editable_with_parent')??1)) { + if (($code = $parent_value->enableEdit($checkFormAction)) !== true) { + return $code; + } + } else { + if (($code = $parent_value->enableAccess()) !== true) { + return $code; + } + } } if ($this->trashed()) { @@ -1834,8 +1843,17 @@ public function enableDelete($checkFormAction = false) return ErrorCode::DELETE_DISABLED(); } - if (!is_null($parent_value = $this->getParentValue()) && ($code = $parent_value->enableDelete($checkFormAction)) !== true) { - return $code; + // check parent permission + if (!is_null($parent_value = $this->getParentValue())) { + if (boolval($this->custom_table->getOption('editable_with_parent')??1)) { + if (($code = $parent_value->enableDelete($checkFormAction)) !== true) { + return $code; + } + } else { + if (($code = $parent_value->enableAccess()) !== true) { + return $code; + } + } } return true;