add permission: false to policy query (#2564)
* add permission: false to policy query fixes: #2528 * fixed tests
This commit is contained in:
parent
91b18a03b5
commit
3c55d72517
2 changed files with 14 additions and 11 deletions
|
@ -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",
|
||||
|
|
|
@ -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]
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue