MR comments
This commit is contained in:
parent
97d4f0845d
commit
732555ac6a
2 changed files with 8 additions and 14 deletions
|
@ -71,12 +71,9 @@ class UserService:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def delete_user(id):
|
def delete_user(id):
|
||||||
app_role = AppRole.query.filter_by(user_id=id).all()
|
app_role = AppRole.query.filter_by(user_id=id).all()
|
||||||
try:
|
for ar in app_role:
|
||||||
for ar in app_role:
|
db.session.delete(ar)
|
||||||
db.session.delete(ar)
|
db.session.commit()
|
||||||
db.session.commit()
|
|
||||||
except:
|
|
||||||
raise Exception('Exception during user roles deletion for userId: {}').__format__(id)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __insertAppRoleToUser(userId, userRes):
|
def __insertAppRoleToUser(userId, userRes):
|
||||||
|
|
|
@ -50,11 +50,8 @@ def put_user(id):
|
||||||
@jwt_required()
|
@jwt_required()
|
||||||
@cross_origin()
|
@cross_origin()
|
||||||
def delete_user(id):
|
def delete_user(id):
|
||||||
try:
|
res = KratosApi.delete("/identities/{}".format(id))
|
||||||
res = KratosApi.delete("/identities/{}".format(id))
|
if res.status_code == 204:
|
||||||
if res.status_code == 204:
|
UserService.delete_user(id)
|
||||||
UserService.delete_user(id)
|
return jsonify(), res.status_code
|
||||||
return jsonify(), res.status_code
|
return jsonify(res.json()), res.status_code
|
||||||
return jsonify(res.json()), res.status_code
|
|
||||||
except:
|
|
||||||
return jsonify({"message":"There was an error deleting user"}), 404
|
|
||||||
|
|
Loading…
Reference in a new issue