mirror of
https://github.com/ansible-middleware/keycloak.git
synced 2026-07-29 19:04:48 +00:00
Add community.general.keycloak_realm_users_info into keycloak collection
This commit is contained in:
@@ -1108,6 +1108,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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user