@@ -60,6 +60,7 @@ def get(self):
60
60
return AzureConnection ().users ()
61
61
62
62
63
+ # TODO : DEPRECATE
63
64
@ns .route ('/<string:id>/roles' )
64
65
@ns .response (HTTPStatus .NOT_FOUND , 'User not found' )
65
66
@ns .response (HTTPStatus .UNPROCESSABLE_ENTITY , 'The id has an invalid format' )
@@ -76,6 +77,7 @@ def post(self, id):
76
77
return AzureConnection ().update_user_role (id , ns .payload ['role' ])
77
78
78
79
80
+ # TODO : DEPRECATE
79
81
@ns .route ('/<string:user_id>/roles/<string:role_id>' )
80
82
@ns .response (HTTPStatus .NOT_FOUND , 'User not found' )
81
83
@ns .response (HTTPStatus .UNPROCESSABLE_ENTITY , 'The id has an invalid format' )
@@ -94,6 +96,7 @@ def delete(self, user_id, role_id):
94
96
@ns .param ('role_id' , 'The role name identifier' )
95
97
class GrantRole (Resource ):
96
98
@ns .doc ('grant_role' )
99
+ @ns .marshal_with (user_response_fields )
97
100
def post (self , user_id , role_id ):
98
101
"""
99
102
Grant role to user
@@ -103,14 +106,15 @@ def post(self, user_id, role_id):
103
106
- admin
104
107
```
105
108
"""
106
- return [], HTTPStatus . OK
109
+ return AzureConnection (). update_role ( user_id , role_id , is_grant = True )
107
110
108
111
109
112
@ns .route ('/<string:user_id>/roles/<string:role_id>/revoke' )
110
113
@ns .param ('user_id' , 'The user identifier' )
111
114
@ns .param ('role_id' , 'The role name identifier' )
112
115
class RevokeRole (Resource ):
113
116
@ns .doc ('revoke_role' )
117
+ @ns .marshal_with (user_response_fields )
114
118
def post (self , user_id , role_id ):
115
119
"""Revoke role to user"""
116
- return [], HTTPStatus . OK
120
+ return AzureConnection (). update_role ( user_id , role_id , is_grant = False )
0 commit comments