2019-05-20 11:39:53 +00:00
|
|
|
# coding: utf-8
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
from rest_framework import generics
|
|
|
|
|
2019-08-21 12:27:21 +00:00
|
|
|
from orgs.mixins.api import OrgBulkModelViewSet
|
2019-05-20 11:39:53 +00:00
|
|
|
from ..hands import IsOrgAdmin, IsAppUser
|
|
|
|
from ..models import RemoteApp
|
|
|
|
from ..serializers import RemoteAppSerializer, RemoteAppConnectionInfoSerializer
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'RemoteAppViewSet', 'RemoteAppConnectionInfoApi',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2019-08-21 12:27:21 +00:00
|
|
|
class RemoteAppViewSet(OrgBulkModelViewSet):
|
2019-05-20 11:39:53 +00:00
|
|
|
filter_fields = ('name',)
|
|
|
|
search_fields = filter_fields
|
|
|
|
permission_classes = (IsOrgAdmin,)
|
|
|
|
queryset = RemoteApp.objects.all()
|
|
|
|
serializer_class = RemoteAppSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteAppConnectionInfoApi(generics.RetrieveAPIView):
|
|
|
|
queryset = RemoteApp.objects.all()
|
|
|
|
permission_classes = (IsAppUser, )
|
|
|
|
serializer_class = RemoteAppConnectionInfoSerializer
|