List all VMs for admins

This commit is contained in:
Nico Schottelius 2020-03-17 14:50:14 +01:00
parent 8634d667d5
commit 55bd42fe64

View file

@ -85,7 +85,12 @@ class VMProductViewSet(ProductViewSet):
serializer_class = VMProductSerializer serializer_class = VMProductSerializer
def get_queryset(self): def get_queryset(self):
return VMProduct.objects.filter(owner=self.request.user) if self.request.user.is_superuser:
obj = VMProduct.objects.all()
else:
obj = VMProduct.objects.filter(owner=self.request.user)
return obj
# Use a database transaction so that we do not get half-created structure # Use a database transaction so that we do not get half-created structure
# if something goes wrong. # if something goes wrong.