From c17fdaa3d8522a39a5c812d8e40e60d09ca367f5 Mon Sep 17 00:00:00 2001 From: andres Date: Wed, 23 Sep 2020 12:57:54 +0200 Subject: [PATCH] Added get_realm_roles_of_user --- keycloak/keycloak_admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/keycloak/keycloak_admin.py b/keycloak/keycloak_admin.py index 36c3cb8..40fa977 100644 --- a/keycloak/keycloak_admin.py +++ b/keycloak/keycloak_admin.py @@ -1016,6 +1016,13 @@ class KeycloakAdmin: return raise_error_from_response(data_raw, KeycloakGetError, expected_codes=[204]) def get_realm_roles_of_user(self, user_id): + """ + Get all realm roles for a user. + + :param user_id: id of user + :return: Keycloak server response (array RoleRepresentation) + """ + params_path = {"realm-name": self.realm_name, "id": user_id} data_raw = self.raw_get(URL_ADMIN_USER_REALM_ROLES.format(**params_path)) return raise_error_from_response(data_raw, KeycloakGetError)