fix - showing my devices

This commit is contained in:
2025-12-17 16:08:45 +03:30
parent 34aac97eaa
commit 6e0c7d14c9
7 changed files with 58 additions and 5 deletions

View File

@@ -113,12 +113,12 @@ class DeviceViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, AdminFi
organization = get_organization_by_user(request.user)
devices = self.get_queryset(
visibility_by_org_scope=True
) if organization.free_visibility_by_scope else self.get_queryset()
)
# filter by Jihad & admin of system
if organization.type.key == 'J':
queryset = devices.filter(assignment__client__organization__province=organization.province)
elif not organization.type.key == 'ADM':
elif organization.type.key == 'PSP':
queryset = apply_visibility_filter_by_org_type(devices, organization)
else:
queryset = devices