diff --git a/passbook/flows/transfer/exporter.py b/passbook/flows/transfer/exporter.py index f0fa3bad3..9617e4286 100644 --- a/passbook/flows/transfer/exporter.py +++ b/passbook/flows/transfer/exporter.py @@ -52,7 +52,7 @@ class FlowExporter: yield FlowBundleEntry.from_model(policy) bindings = PolicyBinding.objects.filter(target__in=pbm_uuids).select_related() for binding in bindings: - yield FlowBundleEntry.from_model(binding) + yield FlowBundleEntry.from_model(binding, "policy", "target", "order") def walk_stage_prompts(self) -> Iterator[FlowBundleEntry]: """Walk over all prompts associated with any PromptStages""" diff --git a/passbook/policies/api.py b/passbook/policies/api.py index 27fd129ac..f2b272c57 100644 --- a/passbook/policies/api.py +++ b/passbook/policies/api.py @@ -12,7 +12,7 @@ class PolicyBindingSerializer(ModelSerializer): class Meta: model = PolicyBinding - fields = ["policy", "target", "enabled", "order", "timeout"] + fields = ["pk", "policy", "target", "enabled", "order", "timeout"] class PolicyBindingViewSet(ModelViewSet): diff --git a/passbook/policies/models.py b/passbook/policies/models.py index 6933af07b..f3f029777 100644 --- a/passbook/policies/models.py +++ b/passbook/policies/models.py @@ -44,7 +44,7 @@ class PolicyBinding(SerializerModel): enabled = models.BooleanField(default=True) policy = InheritanceForeignKey("Policy", on_delete=models.CASCADE, related_name="+") - target = models.ForeignKey( + target = InheritanceForeignKey( PolicyBindingModel, on_delete=models.CASCADE, related_name="+" ) negate = models.BooleanField( diff --git a/swagger.yaml b/swagger.yaml index 0aafac34a..3c7ff6776 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -6243,6 +6243,11 @@ definitions: - order type: object properties: + pk: + title: Policy binding uuid + type: string + format: uuid + readOnly: true policy: title: Policy type: string