2019-05-20 11:39:53 +00:00
|
|
|
# coding: utf-8
|
|
|
|
#
|
|
|
|
|
|
|
|
from rest_framework import serializers
|
|
|
|
|
2019-06-19 08:45:14 +00:00
|
|
|
from common.serializers import AdaptedBulkListSerializer
|
2019-08-21 12:27:21 +00:00
|
|
|
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
|
2019-05-20 11:39:53 +00:00
|
|
|
from ..models import RemoteAppPermission
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
'RemoteAppPermissionSerializer',
|
|
|
|
'RemoteAppPermissionUpdateUserSerializer',
|
|
|
|
'RemoteAppPermissionUpdateRemoteAppSerializer',
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2019-06-19 08:45:14 +00:00
|
|
|
class RemoteAppPermissionSerializer(BulkOrgResourceModelSerializer):
|
2019-05-20 11:39:53 +00:00
|
|
|
class Meta:
|
|
|
|
model = RemoteAppPermission
|
2019-06-19 08:45:14 +00:00
|
|
|
list_serializer_class = AdaptedBulkListSerializer
|
2019-05-20 11:39:53 +00:00
|
|
|
fields = [
|
2019-09-12 10:25:22 +00:00
|
|
|
'id', 'name', 'users', 'user_groups', 'remote_apps', 'system_users',
|
|
|
|
'comment', 'is_active', 'date_start', 'date_expired', 'is_valid',
|
2019-06-19 08:45:14 +00:00
|
|
|
'created_by', 'date_created',
|
2019-05-20 11:39:53 +00:00
|
|
|
]
|
|
|
|
read_only_fields = ['created_by', 'date_created']
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteAppPermissionUpdateUserSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = RemoteAppPermission
|
|
|
|
fields = ['id', 'users']
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteAppPermissionUpdateRemoteAppSerializer(serializers.ModelSerializer):
|
|
|
|
class Meta:
|
|
|
|
model = RemoteAppPermission
|
|
|
|
fields = ['id', 'remote_apps']
|