@@ -696,32 +696,34 @@ def get_client_role_id(self, client_id, role_name):
696696 role = self .get_client_role (client_id , role_name )
697697 return role .get ("id" )
698698
699- def create_client_role (self , payload , skip_exists = False ):
699+ def create_client_role (self , client_role_id , payload , skip_exists = False ):
700700 """
701701 Create a client role
702702
703703 RoleRepresentation
704704 http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_rolerepresentation
705705
706- :param payload: id of client (not client-id), role_name: name of role
706+ :param client_role_id: id of client (not client-id)
707+ :param payload: RoleRepresentation
707708 :return: Keycloak server response (RoleRepresentation)
708709 """
709710
710- params_path = {"realm-name" : self .realm_name , "id" : self . client_id }
711+ params_path = {"realm-name" : self .realm_name , "id" : client_role_id }
711712 data_raw = self .connection .raw_post (URL_ADMIN_CLIENT_ROLES .format (** params_path ),
712713 data = json .dumps (payload ))
713714 return raise_error_from_response (data_raw , KeycloakGetError , expected_code = 201 , skip_exists = skip_exists )
714715
715- def delete_client_role (self , role_name ):
716+ def delete_client_role (self , client_role_id , role_name ):
716717 """
717718 Create a client role
718719
719720 RoleRepresentation
720721 http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_rolerepresentation
721722
723+ :param client_role_id: id of client (not client-id)
722724 :param role_name: role’s name (not id!)
723725 """
724- params_path = {"realm-name" : self .realm_name , "id" : self . client_id , "role-name" : role_name }
726+ params_path = {"realm-name" : self .realm_name , "id" : client_role_id , "role-name" : role_name }
725727 data_raw = self .connection .raw_delete (URL_ADMIN_CLIENT_ROLE .format (** params_path ))
726728 return raise_error_from_response (data_raw , KeycloakGetError , expected_code = 204 )
727729
0 commit comments