implement some auth for MeshUIConsumer
This commit is contained in:
parent
88d6f07eaf
commit
394450f4a3
4 changed files with 30 additions and 9 deletions
|
@ -5,6 +5,7 @@ from functools import cached_property
|
|||
|
||||
from asgiref.sync import async_to_sync
|
||||
from channels.db import database_sync_to_async
|
||||
from channels.exceptions import DenyConnection
|
||||
from channels.generic.websocket import AsyncJsonWebsocketConsumer, AsyncWebsocketConsumer
|
||||
from django.db import transaction
|
||||
from django.utils import timezone
|
||||
|
@ -347,7 +348,8 @@ class MeshUIConsumer(AsyncJsonWebsocketConsumer):
|
|||
self.msg_received_filter = {}
|
||||
|
||||
async def connect(self):
|
||||
# todo: auth
|
||||
if not self.scope["user_permisions"].mesh_control:
|
||||
raise DenyConnection
|
||||
await self.accept()
|
||||
|
||||
async def receive_json(self, content, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue