Skip to content

Commit

Permalink
Keycloak: raise Exception if group isn't found
Browse files Browse the repository at this point in the history
  • Loading branch information
NotActuallyTerry committed May 28, 2024
1 parent 4554b7a commit a44359a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions githubapp/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ def get_group_id(client: KeycloakAdmin = None):
:return: The group's UUID in Keycloak
"""
group = client.get_groups(query={"search": group_name})

group = client.get_groups(query={"search": group_name, "briefRepresentation": "true", "exact": "true"})
return group[0]["id"]
if not group:
raise Exception(f"Cannot find group {group_name} in Keycloak")
else:
return group[0]["id"]

def get_members(client: KeycloakAdmin = None, group_id: str = None):
"""
Expand Down

0 comments on commit a44359a

Please sign in to comment.