mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-04-28 19:09:28 +00:00
Use a single query and collapse the if statements
This commit is contained in:
@@ -20,11 +20,10 @@ class StatusConsumer(AsyncWebsocketConsumer):
|
||||
if user.is_superuser or user.id == owner_id or user.id in users_can_view:
|
||||
return True
|
||||
|
||||
for group_id in groups_can_view:
|
||||
if await user.groups.filter(pk=group_id).aexists():
|
||||
return True
|
||||
|
||||
return False
|
||||
return (
|
||||
groups_can_view
|
||||
and await user.groups.filter(pk__in=groups_can_view).aexists()
|
||||
)
|
||||
|
||||
async def connect(self) -> None:
|
||||
if not self._authenticated():
|
||||
|
||||
Reference in New Issue
Block a user