From b60e6933dd69cd2cb19fe3c2f9a6f06f58c55c3e Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Thu, 30 Nov 2023 12:12:16 -0500 Subject: [PATCH] Add broadcast to non-admin function --- app/classes/shared/websocket_manager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/classes/shared/websocket_manager.py b/app/classes/shared/websocket_manager.py index b840ba36..7cda296d 100644 --- a/app/classes/shared/websocket_manager.py +++ b/app/classes/shared/websocket_manager.py @@ -43,6 +43,14 @@ class WebSocketManager(metaclass=Singleton): self.broadcast_with_fn(filter_fn, event_type, data) + def broadcast_to_non_admins(self, event_type: str, data): + def filter_fn(client): + if str(client.get_user_id()) not in str(HelperUsers.get_super_user_list()): + return True + return False + + self.broadcast_with_fn(filter_fn, event_type, data) + def broadcast_page(self, page: str, event_type: str, data): def filter_fn(client): return client.page == page