2020-10-21 11:32:27 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
from common.permissions import IsOrgAdmin
|
2020-10-22 09:05:47 +00:00
|
|
|
from orgs.mixins.api import OrgBulkModelViewSet
|
2020-10-22 10:13:14 +00:00
|
|
|
from perms.models import ApplicationPermission
|
|
|
|
from perms import serializers
|
2020-10-21 11:32:27 +00:00
|
|
|
|
|
|
|
|
2020-10-22 09:05:47 +00:00
|
|
|
class ApplicationPermissionViewSet(OrgBulkModelViewSet):
|
2020-10-21 11:32:27 +00:00
|
|
|
"""
|
|
|
|
应用授权列表的增删改查API
|
|
|
|
"""
|
|
|
|
model = ApplicationPermission
|
|
|
|
serializer_class = serializers.ApplicationPermissionSerializer
|
2020-10-28 04:44:19 +00:00
|
|
|
filter_fields = ['name', 'category', 'type']
|
|
|
|
search_fields = filter_fields
|
2020-10-21 11:32:27 +00:00
|
|
|
permission_classes = (IsOrgAdmin,)
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
queryset = super().get_queryset().prefetch_related(
|
|
|
|
"applications", "users", "user_groups", "system_users"
|
|
|
|
)
|
|
|
|
return queryset
|
|
|
|
|