2019-05-20 11:39:53 +00:00
|
|
|
# coding: utf-8
|
|
|
|
#
|
|
|
|
|
2019-08-21 12:27:21 +00:00
|
|
|
from orgs.mixins.api import OrgBulkModelViewSet
|
2019-10-18 07:05:45 +00:00
|
|
|
from orgs.mixins import generics
|
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-10-18 07:05:45 +00:00
|
|
|
model = RemoteApp
|
2019-05-20 11:39:53 +00:00
|
|
|
filter_fields = ('name',)
|
|
|
|
search_fields = filter_fields
|
|
|
|
permission_classes = (IsOrgAdmin,)
|
|
|
|
serializer_class = RemoteAppSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteAppConnectionInfoApi(generics.RetrieveAPIView):
|
2019-10-18 07:05:45 +00:00
|
|
|
model = RemoteApp
|
2019-05-20 11:39:53 +00:00
|
|
|
permission_classes = (IsAppUser, )
|
|
|
|
serializer_class = RemoteAppConnectionInfoSerializer
|