diff --git a/e2e/test_flows_enroll.py b/e2e/test_flows_enroll.py
index 0fec78d3f..bbfb53047 100644
--- a/e2e/test_flows_enroll.py
+++ b/e2e/test_flows_enroll.py
@@ -105,10 +105,10 @@ class TestFlowsEnroll(SeleniumTestCase):
ident_stage.enrollment_flow = flow
ident_stage.save()
- FlowStageBinding.objects.create(flow=flow, stage=first_stage, order=0)
- FlowStageBinding.objects.create(flow=flow, stage=second_stage, order=1)
- FlowStageBinding.objects.create(flow=flow, stage=user_write, order=2)
- FlowStageBinding.objects.create(flow=flow, stage=user_login, order=3)
+ FlowStageBinding.objects.create(target=flow, stage=first_stage, order=0)
+ FlowStageBinding.objects.create(target=flow, stage=second_stage, order=1)
+ FlowStageBinding.objects.create(target=flow, stage=user_write, order=2)
+ FlowStageBinding.objects.create(target=flow, stage=user_login, order=3)
self.driver.get(self.live_server_url)
self.wait.until(
@@ -206,11 +206,11 @@ class TestFlowsEnroll(SeleniumTestCase):
ident_stage.enrollment_flow = flow
ident_stage.save()
- FlowStageBinding.objects.create(flow=flow, stage=first_stage, order=0)
- FlowStageBinding.objects.create(flow=flow, stage=second_stage, order=1)
- FlowStageBinding.objects.create(flow=flow, stage=user_write, order=2)
- FlowStageBinding.objects.create(flow=flow, stage=email_stage, order=3)
- FlowStageBinding.objects.create(flow=flow, stage=user_login, order=4)
+ FlowStageBinding.objects.create(target=flow, stage=first_stage, order=0)
+ FlowStageBinding.objects.create(target=flow, stage=second_stage, order=1)
+ FlowStageBinding.objects.create(target=flow, stage=user_write, order=2)
+ FlowStageBinding.objects.create(target=flow, stage=email_stage, order=3)
+ FlowStageBinding.objects.create(target=flow, stage=user_login, order=4)
self.driver.get(self.live_server_url)
self.driver.find_element(By.CSS_SELECTOR, "[role=enroll]").click()
diff --git a/passbook/admin/templates/administration/stage_binding/list.html b/passbook/admin/templates/administration/stage_binding/list.html
index a4342cf0e..da1e0db3d 100644
--- a/passbook/admin/templates/administration/stage_binding/list.html
+++ b/passbook/admin/templates/administration/stage_binding/list.html
@@ -35,7 +35,7 @@
- {% regroup object_list by flow as grouped_bindings %}
+ {% regroup object_list by target as grouped_bindings %}
{% for flow in grouped_bindings %}
@@ -56,9 +56,9 @@
|
- {{ binding.flow.slug }}
+ {{ binding.target.slug }}
- {{ binding.flow.name }}
+ {{ binding.target.name }}
|
diff --git a/passbook/admin/views/stages_bindings.py b/passbook/admin/views/stages_bindings.py
index cfe86816c..c673b1aa9 100644
--- a/passbook/admin/views/stages_bindings.py
+++ b/passbook/admin/views/stages_bindings.py
@@ -21,7 +21,7 @@ class StageBindingListView(LoginRequiredMixin, PermissionListMixin, ListView):
model = FlowStageBinding
permission_required = "passbook_flows.view_flowstagebinding"
paginate_by = 10
- ordering = ["flow", "order"]
+ ordering = ["target", "order"]
template_name = "administration/stage_binding/list.html"
diff --git a/passbook/flows/api.py b/passbook/flows/api.py
index 6b54a6da5..e270628f5 100644
--- a/passbook/flows/api.py
+++ b/passbook/flows/api.py
@@ -27,7 +27,7 @@ class FlowStageBindingSerializer(ModelSerializer):
class Meta:
model = FlowStageBinding
- fields = ["pk", "flow", "stage", "re_evaluate_policies", "order", "policies"]
+ fields = ["pk", "target", "stage", "re_evaluate_policies", "order", "policies"]
class FlowStageBindingViewSet(ModelViewSet):
diff --git a/passbook/flows/forms.py b/passbook/flows/forms.py
index 8c8d5bdc6..83c356bb9 100644
--- a/passbook/flows/forms.py
+++ b/passbook/flows/forms.py
@@ -39,7 +39,7 @@ class FlowStageBindingForm(forms.ModelForm):
model = FlowStageBinding
fields = [
- "flow",
+ "target",
"stage",
"re_evaluate_policies",
"order",
diff --git a/passbook/flows/migrations/0003_auto_20200523_1133.py b/passbook/flows/migrations/0003_auto_20200523_1133.py
index 951835239..4ef2f1880 100644
--- a/passbook/flows/migrations/0003_auto_20200523_1133.py
+++ b/passbook/flows/migrations/0003_auto_20200523_1133.py
@@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0002_default_flows"),
+ ("passbook_flows", "0001_initial"),
]
operations = [
diff --git a/passbook/flows/migrations/0006_auto_20200629_0857.py b/passbook/flows/migrations/0006_auto_20200629_0857.py
index 2a917c35f..b1799cd5f 100644
--- a/passbook/flows/migrations/0006_auto_20200629_0857.py
+++ b/passbook/flows/migrations/0006_auto_20200629_0857.py
@@ -6,7 +6,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0005_provider_flows"),
+ ("passbook_flows", "0003_auto_20200523_1133"),
]
operations = [
diff --git a/passbook/flows/migrations/0007_auto_20200703_2059.py b/passbook/flows/migrations/0007_auto_20200703_2059.py
new file mode 100644
index 000000000..de86d302d
--- /dev/null
+++ b/passbook/flows/migrations/0007_auto_20200703_2059.py
@@ -0,0 +1,42 @@
+# Generated by Django 3.0.7 on 2020-07-03 20:59
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("passbook_policies", "0002_auto_20200528_1647"),
+ ("passbook_flows", "0006_auto_20200629_0857"),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name="flowstagebinding",
+ options={
+ "ordering": ["order", "target"],
+ "verbose_name": "Flow Stage Binding",
+ "verbose_name_plural": "Flow Stage Bindings",
+ },
+ ),
+ migrations.RenameField(
+ model_name="flowstagebinding", old_name="flow", new_name="target",
+ ),
+ migrations.RenameField(
+ model_name="flow", old_name="pbm", new_name="policybindingmodel_ptr",
+ ),
+ migrations.AlterUniqueTogether(
+ name="flowstagebinding", unique_together={("target", "stage", "order")},
+ ),
+ migrations.AlterField(
+ model_name="flow",
+ name="policybindingmodel_ptr",
+ field=models.OneToOneField(
+ auto_created=True,
+ on_delete=django.db.models.deletion.CASCADE,
+ parent_link=True,
+ to="passbook_policies.PolicyBindingModel",
+ ),
+ ),
+ ]
diff --git a/passbook/flows/migrations/0002_default_flows.py b/passbook/flows/migrations/0008_default_flows.py
similarity index 92%
rename from passbook/flows/migrations/0002_default_flows.py
rename to passbook/flows/migrations/0008_default_flows.py
index 15b45625c..6494d0cc8 100644
--- a/passbook/flows/migrations/0002_default_flows.py
+++ b/passbook/flows/migrations/0008_default_flows.py
@@ -45,13 +45,13 @@ def create_default_authentication_flow(
defaults={"name": "Welcome to passbook!",},
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=identification_stage, defaults={"order": 0,},
+ target=flow, stage=identification_stage, defaults={"order": 0,},
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=password_stage, defaults={"order": 1,},
+ target=flow, stage=password_stage, defaults={"order": 1,},
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=login_stage, defaults={"order": 2,},
+ target=flow, stage=login_stage, defaults={"order": 2,},
)
@@ -73,7 +73,7 @@ def create_default_invalidation_flow(
defaults={"name": "Logout",},
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow,
+ target=flow,
stage=UserLogoutStage.objects.using(db_alias).first(),
defaults={"order": 0,},
)
@@ -82,7 +82,7 @@ def create_default_invalidation_flow(
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0001_initial"),
+ ("passbook_flows", "0007_auto_20200703_2059"),
("passbook_stages_user_login", "0001_initial"),
("passbook_stages_user_logout", "0001_initial"),
("passbook_stages_password", "0001_initial"),
diff --git a/passbook/flows/migrations/0004_source_flows.py b/passbook/flows/migrations/0009_source_flows.py
similarity index 94%
rename from passbook/flows/migrations/0004_source_flows.py
rename to passbook/flows/migrations/0009_source_flows.py
index 933f986b5..6c0e1fcb3 100644
--- a/passbook/flows/migrations/0004_source_flows.py
+++ b/passbook/flows/migrations/0009_source_flows.py
@@ -80,17 +80,17 @@ def create_default_source_enrollment_flow(
)
binding, _ = FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=prompt_stage, defaults={"order": 0}
+ target=flow, stage=prompt_stage, defaults={"order": 0}
)
PolicyBinding.objects.using(db_alias).update_or_create(
policy=prompt_policy, target=binding, defaults={"order": 0}
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=user_write, defaults={"order": 1}
+ target=flow, stage=user_write, defaults={"order": 1}
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=user_login, defaults={"order": 2}
+ target=flow, stage=user_login, defaults={"order": 2}
)
@@ -129,14 +129,14 @@ def create_default_source_authentication_flow(
name="default-source-authentication-login"
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=user_login, defaults={"order": 0}
+ target=flow, stage=user_login, defaults={"order": 0}
)
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0003_auto_20200523_1133"),
+ ("passbook_flows", "0008_default_flows"),
("passbook_policies", "0001_initial"),
("passbook_policies_expression", "0001_initial"),
("passbook_stages_prompt", "0001_initial"),
diff --git a/passbook/flows/migrations/0005_provider_flows.py b/passbook/flows/migrations/0010_provider_flows.py
similarity index 93%
rename from passbook/flows/migrations/0005_provider_flows.py
rename to passbook/flows/migrations/0010_provider_flows.py
index 764bf826d..e8b4bc28f 100644
--- a/passbook/flows/migrations/0005_provider_flows.py
+++ b/passbook/flows/migrations/0010_provider_flows.py
@@ -34,14 +34,14 @@ def create_default_provider_authorization_flow(
name="default-provider-authorization-consent"
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=stage, defaults={"order": 0}
+ target=flow, stage=stage, defaults={"order": 0}
)
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0004_source_flows"),
+ ("passbook_flows", "0009_source_flows"),
("passbook_stages_consent", "0001_initial"),
]
diff --git a/passbook/flows/models.py b/passbook/flows/models.py
index 1f71130a9..a48dc5880 100644
--- a/passbook/flows/models.py
+++ b/passbook/flows/models.py
@@ -79,10 +79,6 @@ class Flow(PolicyBindingModel):
stages = models.ManyToManyField(Stage, through="FlowStageBinding", blank=True)
- pbm = models.OneToOneField(
- PolicyBindingModel, parent_link=True, on_delete=models.CASCADE, related_name="+"
- )
-
@staticmethod
def with_policy(request: HttpRequest, **flow_filter) -> Optional["Flow"]:
"""Get a Flow by `**flow_filter` and check if the request from `request` can access it."""
@@ -123,7 +119,7 @@ class FlowStageBinding(PolicyBindingModel):
fsb_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4)
- flow = models.ForeignKey("Flow", on_delete=models.CASCADE)
+ target = models.ForeignKey("Flow", on_delete=models.CASCADE)
stage = models.ForeignKey(Stage, on_delete=models.CASCADE)
re_evaluate_policies = models.BooleanField(
@@ -138,12 +134,12 @@ class FlowStageBinding(PolicyBindingModel):
objects = InheritanceManager()
def __str__(self) -> str:
- return f"Flow Stage Binding #{self.order} {self.flow} -> {self.stage}"
+ return f"Flow Binding {self.target} -> {self.stage}"
class Meta:
- ordering = ["order", "flow"]
+ ordering = ["order", "target"]
verbose_name = _("Flow Stage Binding")
verbose_name_plural = _("Flow Stage Bindings")
- unique_together = (("flow", "stage", "order"),)
+ unique_together = (("target", "stage", "order"),)
diff --git a/passbook/flows/planner.py b/passbook/flows/planner.py
index aee17ecd9..64d0f89f4 100644
--- a/passbook/flows/planner.py
+++ b/passbook/flows/planner.py
@@ -146,7 +146,7 @@ class FlowPlanner:
.select_related()
):
binding: FlowStageBinding = stage.flowstagebinding_set.get(
- flow__pk=self.flow.pk
+ target__pk=self.flow.pk
)
engine = PolicyEngine(binding, user, request)
engine.request.context = plan.context
diff --git a/passbook/flows/signals.py b/passbook/flows/signals.py
index 59c1bbc0d..d6c275b26 100644
--- a/passbook/flows/signals.py
+++ b/passbook/flows/signals.py
@@ -25,13 +25,13 @@ def invalidate_flow_cache(sender, instance, **_):
total = delete_cache_prefix(f"{cache_key(instance)}*")
LOGGER.debug("Invalidating Flow cache", flow=instance, len=total)
if isinstance(instance, FlowStageBinding):
- total = delete_cache_prefix(f"{cache_key(instance.flow)}*")
+ total = delete_cache_prefix(f"{cache_key(instance.target)}*")
LOGGER.debug(
"Invalidating Flow cache from FlowStageBinding", binding=instance, len=total
)
if isinstance(instance, Stage):
total = 0
for binding in FlowStageBinding.objects.filter(stage=instance):
- prefix = cache_key(binding.flow)
+ prefix = cache_key(binding.target)
total += delete_cache_prefix(f"{prefix}*")
LOGGER.debug("Invalidating Flow cache from Stage", stage=instance, len=total)
diff --git a/passbook/flows/tests/test_planner.py b/passbook/flows/tests/test_planner.py
index 8c65e6636..1f9a680ce 100644
--- a/passbook/flows/tests/test_planner.py
+++ b/passbook/flows/tests/test_planner.py
@@ -73,7 +73,7 @@ class TestFlowPlanner(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy"), order=0
)
request = self.request_factory.get(
reverse("passbook_flows:flow-executor", kwargs={"flow_slug": flow.slug}),
@@ -97,7 +97,7 @@ class TestFlowPlanner(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy"), order=0
)
user = User.objects.create(username="test-user")
@@ -119,7 +119,7 @@ class TestFlowPlanner(TestCase):
)
FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy1"),
order=0,
re_evaluate_policies=True,
@@ -145,10 +145,10 @@ class TestFlowPlanner(TestCase):
false_policy = DummyPolicy.objects.create(result=False, wait_min=1, wait_max=2)
binding = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
)
binding2 = FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy2"),
order=1,
re_evaluate_policies=True,
diff --git a/passbook/flows/tests/test_views.py b/passbook/flows/tests/test_views.py
index f68173582..0e3de1abe 100644
--- a/passbook/flows/tests/test_views.py
+++ b/passbook/flows/tests/test_views.py
@@ -107,10 +107,10 @@ class TestFlowExecutor(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
)
FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy2"), order=1
+ target=flow, stage=DummyStage.objects.create(name="dummy2"), order=1
)
exec_url = reverse(
@@ -143,10 +143,10 @@ class TestFlowExecutor(TestCase):
false_policy = DummyPolicy.objects.create(result=False, wait_min=1, wait_max=2)
binding = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
)
binding2 = FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy2"),
order=1,
re_evaluate_policies=True,
@@ -194,16 +194,16 @@ class TestFlowExecutor(TestCase):
false_policy = DummyPolicy.objects.create(result=False, wait_min=1, wait_max=2)
binding = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
)
binding2 = FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy2"),
order=1,
re_evaluate_policies=True,
)
binding3 = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy3"), order=2
+ target=flow, stage=DummyStage.objects.create(name="dummy3"), order=2
)
PolicyBinding.objects.create(policy=false_policy, target=binding2, order=0)
@@ -261,22 +261,22 @@ class TestFlowExecutor(TestCase):
false_policy = DummyPolicy.objects.create(result=False, wait_min=1, wait_max=2)
binding = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
+ target=flow, stage=DummyStage.objects.create(name="dummy1"), order=0
)
binding2 = FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy2"),
order=1,
re_evaluate_policies=True,
)
binding3 = FlowStageBinding.objects.create(
- flow=flow,
+ target=flow,
stage=DummyStage.objects.create(name="dummy3"),
order=2,
re_evaluate_policies=True,
)
binding4 = FlowStageBinding.objects.create(
- flow=flow, stage=DummyStage.objects.create(name="dummy4"), order=2
+ target=flow, stage=DummyStage.objects.create(name="dummy4"), order=2
)
PolicyBinding.objects.create(policy=false_policy, target=binding2, order=0)
diff --git a/passbook/stages/captcha/tests.py b/passbook/stages/captcha/tests.py
index c5c8f5850..465deead2 100644
--- a/passbook/stages/captcha/tests.py
+++ b/passbook/stages/captcha/tests.py
@@ -32,7 +32,7 @@ class TestCaptchaStage(TestCase):
public_key=settings.RECAPTCHA_PUBLIC_KEY,
private_key=settings.RECAPTCHA_PRIVATE_KEY,
)
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_valid(self):
"""Test valid captcha"""
diff --git a/passbook/stages/consent/migrations/0001_initial.py b/passbook/stages/consent/migrations/0001_initial.py
index b929f5bf0..9813f9015 100644
--- a/passbook/stages/consent/migrations/0001_initial.py
+++ b/passbook/stages/consent/migrations/0001_initial.py
@@ -9,7 +9,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ("passbook_flows", "0004_source_flows"),
+ ("passbook_flows", "0007_auto_20200703_2059"),
]
operations = [
diff --git a/passbook/stages/consent/tests.py b/passbook/stages/consent/tests.py
index e7f0f2534..2af565dc9 100644
--- a/passbook/stages/consent/tests.py
+++ b/passbook/stages/consent/tests.py
@@ -27,7 +27,7 @@ class TestConsentStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = ConsentStage.objects.create(name="consent",)
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_valid(self):
"""Test valid consent"""
diff --git a/passbook/stages/dummy/tests.py b/passbook/stages/dummy/tests.py
index 51dada874..e0a84c07d 100644
--- a/passbook/stages/dummy/tests.py
+++ b/passbook/stages/dummy/tests.py
@@ -24,7 +24,7 @@ class TestDummyStage(TestCase):
)
self.stage = DummyStage.objects.create(name="dummy",)
FlowStageBinding.objects.create(
- flow=self.flow, stage=self.stage, order=0,
+ target=self.flow, stage=self.stage, order=0,
)
def test_valid_render(self):
diff --git a/passbook/stages/email/tests.py b/passbook/stages/email/tests.py
index 657cd1258..ff4db0cd4 100644
--- a/passbook/stages/email/tests.py
+++ b/passbook/stages/email/tests.py
@@ -31,7 +31,7 @@ class TestEmailStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = EmailStage.objects.create(name="email",)
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_rendering(self):
"""Test with pending user"""
diff --git a/passbook/stages/identification/migrations/0002_auto_20200530_2204.py b/passbook/stages/identification/migrations/0002_auto_20200530_2204.py
index 8a554f1ee..bedf7b553 100644
--- a/passbook/stages/identification/migrations/0002_auto_20200530_2204.py
+++ b/passbook/stages/identification/migrations/0002_auto_20200530_2204.py
@@ -7,7 +7,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0002_default_flows"),
+ ("passbook_flows", "0003_auto_20200523_1133"),
("passbook_stages_identification", "0001_initial"),
]
diff --git a/passbook/stages/identification/migrations/0003_auto_20200615_1641.py b/passbook/stages/identification/migrations/0003_auto_20200615_1641.py
index a6451a360..bed876403 100644
--- a/passbook/stages/identification/migrations/0003_auto_20200615_1641.py
+++ b/passbook/stages/identification/migrations/0003_auto_20200615_1641.py
@@ -7,7 +7,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
- ("passbook_flows", "0005_provider_flows"),
+ ("passbook_flows", "0007_auto_20200703_2059"),
("passbook_stages_identification", "0002_auto_20200530_2204"),
]
diff --git a/passbook/stages/identification/tests.py b/passbook/stages/identification/tests.py
index 37eb67c51..313090050 100644
--- a/passbook/stages/identification/tests.py
+++ b/passbook/stages/identification/tests.py
@@ -32,7 +32,7 @@ class TestIdentificationStage(TestCase):
template=Templates.DEFAULT_LOGIN,
)
FlowStageBinding.objects.create(
- flow=self.flow, stage=self.stage, order=0,
+ target=self.flow, stage=self.stage, order=0,
)
# OAuthSource for the login view
@@ -92,7 +92,7 @@ class TestIdentificationStage(TestCase):
self.stage.enrollment_flow = flow
self.stage.save()
FlowStageBinding.objects.create(
- flow=flow, stage=self.stage, order=0,
+ target=flow, stage=self.stage, order=0,
)
response = self.client.get(
@@ -113,7 +113,7 @@ class TestIdentificationStage(TestCase):
self.stage.recovery_flow = flow
self.stage.save()
FlowStageBinding.objects.create(
- flow=flow, stage=self.stage, order=0,
+ target=flow, stage=self.stage, order=0,
)
response = self.client.get(
diff --git a/passbook/stages/invitation/tests.py b/passbook/stages/invitation/tests.py
index f47ddc766..c805f77a6 100644
--- a/passbook/stages/invitation/tests.py
+++ b/passbook/stages/invitation/tests.py
@@ -31,7 +31,7 @@ class TestUserLoginStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = InvitationStage.objects.create(name="invitation")
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_form(self):
"""Test Form"""
diff --git a/passbook/stages/otp_time/migrations/0001_initial.py b/passbook/stages/otp_time/migrations/0001_initial.py
index d3bf815d8..f2ad1cb5a 100644
--- a/passbook/stages/otp_time/migrations/0001_initial.py
+++ b/passbook/stages/otp_time/migrations/0001_initial.py
@@ -9,7 +9,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ("passbook_flows", "0005_provider_flows"),
+ ("passbook_flows", "0007_auto_20200703_2059"),
]
operations = [
diff --git a/passbook/stages/otp_validate/migrations/0001_initial.py b/passbook/stages/otp_validate/migrations/0001_initial.py
index f26447ddd..e39663750 100644
--- a/passbook/stages/otp_validate/migrations/0001_initial.py
+++ b/passbook/stages/otp_validate/migrations/0001_initial.py
@@ -9,7 +9,7 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ("passbook_flows", "0005_provider_flows"),
+ ("passbook_flows", "0007_auto_20200703_2059"),
]
operations = [
diff --git a/passbook/stages/password/migrations/0002_passwordstage_change_flow.py b/passbook/stages/password/migrations/0002_passwordstage_change_flow.py
index 8b3fa4ade..2c6e3257a 100644
--- a/passbook/stages/password/migrations/0002_passwordstage_change_flow.py
+++ b/passbook/stages/password/migrations/0002_passwordstage_change_flow.py
@@ -75,10 +75,10 @@ def create_default_password_change(apps: Apps, schema_editor: BaseDatabaseSchema
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=prompt_stage, defaults={"order": 0}
+ target=flow, stage=prompt_stage, defaults={"order": 0}
)
FlowStageBinding.objects.using(db_alias).update_or_create(
- flow=flow, stage=user_write, defaults={"order": 1}
+ target=flow, stage=user_write, defaults={"order": 1}
)
diff --git a/passbook/stages/password/tests.py b/passbook/stages/password/tests.py
index 3dbb6f9ec..f52b45449 100644
--- a/passbook/stages/password/tests.py
+++ b/passbook/stages/password/tests.py
@@ -40,7 +40,7 @@ class TestPasswordStage(TestCase):
self.stage = PasswordStage.objects.create(
name="password", backends=["django.contrib.auth.backends.ModelBackend"]
)
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_without_user(self):
"""Test without user"""
diff --git a/passbook/stages/prompt/tests.py b/passbook/stages/prompt/tests.py
index b5893e8d7..b293a36c2 100644
--- a/passbook/stages/prompt/tests.py
+++ b/passbook/stages/prompt/tests.py
@@ -93,7 +93,7 @@ class TestPromptStage(TestCase):
hidden_prompt.field_key: hidden_prompt.placeholder,
}
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_render(self):
"""Test render of form, check if all prompts are rendered correctly"""
diff --git a/passbook/stages/user_delete/tests.py b/passbook/stages/user_delete/tests.py
index 26376c683..1c0648a70 100644
--- a/passbook/stages/user_delete/tests.py
+++ b/passbook/stages/user_delete/tests.py
@@ -26,7 +26,7 @@ class TestUserDeleteStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = UserDeleteStage.objects.create(name="delete")
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_no_user(self):
"""Test without user set"""
diff --git a/passbook/stages/user_login/tests.py b/passbook/stages/user_login/tests.py
index 4509c7b50..65b0336b3 100644
--- a/passbook/stages/user_login/tests.py
+++ b/passbook/stages/user_login/tests.py
@@ -27,7 +27,7 @@ class TestUserLoginStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = UserLoginStage.objects.create(name="login")
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_valid_password(self):
"""Test with a valid pending user and backend"""
diff --git a/passbook/stages/user_logout/tests.py b/passbook/stages/user_logout/tests.py
index 7263ccee2..394093509 100644
--- a/passbook/stages/user_logout/tests.py
+++ b/passbook/stages/user_logout/tests.py
@@ -27,7 +27,7 @@ class TestUserLogoutStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = UserLogoutStage.objects.create(name="logout")
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_valid_password(self):
"""Test with a valid pending user and backend"""
diff --git a/passbook/stages/user_write/tests.py b/passbook/stages/user_write/tests.py
index d36ce0c06..2c3b84aa2 100644
--- a/passbook/stages/user_write/tests.py
+++ b/passbook/stages/user_write/tests.py
@@ -29,7 +29,7 @@ class TestUserWriteStage(TestCase):
designation=FlowDesignation.AUTHENTICATION,
)
self.stage = UserWriteStage.objects.create(name="write")
- FlowStageBinding.objects.create(flow=self.flow, stage=self.stage, order=2)
+ FlowStageBinding.objects.create(target=self.flow, stage=self.stage, order=2)
def test_user_create(self):
"""Test creation of user"""
diff --git a/swagger.yaml b/swagger.yaml
index 10eb109b4..b2a42b3da 100755
--- a/swagger.yaml
+++ b/swagger.yaml
@@ -502,7 +502,7 @@ paths:
description: ''
required: false
type: string
- - name: flow
+ - name: target
in: query
description: ''
required: false
@@ -5617,7 +5617,7 @@ definitions:
maxLength: 254
FlowStageBinding:
required:
- - flow
+ - target
- stage
- order
type: object
@@ -5627,8 +5627,8 @@ definitions:
type: string
format: uuid
readOnly: true
- flow:
- title: Flow
+ target:
+ title: Target
type: string
format: uuid
stage: