use ui ext groups endpoint (#20772)

so that we have filtering for fine grained groups
fixes: https://github.com/keycloak/keycloak/issues/19655#issuecomment-1573350358
This commit is contained in:
Erik Jan de Wit 2023-06-12 12:50:26 +02:00 committed by GitHub
parent a61b1e7fb2
commit db315b59f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,7 @@ import { PaginatingTableToolbar } from "../table-toolbar/PaginatingTableToolbar"
import { GroupPath } from "./GroupPath"; import { GroupPath } from "./GroupPath";
import "./group-picker-dialog.css"; import "./group-picker-dialog.css";
import { fetchAdminUI } from "../../context/auth/admin-ui-endpoint";
export type GroupPickerDialogProps = { export type GroupPickerDialogProps = {
id?: string; id?: string;
@ -72,11 +73,16 @@ export const GroupPickerDialog = ({
let existingUserGroups; let existingUserGroups;
let count = 0; let count = 0;
if (!groupId) { if (!groupId) {
groups = await adminClient.groups.find({ groups = await fetchAdminUI<GroupRepresentation[]>(
first, "ui-ext/groups",
max: max + (isSearching ? 0 : 1), Object.assign(
search: isSearching ? filter : "", {
}); first: `${first}`,
max: `${max + 1}`,
},
isSearching ? null : { search: filter }
)
);
} else if (!navigation.map(({ id }) => id).includes(groupId)) { } else if (!navigation.map(({ id }) => id).includes(groupId)) {
group = await adminClient.groups.findOne({ id: groupId }); group = await adminClient.groups.findOne({ id: groupId });
if (!group) { if (!group) {