Commit 50d4f165 authored by Lukas Burgey's avatar Lukas Burgey
Browse files

Remove services property from user

It missbehaved in tests but not in a running setup.
parent b0454c61
......@@ -102,19 +102,6 @@ class User(AbstractUser):
'ssh_key': self.ssh_keys.all(),
}
# services returns all services this user has access to
@property
def services(self):
queryset = None
for vo in self.vos.all():
if queryset is None:
queryset = vo.services.all()
else:
queryset.union(vo.services.all())
return queryset
@property
def is_active_at_clients(self):
return self._is_active
......
......@@ -85,7 +85,7 @@ class ServiceListView(generics.ListAPIView):
serializer_class = ServiceSerializer
def get_queryset(self):
return self.request.user.services.all()
return Service.objects.filter(vos__user=self.request.user)
class ServiceView(generics.RetrieveAPIView):
......@@ -94,7 +94,7 @@ class ServiceView(generics.RetrieveAPIView):
def get_object(self):
return get_object_or_404(
self.request.user.services.all(),
Service.objects.filter(vos__user=self.request.user),
id=self.kwargs['id'],
)
......@@ -191,7 +191,7 @@ class DeploymentView(generics.RetrieveUpdateAPIView):
if self.kwargs['type'] == 'service':
try:
service = self.request.user.services.get(id=dep_id)
service = Service.objects.get(vos__user=self.request.user, id=dep_id)
dep, created = ServiceDeployment.objects.get_or_create(
user=self.request.user,
service=service,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment