From 9d98b0f00b0bdea14089718be7c680e490726639 Mon Sep 17 00:00:00 2001 From: Yuanmao Zhu Date: Thu, 3 Nov 2022 22:08:15 -0400 Subject: [PATCH 1/2] Only allow Application and Orderer types to update Channel Config Signed-off-by: Yuanmao Zhu --- src/api-engine/api/routes/channel/serializers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api-engine/api/routes/channel/serializers.py b/src/api-engine/api/routes/channel/serializers.py index ebc3eba21..e42d2699a 100644 --- a/src/api-engine/api/routes/channel/serializers.py +++ b/src/api-engine/api/routes/channel/serializers.py @@ -29,12 +29,18 @@ class ChannelIDSerializer(serializers.Serializer): id = serializers.UUIDField(help_text="Channel ID") +ORG_CHOICES = ( + ("Application", "Application"), + ("Orderer", "Orderer"), +) + + class ChannelUpdateSerializer(serializers.Serializer): msp_id = serializers.CharField( max_length=128, help_text="MSP ID of Organization") data = serializers.FileField(help_text="Channel config file") org_type = serializers.CharField( - max_length=24, help_text="Organization type") + max_length=24, help_text="Organization type", choices=ORG_CHOICES) class ChannelOrgListSerializer(serializers.Serializer): From f39ad3dc0c69ec62f1b44a39289fce70595c4dda Mon Sep 17 00:00:00 2001 From: Yuanmao Zhu Date: Fri, 4 Nov 2022 20:32:29 -0400 Subject: [PATCH 2/2] Change the field Signed-off-by: Yuanmao Zhu --- src/api-engine/api/routes/channel/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api-engine/api/routes/channel/serializers.py b/src/api-engine/api/routes/channel/serializers.py index e42d2699a..165c12b65 100644 --- a/src/api-engine/api/routes/channel/serializers.py +++ b/src/api-engine/api/routes/channel/serializers.py @@ -39,8 +39,8 @@ class ChannelUpdateSerializer(serializers.Serializer): msp_id = serializers.CharField( max_length=128, help_text="MSP ID of Organization") data = serializers.FileField(help_text="Channel config file") - org_type = serializers.CharField( - max_length=24, help_text="Organization type", choices=ORG_CHOICES) + org_type = serializers.ChoiceField( + help_text="Organization type", choices=ORG_CHOICES) class ChannelOrgListSerializer(serializers.Serializer):