From d12ef62f781eaa4bdfba67245697702764ad6b35 Mon Sep 17 00:00:00 2001 From: rmanach Date: Mon, 18 Sep 2023 15:52:30 +0200 Subject: [PATCH] add channel permission manager --- deployment/channel.py | 6 ++++++ deployment/models.py | 1 - mumui/settings.py | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 deployment/channel.py diff --git a/deployment/channel.py b/deployment/channel.py new file mode 100644 index 0000000..65ee626 --- /dev/null +++ b/deployment/channel.py @@ -0,0 +1,6 @@ +from django_eventstream.channelmanager import DefaultChannelManager + + +class DeploymentChannelManager(DefaultChannelManager): + def can_read_channel(self, user, channel): + return user.is_authenticated diff --git a/deployment/models.py b/deployment/models.py index 3b3c19d..4c8ff2d 100644 --- a/deployment/models.py +++ b/deployment/models.py @@ -1,5 +1,4 @@ from enum import Enum -from uuid import uuid4 from django.contrib.auth.models import User diff --git a/mumui/settings.py b/mumui/settings.py index a3880c1..b4f892d 100644 --- a/mumui/settings.py +++ b/mumui/settings.py @@ -133,5 +133,6 @@ LOGIN_REDIRECT_URL = "home" LOGOUT_REDIRECT_URL = "home" GRIP_URL = "http://pushpin:5561" +EVENTSTREAM_CHANNELMANAGER_CLASS = "deployment.channel.DeploymentChannelManager" CSRF_TRUSTED_ORIGINS = ["http://localhost:8080"]