From ef021495ef541aa6cfc6798ea255ffbf4234917d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 20 Oct 2020 15:41:50 +0200 Subject: [PATCH] flows: revert evaluate_on_call rename for backwards compatibility --- docs/flow/examples/enrollment-2-stage.json | 8 ++++---- docs/flow/examples/enrollment-email-verification.json | 10 +++++----- docs/flow/examples/login-2fa.json | 8 ++++---- docs/flow/examples/login-conditional-captcha.json | 8 ++++---- docs/flow/examples/recovery-email-verification.json | 10 +++++----- docs/flow/examples/unenrollment.json | 2 +- passbook/flows/api.py | 2 +- passbook/flows/forms.py | 2 +- .../0015_flowstagebinding_evaluate_on_plan.py | 7 +------ passbook/flows/models.py | 2 +- passbook/flows/planner.py | 2 +- passbook/flows/tests/test_planner.py | 4 ++-- passbook/flows/tests/test_views.py | 8 ++++---- swagger.yaml | 4 ++-- 14 files changed, 36 insertions(+), 41 deletions(-) diff --git a/docs/flow/examples/enrollment-2-stage.json b/docs/flow/examples/enrollment-2-stage.json index 70f30f851..e8e4372c8 100644 --- a/docs/flow/examples/enrollment-2-stage.json +++ b/docs/flow/examples/enrollment-2-stage.json @@ -137,7 +137,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -149,7 +149,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -161,7 +161,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -173,7 +173,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } } ] diff --git a/docs/flow/examples/enrollment-email-verification.json b/docs/flow/examples/enrollment-email-verification.json index 3af4321fc..299ad2d49 100644 --- a/docs/flow/examples/enrollment-email-verification.json +++ b/docs/flow/examples/enrollment-email-verification.json @@ -156,7 +156,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -168,7 +168,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -180,7 +180,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -192,7 +192,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -204,7 +204,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } } ] diff --git a/docs/flow/examples/login-2fa.json b/docs/flow/examples/login-2fa.json index d096b7fd1..a1b9637a5 100644 --- a/docs/flow/examples/login-2fa.json +++ b/docs/flow/examples/login-2fa.json @@ -68,7 +68,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -80,7 +80,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -92,7 +92,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -104,7 +104,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } } ] diff --git a/docs/flow/examples/login-conditional-captcha.json b/docs/flow/examples/login-conditional-captcha.json index f4f9e779c..f498b2cfb 100644 --- a/docs/flow/examples/login-conditional-captcha.json +++ b/docs/flow/examples/login-conditional-captcha.json @@ -71,7 +71,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -83,7 +83,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -96,7 +96,7 @@ "model": "passbook_flows.flowstagebinding", "attrs": { "evaluate_on_plan": false, - "evaluate_on_call": true + "re_evaluate_policies": true } }, { @@ -108,7 +108,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { diff --git a/docs/flow/examples/recovery-email-verification.json b/docs/flow/examples/recovery-email-verification.json index 1572b7f61..e3c849263 100644 --- a/docs/flow/examples/recovery-email-verification.json +++ b/docs/flow/examples/recovery-email-verification.json @@ -130,7 +130,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -142,7 +142,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -154,7 +154,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -166,7 +166,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } }, { @@ -178,7 +178,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } } ] diff --git a/docs/flow/examples/unenrollment.json b/docs/flow/examples/unenrollment.json index 978cf1a0f..b2fd76f21 100644 --- a/docs/flow/examples/unenrollment.json +++ b/docs/flow/examples/unenrollment.json @@ -30,7 +30,7 @@ }, "model": "passbook_flows.flowstagebinding", "attrs": { - "evaluate_on_call": false + "re_evaluate_policies": false } } ] diff --git a/passbook/flows/api.py b/passbook/flows/api.py index 9e91a4684..93e6f6d67 100644 --- a/passbook/flows/api.py +++ b/passbook/flows/api.py @@ -32,7 +32,7 @@ class FlowStageBindingSerializer(ModelSerializer): "target", "stage", "evaluate_on_plan", - "evaluate_on_call", + "re_evaluate_policies", "order", "policies", ] diff --git a/passbook/flows/forms.py b/passbook/flows/forms.py index 015560e1d..bc2f01c74 100644 --- a/passbook/flows/forms.py +++ b/passbook/flows/forms.py @@ -51,7 +51,7 @@ class FlowStageBindingForm(forms.ModelForm): "target", "stage", "evaluate_on_plan", - "evaluate_on_call", + "re_evaluate_policies", "order", ] widgets = { diff --git a/passbook/flows/migrations/0015_flowstagebinding_evaluate_on_plan.py b/passbook/flows/migrations/0015_flowstagebinding_evaluate_on_plan.py index 1ac4babe7..f494d709c 100644 --- a/passbook/flows/migrations/0015_flowstagebinding_evaluate_on_plan.py +++ b/passbook/flows/migrations/0015_flowstagebinding_evaluate_on_plan.py @@ -10,14 +10,9 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RenameField( - model_name="flowstagebinding", - old_name="re_evaluate_policies", - new_name="evaluate_on_call", - ), migrations.AlterField( model_name="flowstagebinding", - name="evaluate_on_call", + name="re_evaluate_policies", field=models.BooleanField( default=False, help_text="Evaluate policies when the Stage is present to the user.", diff --git a/passbook/flows/models.py b/passbook/flows/models.py index 35dbf0103..47f48df75 100644 --- a/passbook/flows/models.py +++ b/passbook/flows/models.py @@ -163,7 +163,7 @@ class FlowStageBinding(SerializerModel, PolicyBindingModel): ) ), ) - evaluate_on_call = models.BooleanField( + re_evaluate_policies = models.BooleanField( default=False, help_text=_("Evaluate policies when the Stage is present to the user."), ) diff --git a/passbook/flows/planner.py b/passbook/flows/planner.py index 797409508..f6913e902 100644 --- a/passbook/flows/planner.py +++ b/passbook/flows/planner.py @@ -185,7 +185,7 @@ class FlowPlanner: stage=binding.stage, flow=self.flow, ) - if binding.evaluate_on_call and stage: + if binding.re_evaluate_policies and stage: LOGGER.debug( "f(plan): Stage has re-evaluate marker", stage=binding.stage, diff --git a/passbook/flows/tests/test_planner.py b/passbook/flows/tests/test_planner.py index f9d583660..eaa5f3864 100644 --- a/passbook/flows/tests/test_planner.py +++ b/passbook/flows/tests/test_planner.py @@ -132,7 +132,7 @@ class TestFlowPlanner(TestCase): target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0, - evaluate_on_call=True, + re_evaluate_policies=True, ) request = self.request_factory.get( @@ -161,7 +161,7 @@ class TestFlowPlanner(TestCase): target=flow, stage=DummyStage.objects.create(name="dummy2"), order=1, - evaluate_on_call=True, + re_evaluate_policies=True, ) PolicyBinding.objects.create(policy=false_policy, target=binding2, order=0) diff --git a/passbook/flows/tests/test_views.py b/passbook/flows/tests/test_views.py index 9452a75f5..7471d17ca 100644 --- a/passbook/flows/tests/test_views.py +++ b/passbook/flows/tests/test_views.py @@ -174,7 +174,7 @@ class TestFlowExecutor(TestCase): target=flow, stage=DummyStage.objects.create(name="dummy2"), order=1, - evaluate_on_call=True, + re_evaluate_policies=True, ) PolicyBinding.objects.create(policy=false_policy, target=binding2, order=0) @@ -225,7 +225,7 @@ class TestFlowExecutor(TestCase): target=flow, stage=DummyStage.objects.create(name="dummy2"), order=1, - evaluate_on_call=True, + re_evaluate_policies=True, ) binding3 = FlowStageBinding.objects.create( target=flow, stage=DummyStage.objects.create(name="dummy3"), order=2 @@ -292,13 +292,13 @@ class TestFlowExecutor(TestCase): target=flow, stage=DummyStage.objects.create(name="dummy2"), order=1, - evaluate_on_call=True, + re_evaluate_policies=True, ) binding3 = FlowStageBinding.objects.create( target=flow, stage=DummyStage.objects.create(name="dummy3"), order=2, - evaluate_on_call=True, + re_evaluate_policies=True, ) binding4 = FlowStageBinding.objects.create( target=flow, stage=DummyStage.objects.create(name="dummy4"), order=2 diff --git a/swagger.yaml b/swagger.yaml index 20afa2d81..6ae3d39c7 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -838,7 +838,7 @@ paths: description: '' required: false type: string - - name: evaluate_on_call + - name: re_evaluate_policies in: query description: '' required: false @@ -6347,7 +6347,7 @@ definitions: description: Evaluate policies during the Flow planning process. Disable this for input-based policies. type: boolean - evaluate_on_call: + re_evaluate_policies: title: Evaluate on call description: Evaluate policies when the Stage is present to the user. type: boolean