1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-12 11:05:38 +00:00

improve diff?

This commit is contained in:
Felix Grzelka 2026-06-03 09:51:48 +00:00
parent 0cf612e0ce
commit 35c87a4a12

View file

@ -1085,22 +1085,6 @@ class KeycloakAPI:
except Exception as e:
self.fail_request(e, msg=f"Could not fetch effective rolemappings for user {uid}, realm {realm}: {e}")
def get_realm_users(self, realm: str = "master") -> list[dict[str, t.Any]]:
"""Obtain list of users from the realm
:param realm: realm id
:return: list of user representations
"""
users_url = URL_USERS.format(url=self.baseurl, realm=realm)
try:
return self._request_and_deserialize(users_url, method="GET")
except ValueError as e:
self.module.fail_json(
msg=f"API returned incorrect JSON when trying to obtain the users for realm {realm}: {e}"
)
except Exception as e:
self.fail_request(e, msg=f"Could not obtain the users for realm {realm}: {e}")
def get_user_by_username(self, username: str, realm: str = "master") -> dict[str, t.Any] | None:
"""Fetch a keycloak user within a realm based on its username.
@ -1123,6 +1107,22 @@ class KeycloakAPI:
except Exception as e:
self.fail_request(e, msg=f"Could not obtain the user for realm {realm} and username {username}: {e}")
def get_realm_users(self, realm: str = "master") -> list[dict[str, t.Any]]:
"""Obtain list of users from the realm
:param realm: realm id
:return: list of user representations
"""
users_url = URL_USERS.format(url=self.baseurl, realm=realm)
try:
return self._request_and_deserialize(users_url, method="GET")
except ValueError as e:
self.module.fail_json(
msg=f"API returned incorrect JSON when trying to obtain the users for realm {realm}: {e}"
)
except Exception as e:
self.fail_request(e, msg=f"Could not obtain the users for realm {realm}: {e}")
def get_service_account_user_by_client_id(self, client_id, realm: str = "master"):
"""Fetch a keycloak service account user within a realm based on its client_id.