Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and ml-evs committed Mar 11, 2024
1 parent 0a4727a commit 9fe501b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pydatalab/pydatalab/routes/v0_1/users.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from bson import ObjectId
from flask import Blueprint, jsonify, request

from flask_login import current_user

from pydatalab.mongo import flask_mongo


user = Blueprint("users", __name__)


Expand All @@ -20,8 +18,12 @@ def save_user(user_id):
return jsonify(status="error"), 403

update_result = flask_mongo.db.users.update_one(
{"_id": ObjectId(user_id)}, {"$set": {"display_name": user_name}})
{"_id": ObjectId(user_id)}, {"$set": {"display_name": user_name}}
)
if update_result.nmodified != 1:
return jsonify(status="error", detail="User does not have the appropriate permissions to update the given user ID."), 403
return jsonify(
status="error",
detail="User does not have the appropriate permissions to update the given user ID.",
), 403

return jsonify(status="success"), 200

0 comments on commit 9fe501b

Please sign in to comment.