diff --git a/src/octoprint/server/api/access.py b/src/octoprint/server/api/access.py index 28293dd84..e8e568de3 100644 --- a/src/octoprint/server/api/access.py +++ b/src/octoprint/server/api/access.py @@ -25,14 +25,14 @@ def get_permissions(): @api.route("/access/groups", methods=["GET"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def get_groups(): return jsonify(groups=list(map(lambda g: g.as_dict(), groupManager.groups))) @api.route("/access/groups", methods=["POST"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def add_group(): if "application/json" not in request.headers["Content-Type"]: abort(400, description="Expected content-type JSON") @@ -69,7 +69,7 @@ def add_group(): @api.route("/access/groups/", methods=["GET"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def get_group(key): group = groupManager.find_group(key) if group is not None: @@ -80,7 +80,7 @@ def get_group(key): @api.route("/access/groups/", methods=["PUT"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def update_group(key): if "application/json" not in request.headers["Content-Type"]: abort(400, description="Expected content-type JSON") @@ -113,7 +113,7 @@ def update_group(key): @api.route("/access/groups/", methods=["DELETE"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def remove_group(key): try: groupManager.remove_group(key) @@ -129,14 +129,14 @@ def remove_group(key): @api.route("/access/users", methods=["GET"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def get_users(): return jsonify(users=list(map(lambda u: u.as_dict(), userManager.get_all_users()))) @api.route("/access/users", methods=["POST"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def add_user(): if "application/json" not in request.headers["Content-Type"]: abort(400, description="Expected content-type JSON") @@ -188,7 +188,7 @@ def get_user(username): @api.route("/access/users/", methods=["PUT"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def update_user(username): user = userManager.find_user(username) if user is not None: @@ -223,7 +223,7 @@ def update_user(username): @api.route("/access/users/", methods=["DELETE"]) @no_firstrun_access -@Permissions.SETTINGS.require(403) +@Permissions.ADMIN.require(403) def remove_user(username): try: userManager.remove_user(username) @@ -243,7 +243,7 @@ def change_password_for_user(username): and not current_user.is_anonymous and ( current_user.get_name() == username - or current_user.has_permission(Permissions.SETTINGS) + or current_user.has_permission(Permissions.ADMIN) ) ): if "application/json" not in request.headers["Content-Type"]: @@ -257,7 +257,7 @@ def change_password_for_user(username): if "password" not in data or not data["password"]: abort(400, description="new password is missing") - if not current_user.has_permission(Permissions.SETTINGS) or "current" in data: + if not current_user.has_permission(Permissions.ADMIN) or "current" in data: if "current" not in data or not data["current"]: abort(400, description="current password is missing") diff --git a/src/octoprint/static/js/app/viewmodels/access.js b/src/octoprint/static/js/app/viewmodels/access.js index f773f1f36..24240207d 100644 --- a/src/octoprint/static/js/app/viewmodels/access.js +++ b/src/octoprint/static/js/app/viewmodels/access.js @@ -862,7 +862,7 @@ $(function () { access.onUserLoggedIn = access.onUserLoggedOut = function (user) { - if (access.loginState.hasPermission(access.permissions.SETTINGS)) { + if (access.loginState.hasPermission(access.permissions.ADMIN)) { access.groups.requestData().done(function () { access.users.requestData(); });