|
@@ -244,6 +244,41 @@ class UserController(Controller):
|
244
|
244
|
@require_profile(Group.TIM_ADMIN)
|
245
|
245
|
@hapic.input_path(UserIdPathSchema())
|
246
|
246
|
@hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
|
247
|
+ def delete_user(self, context, request: TracimRequest, hapic_data=None):
|
|
248
|
+ """
|
|
249
|
+ delete user
|
|
250
|
+ """
|
|
251
|
+ app_config = request.registry.settings['CFG']
|
|
252
|
+ uapi = UserApi(
|
|
253
|
+ current_user=request.current_user, # User
|
|
254
|
+ session=request.dbsession,
|
|
255
|
+ config=app_config,
|
|
256
|
+ )
|
|
257
|
+ uapi.delete(user=request.candidate_user, do_save=True)
|
|
258
|
+ return
|
|
259
|
+
|
|
260
|
+ @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
|
|
261
|
+ @require_profile(Group.TIM_ADMIN)
|
|
262
|
+ @hapic.input_path(UserIdPathSchema())
|
|
263
|
+ @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
|
264
|
+ def undelete_user(self, context, request: TracimRequest, hapic_data=None):
|
|
265
|
+ """
|
|
266
|
+ undelete user
|
|
267
|
+ """
|
|
268
|
+ app_config = request.registry.settings['CFG']
|
|
269
|
+ uapi = UserApi(
|
|
270
|
+ current_user=request.current_user, # User
|
|
271
|
+ session=request.dbsession,
|
|
272
|
+ config=app_config,
|
|
273
|
+ show_deleted=True,
|
|
274
|
+ )
|
|
275
|
+ uapi.undelete(user=request.candidate_user, do_save=True)
|
|
276
|
+ return
|
|
277
|
+
|
|
278
|
+ @hapic.with_api_doc(tags=[SWAGGER_TAG__USER_ENDPOINTS])
|
|
279
|
+ @require_profile(Group.TIM_ADMIN)
|
|
280
|
+ @hapic.input_path(UserIdPathSchema())
|
|
281
|
+ @hapic.output_body(NoContentSchema(), default_http_code=HTTPStatus.NO_CONTENT) # nopep8
|
247
|
282
|
def disable_user(self, context, request: TracimRequest, hapic_data=None):
|
248
|
283
|
"""
|
249
|
284
|
disable user
|
|
@@ -464,6 +499,14 @@ class UserController(Controller):
|
464
|
499
|
configurator.add_route('disable_user', '/users/{user_id}/disable', request_method='PUT') # nopep8
|
465
|
500
|
configurator.add_view(self.disable_user, route_name='disable_user')
|
466
|
501
|
|
|
502
|
+ # delete user
|
|
503
|
+ configurator.add_route('delete_user', '/users/{user_id}/delete', request_method='PUT') # nopep8
|
|
504
|
+ configurator.add_view(self.delete_user, route_name='delete_user')
|
|
505
|
+
|
|
506
|
+ # undelete user
|
|
507
|
+ configurator.add_route('undelete_user', '/users/{user_id}/undelete', request_method='PUT') # nopep8
|
|
508
|
+ configurator.add_view(self.undelete_user, route_name='undelete_user')
|
|
509
|
+
|
467
|
510
|
# set user profile
|
468
|
511
|
configurator.add_route('set_user_profile', '/users/{user_id}/profile', request_method='PUT') # nopep8
|
469
|
512
|
configurator.add_view(self.set_profile, route_name='set_user_profile')
|