mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-10 15:32:05 -03:30
Added support for searching permission (#37001)
Signed-off-by: Agnieszka Gancarczyk <agagancarczyk@gmail.com>
This commit is contained in:
parent
48a6450b73
commit
1793af6fed
@ -774,6 +774,20 @@ export class Clients extends Resource<{ realm?: string }> {
|
||||
urlParamKeys: ["id", "resourceName"],
|
||||
});
|
||||
|
||||
public listPermissionScope = this.makeRequest<
|
||||
{
|
||||
id: string;
|
||||
policyId?: string;
|
||||
name?: string;
|
||||
resource?: string;
|
||||
} & PaginatedQuery,
|
||||
PolicyRepresentation[]
|
||||
>({
|
||||
method: "GET",
|
||||
path: "/{id}/authz/resource-server/permission/scope",
|
||||
urlParamKeys: ["id"],
|
||||
});
|
||||
|
||||
public createAuthorizationScope = this.makeUpdateRequest<
|
||||
{ id: string },
|
||||
ScopeRepresentation
|
||||
|
||||
@ -1099,6 +1099,30 @@ describe("Clients", () => {
|
||||
expect(result).to.deep.equal([]);
|
||||
});
|
||||
|
||||
it("list permission scope", async () => {
|
||||
permission = await kcAdminClient.clients.createPermission(
|
||||
{
|
||||
id: currentClient.id!,
|
||||
type: "scope",
|
||||
},
|
||||
{
|
||||
name: permissionConfig.name,
|
||||
// @ts-ignore
|
||||
resources: [resource._id],
|
||||
policies: [policy.id!],
|
||||
scopes: scopes.map((scope) => scope.id!),
|
||||
},
|
||||
);
|
||||
|
||||
const p = await kcAdminClient.clients.listPermissionScope({
|
||||
id: currentClient.id!,
|
||||
name: permissionConfig.name,
|
||||
});
|
||||
|
||||
expect(p.length).to.be.eq(1);
|
||||
expect(p[0].name).to.be.eq(permissionConfig.name);
|
||||
});
|
||||
|
||||
it("import resource", async () => {
|
||||
await kcAdminClient.clients.importResource(
|
||||
{ id: currentClient.id! },
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user