uncloud-mravi/uncloud_django_based/uncloud/uncloud_net/views.py
Nico Schottelius 5d084a5716 phase in vpn
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
2020-04-03 19:27:49 +02:00

19 lines
504 B
Python

from django.shortcuts import render
from rest_framework import viewsets, permissions
from .models import *
from .serializers import *
class VPNProductViewSet(viewsets.ModelViewSet):
serializer_class = VPNProductSerializer
permission_classes = [permissions.IsAdminUser]
def get_queryset(self):
if self.request.user.is_superuser:
obj = VPNProduct.objects.all()
else:
obj = VPNProduct.objects.filter(owner=self.request.user)
return obj