MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / updateUser

Function updateUser

src/octoprint/server/api/users.py:72–92  ·  view source on GitHub ↗
(username)

Source from the content-addressed store, hash-verified

70@restricted_access
71@admin_permission.require(403)
72def updateUser(username):
73 if userManager is None:
74 return jsonify(SUCCESS)
75
76 user = userManager.findUser(username)
77 if user is not None:
78 if "application/json" in request.headers["Content-Type"]:
79 data = request.json
80
81 # change roles
82 roles = ["user"]
83 if "admin" in data.keys() and data["admin"]:
84 roles.append("admin")
85 userManager.changeUserRoles(username, roles)
86
87 # change activation
88 if "active" in data.keys():
89 userManager.changeUserActivation(username, data["active"])
90 return getUsers()
91 else:
92 abort(404)
93
94
95@api.route("/users/<username>", methods=["DELETE"])

Callers

nothing calls this directly

Calls 5

getUsersFunction · 0.85
appendMethod · 0.80
findUserMethod · 0.45
changeUserRolesMethod · 0.45
changeUserActivationMethod · 0.45

Tested by

no test coverage detected