Skip to content

Commit 0a9f969

Browse files
committed
Also filter plugins without cfg block
1 parent 076e188 commit 0a9f969

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/qwc2_viewer.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -558,21 +558,17 @@ def __filter_restricted_viewer_tasks(self, plugins,
558558
if not viewer_task_permissions[key]:
559559
plugins_to_remove = []
560560
for plugin in plugins:
561-
if 'cfg' not in plugin:
562-
# skip plugin without cfg
563-
continue
564-
565561
if plugin.get("name") == key:
566562
plugins_to_remove.append(plugin)
567563
elif plugin.get("name") == "TaskButton" and \
568-
plugin["cfg"]["task"] + plugin["cfg"].get('mode', '') == key:
564+
plugin.get("cfg", {}).get("task", "") + plugin.get("cfg").get('mode', "") == key:
569565
plugins_to_remove.append(plugin)
570566

571-
if 'menuItems' in plugin['cfg']:
567+
if 'menuItems' in plugin.get('cfg', {}):
572568
self.__filter_config_items(
573569
plugin['cfg']['menuItems'], key
574570
)
575-
if 'toolbarItems' in plugin['cfg']:
571+
if 'toolbarItems' in plugin.get('cfg', {}):
576572
self.__filter_config_items(
577573
plugin['cfg']['toolbarItems'], key
578574
)

0 commit comments

Comments
 (0)