Skip to content

Commit

Permalink
アクセスルールグループ一覧 ユーザーグループとタイプ変更時の表示調整
Browse files Browse the repository at this point in the history
  • Loading branch information
seto1 committed Mar 6, 2024
1 parent 5bf7870 commit 635e2d3
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];
Expand Down
13 changes: 10 additions & 3 deletions plugins/bc-admin-third/src/js/admin/permission_groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@

const permissionGroupsIndex = {

/**
* 初期のユーザーグループID
*/
initialUserGroupId: 0,

/**
* 初期化
*/
mounted() {
this.initialUserGroupId = $('#filter-user-group-id').val();
this.registerEvents();
},

Expand All @@ -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}`;
}

}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 635e2d3

Please sign in to comment.