Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

アクセスルールグループ一覧 ユーザーグループとタイプ変更時の表示調整 #3205

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testGetViewVarsForIndex(): void
$request = $this->getRequest('/baser/admin/baser-core/permission_groups/index?list_type=Nghiem&permission_amount=false');
$vars = $this->PermissionGroupsAdmin->getViewVarsForIndex(1, $request);
$entities = $vars['entities']->all();
$this->assertCount(0, $entities);
$this->assertCount(3, $entities);
}

/**
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.

Loading