Skip to content

Commit

Permalink
add GetRealmRoleGroups function (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonfuhrer authored Nov 5, 2024
1 parent 64f3ba0 commit f311a59
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,22 @@ func (g *GoCloak) GetClientScopeMappings(ctx context.Context, token, realm, idOf
return result, nil
}

// GetRealmRoleGroups returns groups associated with the realm role
func (g *GoCloak) GetRealmRoleGroups(ctx context.Context, token, roleName, realm string) ([]*Group, error) {
const errMessage = "could not get groups by realm roleName"

var result []*Group
resp, err := g.GetRequestWithBearerAuth(ctx, token).
SetResult(&result).
Get(g.getAdminRealmURL(realm, "roles", roleName, "groups"))

if err = checkForError(resp, err, errMessage); err != nil {
return nil, err
}

return result, nil
}

// GetClientScopeMappingsRealmRoles returns realm-level roles associated with the client’s scope
func (g *GoCloak) GetClientScopeMappingsRealmRoles(ctx context.Context, token, realm, idOfClient string) ([]*Role, error) {
const errMessage = "could not get realm-level roles with the client’s scope"
Expand Down

0 comments on commit f311a59

Please sign in to comment.