Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
add compsite client role mapping endpoint (#158)
Browse files Browse the repository at this point in the history
* add compsite client role mapping endpoint

* fixed
  • Loading branch information
edewit authored Apr 15, 2021
1 parent e971668 commit 10194d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/resources/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ export class Users extends Resource<{realm?: string}> {
urlParamKeys: ['id', 'clientUniqueId'],
});

public listCompositeClientRoleMappings = this.makeRequest<
{id: string; clientUniqueId: string},
RoleRepresentation[]
>({
method: 'GET',
path: '/{id}/role-mappings/clients/{clientUniqueId}/composite',
urlParamKeys: ['id', 'clientUniqueId'],
});

/**
* Send a update account email to the user
* an email contains a link the user can click to perform a set of required actions.
Expand Down
13 changes: 11 additions & 2 deletions test/users.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ describe('Users', function () {

if (process.env.KEYCLOAK_VERSION
&& (
process.env.KEYCLOAK_VERSION.startsWith('7.')
|| process.env.KEYCLOAK_VERSION.startsWith('8.')
process.env.KEYCLOAK_VERSION.startsWith('7.')
|| process.env.KEYCLOAK_VERSION.startsWith('8.')
)) {
// should be 1, but it seems it doesn't work issue: KEYCLOAK-16081
expect(numUsers).to.equal(2);
Expand Down Expand Up @@ -409,6 +409,15 @@ describe('Users', function () {
expect(roles).to.be.empty;
});

it('list composite client role-mappings for user', async () => {
const roles = await kcAdminClient.users.listCompositeClientRoleMappings({
id: currentUser.id,
clientUniqueId: currentClient.id,
});

expect(roles).to.be.ok;
});

it('list client role-mappings of user', async () => {
const roles = await kcAdminClient.users.listClientRoleMappings({
id: currentUser.id,
Expand Down

0 comments on commit 10194d1

Please sign in to comment.