Skip to content

Commit e1c8973

Browse files
authoredApr 7, 2024··
feat: Allow query parameters for group children (#534)
1 parent e984f8a commit e1c8973

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
 

‎src/keycloak/keycloak_admin.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -1349,21 +1349,24 @@ def get_subgroups(self, group, path):
13491349
# went through the tree without hits
13501350
return None
13511351

1352-
def get_group_children(self, group_id):
1353-
"""Get group children by id.
1352+
def get_group_children(self, group_id, query=None):
1353+
"""Get group children by parent id.
13541354
13551355
Returns full group children details
13561356
1357-
:param group_id: The group id
1357+
:param group_id: The parent group id
13581358
:type group_id: str
1359+
:param query: Additional query options
1360+
:type query: dict
13591361
:return: Keycloak server response (GroupRepresentation)
13601362
:rtype: dict
13611363
"""
1364+
query = query or {}
13621365
params_path = {"realm-name": self.connection.realm_name, "id": group_id}
1363-
data_raw = self.connection.raw_get(
1364-
urls_patterns.URL_ADMIN_GROUP_CHILD.format(**params_path)
1365-
)
1366-
return raise_error_from_response(data_raw, KeycloakGetError)
1366+
url = urls_patterns.URL_ADMIN_GROUP_CHILD.format(**params_path)
1367+
if "first" in query or "max" in query:
1368+
return self.__fetch_paginated(url, query)
1369+
return self.__fetch_all(url, query)
13671370

13681371
def get_group_members(self, group_id, query=None):
13691372
"""Get members by group id.

0 commit comments

Comments
 (0)
Please sign in to comment.