From 635e2d3aca83d0ef9430c1e801a5a188e3baf268 Mon Sep 17 00:00:00 2001 From: seto Date: Wed, 6 Mar 2024 17:14:05 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=82=AF=E3=82=BB=E3=82=B9=E3=83=AB?= =?UTF-8?q?=E3=83=BC=E3=83=AB=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E4=B8=80?= =?UTF-8?q?=E8=A6=A7=20=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=82=B0?= =?UTF-8?q?=E3=83=AB=E3=83=BC=E3=83=97=E3=81=A8=E3=82=BF=E3=82=A4=E3=83=97?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E6=99=82=E3=81=AE=E8=A1=A8=E7=A4=BA=E8=AA=BF?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/PermissionGroupsController.php | 14 +++++++++++++- .../Service/Admin/PermissionGroupsAdminService.php | 2 +- .../src/js/admin/permission_groups/index.js | 13 ++++++++++--- .../js/admin/permission_groups/index.bundle.js | 12 +++++++++++- .../js/admin/permission_groups/index.bundle.js.map | 2 +- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/plugins/baser-core/src/Controller/Admin/PermissionGroupsController.php b/plugins/baser-core/src/Controller/Admin/PermissionGroupsController.php index aae9f65942..a4c4403559 100644 --- a/plugins/baser-core/src/Controller/Admin/PermissionGroupsController.php +++ b/plugins/baser-core/src/Controller/Admin/PermissionGroupsController.php @@ -49,11 +49,23 @@ public function index(PermissionGroupsAdminServiceInterface $service, ?int $user } } + $authPrefixes = $service->getControlSource('auth_prefix', [ + 'user_group_id' => $userGroupId, + ]); + $authPrefixes = array_keys($authPrefixes); + $request = $this->getRequest(); + $listType = $request->getQuery('list_type'); + if (!in_array($listType, $authPrefixes)) { + $listType = $authPrefixes[0]; + } + $this->setRequest($request->withParsedBody([ - 'list_type' => $request->getQuery('list_type'), + 'list_type' => $listType, 'filter_user_group_id' => $userGroupId ])); + $request = $this->getRequest(); + $this->set($service->getViewVarsForIndex($userGroupId, $request)); } diff --git a/plugins/baser-core/src/Service/Admin/PermissionGroupsAdminService.php b/plugins/baser-core/src/Service/Admin/PermissionGroupsAdminService.php index 14179d5a29..e18f7181c0 100644 --- a/plugins/baser-core/src/Service/Admin/PermissionGroupsAdminService.php +++ b/plugins/baser-core/src/Service/Admin/PermissionGroupsAdminService.php @@ -42,7 +42,7 @@ public function getViewVarsForIndex(int $userGroupId, ServerRequest $request): a return [ 'entities' => $this->getIndex($userGroupId, array_merge( ['permission_amount' => true], - $request->getQueryParams() + $request->getData() )), 'userGroupId' => $currentUserGroup->id ?? "0" ]; diff --git a/plugins/bc-admin-third/src/js/admin/permission_groups/index.js b/plugins/bc-admin-third/src/js/admin/permission_groups/index.js index 68b3603abf..fc666ff040 100644 --- a/plugins/bc-admin-third/src/js/admin/permission_groups/index.js +++ b/plugins/bc-admin-third/src/js/admin/permission_groups/index.js @@ -11,10 +11,16 @@ const permissionGroupsIndex = { + /** + * 初期のユーザーグループID + */ + initialUserGroupId: 0, + /** * 初期化 */ mounted() { + this.initialUserGroupId = $('#filter-user-group-id').val(); this.registerEvents(); }, @@ -33,10 +39,11 @@ const permissionGroupsIndex = { $.bcUtil.showLoader(); let userGroupId = $('#filter-user-group-id').val(); let listType = $('input[name="list_type"]:checked').val(); - if(userGroupId === '0') { - listType = 'Front'; + if (permissionGroupsIndex.initialUserGroupId === userGroupId) { + location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}?list_type=${listType}`; + } else { + location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}`; } - location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}?list_type=${listType}`; } } diff --git a/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js b/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js index 2e90d8d94c..349f36371f 100644 --- a/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js +++ b/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js @@ -1,2 +1,12 @@ -({mounted:function(){this.registerEvents()},registerEvents:function(){$("#filter-user-group-id").change(this.changeList),$('input[name="list_type"]').click(this.changeList)},changeList:function(){$.bcUtil.showLoader();var t=$("#filter-user-group-id").val(),e=$('input[name="list_type"]:checked').val();"0"===t&&(e="Front"),location.href="".concat($.bcUtil.adminBaseUrl,"baser-core/permission_groups/index/").concat(t,"?list_type=").concat(e)}}).mounted(); +(()=>{ +/** + * baserCMS : Based Website Development Project + * Copyright (c) baserCMS Permission Community + * + * @copyright Copyright (c) baserCMS Permission Community + * @link https://basercms.net baserCMS Project + * @since 5.0.0 + * @license https://basercms.net/license/index.html MIT License + */ +var i={initialUserGroupId:0,mounted:function(){this.initialUserGroupId=$("#filter-user-group-id").val(),this.registerEvents()},registerEvents:function(){$("#filter-user-group-id").change(this.changeList),$('input[name="list_type"]').click(this.changeList)},changeList:function(){$.bcUtil.showLoader();var e=$("#filter-user-group-id").val(),t=$('input[name="list_type"]:checked').val();i.initialUserGroupId===e?location.href="".concat($.bcUtil.adminBaseUrl,"baser-core/permission_groups/index/").concat(e,"?list_type=").concat(t):location.href="".concat($.bcUtil.adminBaseUrl,"baser-core/permission_groups/index/").concat(e)}};i.mounted()})(); //# sourceMappingURL=index.bundle.js.map \ No newline at end of file diff --git a/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js.map b/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js.map index b621d11a1d..df7ee3922d 100644 --- a/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js.map +++ b/plugins/bc-admin-third/webroot/js/admin/permission_groups/index.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"js/admin/permission_groups/index.bundle.js","mappings":"CAW8B,CAK1BA,QAAO,WACHC,KAAKC,gBACT,EAKAA,eAAc,WACVC,EAAE,yBAAyBC,OAAOH,KAAKI,YACvCF,EAAE,2BAA2BG,MAAML,KAAKI,WAC5C,EAKAA,WAAU,WACNF,EAAEI,OAAOC,aACT,IAAIC,EAAcN,EAAE,yBAAyBO,MACzCC,EAAWR,EAAE,mCAAmCO,MACjC,MAAhBD,IACCE,EAAW,SAEfC,SAASC,KAAO,GAAHC,OAAMX,EAAEI,OAAOQ,aAAY,uCAAAD,OAAsCL,EAAW,eAAAK,OAAcH,EAC3G,IAIkBX","sources":["webpack://bc-admin-third/./src/js/admin/permission_groups/index.js"],"sourcesContent":["/**\n * baserCMS : Based Website Development Project \n * Copyright (c) baserCMS Permission Community \n *\n * @copyright Copyright (c) baserCMS Permission Community\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\n\n\nconst permissionGroupsIndex = {\n\n /**\n * 初期化\n */\n mounted() {\n this.registerEvents();\n },\n\n /**\n * イベント登録\n */\n registerEvents() {\n $('#filter-user-group-id').change(this.changeList);\n $('input[name=\"list_type\"]').click(this.changeList);\n },\n\n /**\n * 一覧を初期化\n */\n changeList() {\n $.bcUtil.showLoader();\n let userGroupId = $('#filter-user-group-id').val();\n let listType = $('input[name=\"list_type\"]:checked').val();\n if(userGroupId === '0') {\n listType = 'Front';\n }\n location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}?list_type=${listType}`;\n }\n\n}\n\npermissionGroupsIndex.mounted();\n"],"names":["mounted","this","registerEvents","$","change","changeList","click","bcUtil","showLoader","userGroupId","val","listType","location","href","concat","adminBaseUrl"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"js/admin/permission_groups/index.bundle.js","mappings":";;;;;;;;;;AAWA,IAAMA,EAAwB,CAK1BC,mBAAoB,EAKpBC,QAAO,WACHC,KAAKF,mBAAqBG,EAAE,yBAAyBC,MACrDF,KAAKG,gBACT,EAKAA,eAAc,WACVF,EAAE,yBAAyBG,OAAOJ,KAAKK,YACvCJ,EAAE,2BAA2BK,MAAMN,KAAKK,WAC5C,EAKAA,WAAU,WACNJ,EAAEM,OAAOC,aACT,IAAIC,EAAcR,EAAE,yBAAyBC,MACzCQ,EAAWT,EAAE,mCAAmCC,MAChDL,EAAsBC,qBAAuBW,EAC7CE,SAASC,KAAO,GAAHC,OAAMZ,EAAEM,OAAOO,aAAY,uCAAAD,OAAsCJ,EAAW,eAAAI,OAAcH,GAEvGC,SAASC,KAAO,GAAHC,OAAMZ,EAAEM,OAAOO,aAAY,uCAAAD,OAAsCJ,EAEtF,GAIJZ,EAAsBE,S","sources":["webpack://bc-admin-third/./src/js/admin/permission_groups/index.js"],"sourcesContent":["/**\n * baserCMS : Based Website Development Project \n * Copyright (c) baserCMS Permission Community \n *\n * @copyright Copyright (c) baserCMS Permission Community\n * @link https://basercms.net baserCMS Project\n * @since 5.0.0\n * @license https://basercms.net/license/index.html MIT License\n */\n\n\nconst permissionGroupsIndex = {\n\n /**\n * 初期のユーザーグループID\n */\n initialUserGroupId: 0,\n\n /**\n * 初期化\n */\n mounted() {\n this.initialUserGroupId = $('#filter-user-group-id').val();\n this.registerEvents();\n },\n\n /**\n * イベント登録\n */\n registerEvents() {\n $('#filter-user-group-id').change(this.changeList);\n $('input[name=\"list_type\"]').click(this.changeList);\n },\n\n /**\n * 一覧を初期化\n */\n changeList() {\n $.bcUtil.showLoader();\n let userGroupId = $('#filter-user-group-id').val();\n let listType = $('input[name=\"list_type\"]:checked').val();\n if (permissionGroupsIndex.initialUserGroupId === userGroupId) {\n location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}?list_type=${listType}`;\n } else {\n location.href = `${$.bcUtil.adminBaseUrl}baser-core/permission_groups/index/${userGroupId}`;\n }\n }\n\n}\n\npermissionGroupsIndex.mounted();\n"],"names":["permissionGroupsIndex","initialUserGroupId","mounted","this","$","val","registerEvents","change","changeList","click","bcUtil","showLoader","userGroupId","listType","location","href","concat","adminBaseUrl"],"sourceRoot":""} \ No newline at end of file