Skip to content

Commit 53b1133

Browse files
committed
fix TopicTabooPlugin for anonymous users
Thanks to https://github.com/JNevrly See also njouanin/hbmqtt#151
1 parent ef3c565 commit 53b1133

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

hbmqtt/plugins/topic_checking.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ async def topic_filtering(self, *args, **kwargs):
2727
if filter_result:
2828
session = kwargs.get('session', None)
2929
topic = kwargs.get('topic', None)
30-
if topic:
31-
if session.username != 'admin' and topic in self._taboo:
32-
return False
30+
if session.username and session.username == 'admin':
3331
return True
34-
else:
32+
if topic and topic in self._taboo:
3533
return False
34+
return True
3635
return filter_result
3736

3837

0 commit comments

Comments
 (0)