From 142de460b96470042245aa47ce46e9528197e11f Mon Sep 17 00:00:00 2001 From: mattieserver <3049868+mattieserver@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:01:40 +0200 Subject: [PATCH] added restrict to query (#522) --- netbox_topology_views/api/views.py | 2 +- netbox_topology_views/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox_topology_views/api/views.py b/netbox_topology_views/api/views.py index 6741dd8..91b51bf 100644 --- a/netbox_topology_views/api/views.py +++ b/netbox_topology_views/api/views.py @@ -98,7 +98,7 @@ class ExportTopoToXML(PermissionRequiredMixin, ViewSet): def list(self, request): self.filterset = DeviceFilterSet - self.queryset = Device.objects.all().select_related( + self.queryset = Device.objects.restrict(request.user, 'view').select_related( "device_type", "role" ) self.queryset = self.filterset(request.GET, self.queryset).qs diff --git a/netbox_topology_views/views.py b/netbox_topology_views/views.py index a2b4978..b347e2a 100644 --- a/netbox_topology_views/views.py +++ b/netbox_topology_views/views.py @@ -697,7 +697,7 @@ class TopologyHomeView(PermissionRequiredMixin, View): def get(self, request): self.filterset = DeviceFilterSet - self.queryset = Device.objects.all().select_related( + self.queryset = Device.objects.restrict(request.user, 'view').select_related( "device_type", "role" ) self.queryset = self.filterset(request.GET, self.queryset).qs