forked from uncloud/uncloud
5d084a5716
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
19 lines
504 B
Python
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
|