Skip to content

Commit 621ad10

Browse files
committed
user_update() WIP
1 parent b1e4087 commit 621ad10

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/server/api/user_api.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,35 @@ def check_username():
318318

319319
return jsonify(user_exists)
320320

321+
@user_api.route("/api/admin/user/update", methods=["POST"])
322+
# @jwt_ops.admin_required
323+
def user_update():
324+
"""Update existing user record
325+
"""
326+
327+
post_dict = json.loads(request.data)
328+
329+
try:
330+
username = post_dict["username"]
331+
except:
332+
return jsonify("Must specify username"), 400
333+
334+
# We should get 1+ values to update
335+
336+
update_dict = {"username": username}
337+
338+
# Need to be a bit defensive here & select what we want instead of taking what we're given
339+
for key in ["full_name", "password", "role"]:
340+
try:
341+
val = post_dict[key]
342+
update_dict[key] = val
343+
except:
344+
pass
321345

346+
#TODO: WIP
347+
print(update_dict)
322348

349+
return jsonify("foo")
323350

324351
# TODO: A single do-all update_user()
325352
@user_api.route("/api/admin/user/deactivate", methods=["POST"])

0 commit comments

Comments
 (0)