Skip to content
Snippets Groups Projects
Commit 772815c2 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

temporarily allow any use to get updates via websocket. No secrets are shared.

parent f5ff1f3f
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ class TMSSWebSocket(WebSocket):
self.authenticated = False
self.user = None
# JS 2023-08-10: TODO: fix this!
# JS 2023-08-11: TODO: fix this! For now we want all users to get updates.
self.authenticated = True
def handleMessage(self):
......@@ -144,7 +144,14 @@ class TMSSEventMessageHandlerForWebsocket(TMSSEventMessageHandler):
logger.debug('Checking which of these users should receive websocket update for obj=%s: %s' % (obj, [ws.user for ws in list(self._ws_server.connections.values())]))
for ws in list(self._ws_server.connections.values()):
if ws.authenticated: # Check user permissions for the object
user = User.objects.get(username=ws.user)
# JS 2023-08-11: TODO: fix this! For now we want all users to get updates.
auth_clients.append(ws)
continue
user = User.objects.filter(username=ws.user).first()
if user is None:
continue
if user.is_superuser:
logger.debug('User=%s is superuser and will receive websocket update for obj=%s' % (user, obj))
auth_clients.append(ws)
......
......@@ -155,12 +155,12 @@ class TestSubtaskSchedulingService(unittest.TestCase):
self.msg_queue.popleft()
time.sleep(1) # ugly.... but we have to wait for (more) incoming lingering messages
# JS 2023-08-11: TODO: fix this! For now we want all users to get updates.
# Test creations
# Test reservation create not authorised to receive messages
reservation = self.test_data_creator.post_data_and_get_response_as_json_object(
self.test_data_creator.Reservation(), '/reservation/')
# No need to assert, the WS client just should not receive any messages. Otherwise, the subsequent asserts would fail.
# # Test reservation create not authorised to receive messages
# reservation = self.test_data_creator.post_data_and_get_response_as_json_object(
# self.test_data_creator.Reservation(), '/reservation/')
# # No need to assert, the WS client just should not receive any messages. Otherwise, the subsequent asserts would fail.
# Test scheduling_unit_draft create
su_draft = self.test_data_creator.post_data_and_get_response_as_json_object(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment