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

feat: Allow query parameters for group children #534

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/keycloak/keycloak_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,21 +1349,24 @@ def get_subgroups(self, group, path):
# went through the tree without hits
return None

def get_group_children(self, group_id):
"""Get group children by id.
def get_group_children(self, group_id, query=None):
"""Get group children by parent id.

Returns full group children details

:param group_id: The group id
:param group_id: The parent group id
:type group_id: str
:param query: Additional query options
:type query: dict
:return: Keycloak server response (GroupRepresentation)
:rtype: dict
"""
query = query or {}
params_path = {"realm-name": self.connection.realm_name, "id": group_id}
data_raw = self.connection.raw_get(
urls_patterns.URL_ADMIN_GROUP_CHILD.format(**params_path)
)
return raise_error_from_response(data_raw, KeycloakGetError)
url = urls_patterns.URL_ADMIN_GROUP_CHILD.format(**params_path)
if "first" in query or "max" in query:
return self.__fetch_paginated(url, query)
return self.__fetch_all(url, query)

def get_group_members(self, group_id, query=None):
"""Get members by group id.
Expand Down
Loading