(username)
| 109 | @api.route("/users/<username>/password", methods=["PUT"]) |
| 110 | @restricted_access |
| 111 | def changePasswordForUser(username): |
| 112 | if userManager is None: |
| 113 | return jsonify(SUCCESS) |
| 114 | |
| 115 | if current_user is not None and not current_user.is_anonymous and (current_user.get_name() == username or current_user.is_admin()): |
| 116 | if "application/json" in request.headers["Content-Type"]: |
| 117 | data = request.json |
| 118 | if "password" in data.keys() and data["password"]: |
| 119 | try: |
| 120 | userManager.changeUserPassword(username, data["password"]) |
| 121 | except users.UnknownUser: |
| 122 | return make_response(("Unknown user: %s" % username, 404, [])) |
| 123 | return jsonify(SUCCESS) |
| 124 | else: |
| 125 | return make_response(("Forbidden", 403, [])) |
| 126 | |
| 127 | |
| 128 | @api.route("/users/<username>/apikey", methods=["DELETE"]) |
nothing calls this directly
no test coverage detected