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
|
|
|
|
from orgs.mixins 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 = [
|
|
|
|
'id', 'name', 'users', 'user_groups', 'remote_apps', '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']
|