Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin.get_groups not returning group attributes #570

Open
fvallee-bnx opened this issue Jun 7, 2024 · 1 comment
Open

admin.get_groups not returning group attributes #570

fvallee-bnx opened this issue Jun 7, 2024 · 1 comment

Comments

@fvallee-bnx
Copy link

fvallee-bnx commented Jun 7, 2024

reproduced with v4.1.0 and older versions

When calling admin.get_groups, the parent group attributes are missing.
attributes are present in subgroups, but not in parent group

For instance with the parent group "parent" containing attributes the response will be like:

[ { "id": "parent", "name": "parent", "path": "/parent", "subGroupCount": 1, "subGroups": [ { "id": "child", "name": "child", "path": "/parent/child", "parentId": "parent", "subGroupCount": 0, "subGroups": [], "attributes": {}, "realmRoles": [], "clientRoles": {}, "access": { "view": true, "viewMembers": true, "manageMembers": true, "manage": true, "manageMembership": true } } ], "access": { "view": true, "viewMembers": true, "manageMembers": true, "manage": true, "manageMembership": true } } ]

Please note that attributes can be retrieved using get_group_by_path('/parent'), but they should be in get_groups too - especially since they are in subGroups!

@ryshoooo
Copy link
Collaborator

This is expected based on the default parameters given by the Keycloak's admin REST API, see https://www.keycloak.org/docs-api/latest/rest-api/index.html#_groups. The GET /admin/realms/{realm}/groups has briefRepresentation set to true by default, while GET /admin/realms/{realm}/groups/{group-id}/children has the briefRepresentation set to false by default. Not sure why this is the convention the Keycloak team went for, I guess that'd be a fair question to ask them.

You should be able to get all attributes by calling .get_groups(query={"briefRepresentation": "false"}). We can add this as a default into the library for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants