From 1af19bb41716c9cada258fc8df4264347e00bf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 18 Jan 2021 12:14:25 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Get=20rid=20of=20some=20co?= =?UTF-8?q?de=20duplication?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugin/types.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index 5c804fb08..9241e5502 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -1634,15 +1634,14 @@ class SettingsPlugin(OctoPrintPlugin): for level, paths in restricted_paths.items(): if isinstance(level, OctoPrintPermission): - for path in paths: - condition = lambda: ( - current_user is not None and current_user.has_permission(level) - ) - restrict_path_unless(data, path, condition) + condition = lambda: ( + current_user is not None and current_user.has_permission(level) + ) else: condition = conditions.get(level, lambda: False) - for path in paths: - restrict_path_unless(data, path, condition) + + for path in paths: + restrict_path_unless(data, path, condition) return data