diff --git a/apps/tickets/api/ticket.py b/apps/tickets/api/ticket.py index ee6b76534..1df3506c1 100644 --- a/apps/tickets/api/ticket.py +++ b/apps/tickets/api/ticket.py @@ -29,7 +29,8 @@ class TicketViewSet(CommonApiMixin, viewsets.ModelViewSet): serializer_class = serializers.TicketDisplaySerializer serializer_classes = { 'list': serializers.TicketListSerializer, - 'open': serializers.TicketApplySerializer + 'open': serializers.TicketApplySerializer, + 'approve': serializers.TicketApproveSerializer } model = Ticket perm_model = Ticket diff --git a/apps/tickets/migrations/0016_auto_20220609_1758.py b/apps/tickets/migrations/0016_auto_20220609_1758.py index ecf1c85fd..e5e6f61ce 100644 --- a/apps/tickets/migrations/0016_auto_20220609_1758.py +++ b/apps/tickets/migrations/0016_auto_20220609_1758.py @@ -139,7 +139,7 @@ class Migration(migrations.Migration): ('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')), - ('apply_permission_name', models.CharField(max_length=128, verbose_name='Apply name')), + ('apply_permission_name', models.CharField(max_length=128, verbose_name='Permission name')), ('apply_actions', models.IntegerField( choices=[(255, 'All'), (1, 'Connect'), (2, 'Upload file'), (4, 'Download file'), (6, 'Upload download'), (8, 'Clipboard copy'), (16, 'Clipboard paste'), @@ -162,7 +162,7 @@ class Migration(migrations.Migration): ('ticket_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='tickets.ticket')), - ('apply_permission_name', models.CharField(max_length=128, verbose_name='Apply name')), + ('apply_permission_name', models.CharField(max_length=128, verbose_name='Permission name')), ('apply_category', models.CharField(choices=[('db', 'Database'), ('remote_app', 'Remote app'), ('cloud', 'Cloud')], max_length=16, verbose_name='Category')), diff --git a/apps/tickets/serializers/ticket/ticket.py b/apps/tickets/serializers/ticket/ticket.py index facf3fcec..a0760e4d0 100644 --- a/apps/tickets/serializers/ticket/ticket.py +++ b/apps/tickets/serializers/ticket/ticket.py @@ -9,7 +9,7 @@ from tickets.models import Ticket, TicketFlow from tickets.const import TicketType __all__ = [ - 'TicketDisplaySerializer', 'TicketApplySerializer', 'TicketListSerializer' + 'TicketDisplaySerializer', 'TicketApplySerializer', 'TicketListSerializer', 'TicketApproveSerializer' ] @@ -59,6 +59,13 @@ class TicketDisplaySerializer(TicketSerializer): read_only_fields = fields +class TicketApproveSerializer(TicketSerializer): + class Meta: + model = Ticket + fields = TicketSerializer.Meta.fields + read_only_fields = fields + + class TicketApplySerializer(TicketSerializer): org_id = serializers.CharField( required=True, max_length=36, allow_blank=True, label=_("Organization")