• BaiJiangJie's avatar
    [Feature] 添加功能 RemoteApp (#2706) · 1eca5179
    BaiJiangJie authored
    * [Feature] RemoteApp添加Model
    
    * [Feature] RemoteApp添加ViewSet API
    
    * [Feature] RemoteApp添加获取connection-info API
    
    * [Feature] Perms模块修改目录结构
    
    * [Feature] RemoteAppPermission添加Model
    
    * [Feature] RemoteAppPermission添加ViewSet API
    
    * [Feature] RemoteAppPermission添加用户/用户组获取被授权的RemoteApp API
    
    * [Feature] RemoteAppPermission添加校验用户对RemoteApp的权限 API
    
    * [Feature] RemoteAppPermission添加获取用户授权的RemoteApp树 API
    
    * [Feature] RemoteAppPermission添加<添加/移除>所授权的<用户/RemoteApp> API
    
    * [Feature] RemoteApp添加创建、更新、详情、删除、用户RemoteApp等页面
    
    * [Feature] RemoteAppPermission添加创建、更新、详情、删除、授权用户、授权RemoteApp等页面
    
    * [Feature] RemoteApp从assets模块迁移到新添加的applications模块
    
    * [Feature] RemoteApp/RemoteAppPermission添加迁移文件
    
    * [Feature] RemoteApp/RemoteAppPermission修改小细节
    
    * [Feature] RemoteApp/RemoteAppPermission修改小细节2
    
    * [Feature] RemoteApp/RemoteAppPermission修改小细节3
    
    * [Feature] RemoteApp更新迁移文件
    
    * [Feature] RemoteApp/RemoteAppPermission添加翻译信息
    
    * [Feature] RemoteApp/RemoteAppPermission删除迁移文件
    
    * [Feature] RemoteApp/RemoteAppPermission添加迁移文件
    
    * [Feature] RemoteApp/RemoteAppPermission修改代码风格
    1eca5179
remote_app.py 861 Bytes
# coding: utf-8
#


from rest_framework import generics
from rest_framework.pagination import LimitOffsetPagination
from rest_framework_bulk import BulkModelViewSet

from ..hands import IsOrgAdmin, IsAppUser
from ..models import RemoteApp
from ..serializers import RemoteAppSerializer, RemoteAppConnectionInfoSerializer


__all__ = [
    'RemoteAppViewSet', 'RemoteAppConnectionInfoApi',
]


class RemoteAppViewSet(BulkModelViewSet):
    filter_fields = ('name',)
    search_fields = filter_fields
    permission_classes = (IsOrgAdmin,)
    queryset = RemoteApp.objects.all()
    serializer_class = RemoteAppSerializer
    pagination_class = LimitOffsetPagination


class RemoteAppConnectionInfoApi(generics.RetrieveAPIView):
    queryset = RemoteApp.objects.all()
    permission_classes = (IsAppUser, )
    serializer_class = RemoteAppConnectionInfoSerializer