@@ -60,6 +60,7 @@ def get(self):
6060 return AzureConnection ().users ()
6161
6262
63+ # TODO : DEPRECATE
6364@ns .route ('/<string:id>/roles' )
6465@ns .response (HTTPStatus .NOT_FOUND , 'User not found' )
6566@ns .response (HTTPStatus .UNPROCESSABLE_ENTITY , 'The id has an invalid format' )
@@ -76,6 +77,7 @@ def post(self, id):
7677 return AzureConnection ().update_user_role (id , ns .payload ['role' ])
7778
7879
80+ # TODO : DEPRECATE
7981@ns .route ('/<string:user_id>/roles/<string:role_id>' )
8082@ns .response (HTTPStatus .NOT_FOUND , 'User not found' )
8183@ns .response (HTTPStatus .UNPROCESSABLE_ENTITY , 'The id has an invalid format' )
@@ -94,6 +96,7 @@ def delete(self, user_id, role_id):
9496@ns .param ('role_id' , 'The role name identifier' )
9597class GrantRole (Resource ):
9698 @ns .doc ('grant_role' )
99+ @ns .marshal_with (user_response_fields )
97100 def post (self , user_id , role_id ):
98101 """
99102 Grant role to user
@@ -103,14 +106,15 @@ def post(self, user_id, role_id):
103106 - admin
104107 ```
105108 """
106- return [], HTTPStatus . OK
109+ return AzureConnection (). update_role ( user_id , role_id , is_grant = True )
107110
108111
109112@ns .route ('/<string:user_id>/roles/<string:role_id>/revoke' )
110113@ns .param ('user_id' , 'The user identifier' )
111114@ns .param ('role_id' , 'The role name identifier' )
112115class RevokeRole (Resource ):
113116 @ns .doc ('revoke_role' )
117+ @ns .marshal_with (user_response_fields )
114118 def post (self , user_id , role_id ):
115119 """Revoke role to user"""
116- return [], HTTPStatus . OK
120+ return AzureConnection (). update_role ( user_id , role_id , is_grant = False )
0 commit comments