Skip to content

Commit

Permalink
don't filter topics if its explicit disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored and Marius Kriegerowski committed Apr 14, 2022
1 parent 33486d1 commit f71b99b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions amqtt/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,18 +725,23 @@ async def topic_filtering(self, session: Session, topic, action: Action):
:param action: What is being done with the topic? subscribe or publish
:return:
"""
topic_result = True
topic_plugins = None
topic_config = self.config.get("topic-check", None)
if topic_config and topic_config.get("enabled", False):
topic_plugins = topic_config.get("plugins", None)
# if enabled is not specified, all plugins will be used for topic filtering (backward compatibility)
if topic_config and "enabled" in topic_config:
if topic_config.get("enabled", False):
topic_plugins = topic_config.get("plugins", None)
else:
return topic_result

returns = await self.plugins_manager.map_plugin_coro(
"topic_filtering",
session=session,
topic=topic,
action=action,
filter_plugins=topic_plugins,
)
topic_result = True
if returns:
for plugin in returns:
res = returns[plugin]
Expand Down

0 comments on commit f71b99b

Please sign in to comment.