fix(kfet/utils): Add sync_to_async
This commit is contained in:
parent
ee61ed97d2
commit
4f8813bc81
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import math
|
||||
|
||||
from asgiref.sync import sync_to_async
|
||||
from channels.generic.websocket import AsyncJsonWebsocketConsumer
|
||||
from django.core.cache import cache
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
|
@ -95,7 +96,7 @@ class PermConsumerMixin:
|
|||
"""Check permissions on connection."""
|
||||
self.user = self.scope["user"]
|
||||
|
||||
if self.user.has_perms(self.perms_connect):
|
||||
if await sync_to_async(self.user.has_perms)(self.perms_connect):
|
||||
await super().connect()
|
||||
else:
|
||||
await self.close()
|
||||
|
|
Loading…
Add table
Reference in a new issue