fix: ticket bug (#8584)

Co-authored-by: feng626 <1304903146@qq.com>
pull/8586/head
fit2bot 2022-07-13 15:48:55 +08:00 committed by GitHub
parent 11e538d417
commit 2abca39597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -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

View File

@ -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')),

View File

@ -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")