Compare commits

...

4 Commits

  1. 4
      README.md
  2. 3
      keycloak/keycloak_admin.py

4
README.md

@ -237,6 +237,10 @@ realm_roles = keycloak_admin.get_roles()
# Assign client role to user. Note that BOTH role_name and role_id appear to be required. # Assign client role to user. Note that BOTH role_name and role_id appear to be required.
keycloak_admin.assign_client_role(client_id=client_id, user_id=user_id, role_id=role_id, role_name="test") keycloak_admin.assign_client_role(client_id=client_id, user_id=user_id, role_id=role_id, role_name="test")
# Assign realm roles to user
keycloak_admin.assign_realm_roles(user_id=user_id, roles=realm_roles)
# Get all ID Providers # Get all ID Providers
idps = keycloak_admin.get_idps() idps = keycloak_admin.get_idps()

3
keycloak/keycloak_admin.py

@ -1154,12 +1154,11 @@ class KeycloakAdmin:
URL_ADMIN_REALM_ROLES_COMPOSITE_REALM_ROLE.format(**params_path)) URL_ADMIN_REALM_ROLES_COMPOSITE_REALM_ROLE.format(**params_path))
return raise_error_from_response(data_raw, KeycloakGetError) return raise_error_from_response(data_raw, KeycloakGetError)
def assign_realm_roles(self, user_id, client_id, roles):
def assign_realm_roles(self, user_id, roles):
""" """
Assign realm roles to a user Assign realm roles to a user
:param user_id: id of user :param user_id: id of user
:param client_id: id of client containing role (not client-id)
:param roles: roles list or role (use RoleRepresentation) :param roles: roles list or role (use RoleRepresentation)
:return Keycloak server response :return Keycloak server response
""" """

Loading…
Cancel
Save