add permission: false to policy query (#2564)

* add permission: false to policy query

fixes: #2528

* fixed tests
This commit is contained in:
Erik Jan de Wit 2022-05-04 10:40:01 +02:00 committed by GitHub
parent 91b18a03b5
commit 3c55d72517
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View file

@ -151,7 +151,7 @@ describe("Client authentication subtab", () => {
});
permissionsSubTab.selectResource("Default Resource").formUtils().save();
cy.intercept(
"/admin/realms/master/clients/*/authz/resource-server/resource?first=0&max=10"
"/admin/realms/master/clients/*/authz/resource-server/resource?first=0&max=10&permission=false"
).as("load");
masthead.checkNotificationMessage(
"Successfully created the permission",

View file

@ -5,7 +5,10 @@ import { Select, SelectOption, SelectVariant } from "@patternfly/react-core";
import type ResourceRepresentation from "@keycloak/keycloak-admin-client/lib/defs/resourceRepresentation";
import type PolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyRepresentation";
import type { Clients } from "@keycloak/keycloak-admin-client/lib/resources/clients";
import type {
Clients,
PolicyQuery,
} from "@keycloak/keycloak-admin-client/lib/resources/clients";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
type Type = "resources" | "policies";
@ -74,15 +77,14 @@ export const ResourcesPolicySelect = ({
});
useFetch(
async () =>
(
async () => {
const params: PolicyQuery = Object.assign(
{ id: clientId, first: 0, max: 10, permission: "false" },
search === "" ? null : { name: search }
);
return (
await Promise.all([
adminClient.clients[functions.searchFunction](
Object.assign(
{ id: clientId, first: 0, max: 10 },
search === "" ? null : { name: search }
)
),
adminClient.clients[functions.searchFunction](params),
permissionId
? adminClient.clients[functions.fetchFunction]({
id: clientId,
@ -96,7 +98,8 @@ export const ResourcesPolicySelect = ({
.filter(
({ id }, index, self) =>
index === self.findIndex(({ id: otherId }) => id === otherId)
),
);
},
setItems,
[search]
);