*: rename objectType to component to get rid of lookup tables
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -1,66 +0,0 @@ | ||||
| """admin tests""" | ||||
| from importlib import import_module | ||||
| from typing import Callable | ||||
|  | ||||
| from django.forms import ModelForm | ||||
| from django.test import Client, TestCase | ||||
| from django.urls import reverse | ||||
| from django.urls.exceptions import NoReverseMatch | ||||
|  | ||||
| from authentik.admin.urls import urlpatterns | ||||
| from authentik.core.models import Group, User | ||||
| from authentik.lib.utils.reflection import get_apps | ||||
|  | ||||
|  | ||||
| class TestAdmin(TestCase): | ||||
|     """Generic admin tests""" | ||||
|  | ||||
|     def setUp(self): | ||||
|         self.user = User.objects.create_user(username="test") | ||||
|         self.user.ak_groups.add(Group.objects.filter(is_superuser=True).first()) | ||||
|         self.user.save() | ||||
|         self.client = Client() | ||||
|         self.client.force_login(self.user) | ||||
|  | ||||
|  | ||||
| def generic_view_tester(view_name: str) -> Callable: | ||||
|     """This is used instead of subTest for better visibility""" | ||||
|  | ||||
|     def tester(self: TestAdmin): | ||||
|         try: | ||||
|             full_url = reverse(f"authentik_admin:{view_name}") | ||||
|             response = self.client.get(full_url) | ||||
|             self.assertTrue(response.status_code < 500) | ||||
|         except NoReverseMatch: | ||||
|             pass | ||||
|  | ||||
|     return tester | ||||
|  | ||||
|  | ||||
| for url in urlpatterns: | ||||
|     method_name = url.name.replace("-", "_") | ||||
|     setattr(TestAdmin, f"test_view_{method_name}", generic_view_tester(url.name)) | ||||
|  | ||||
|  | ||||
| def generic_form_tester(form: ModelForm) -> Callable: | ||||
|     """Test a form""" | ||||
|  | ||||
|     def tester(self: TestAdmin): | ||||
|         form_inst = form() | ||||
|         self.assertFalse(form_inst.is_valid()) | ||||
|  | ||||
|     return tester | ||||
|  | ||||
|  | ||||
| # Load the forms module from every app, so we have all forms loaded | ||||
| for app in get_apps(): | ||||
|     module = app.__module__.replace(".apps", ".forms") | ||||
|     try: | ||||
|         import_module(module) | ||||
|     except ImportError: | ||||
|         pass | ||||
|  | ||||
| for form_class in ModelForm.__subclasses__(): | ||||
|     setattr( | ||||
|         TestAdmin, f"test_form_{form_class.__name__}", generic_form_tester(form_class) | ||||
|     ) | ||||
| @ -36,11 +36,11 @@ class PropertyMappingTestResultSerializer(PassiveSerializer): | ||||
| class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSerializer): | ||||
|     """PropertyMapping Serializer""" | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|  | ||||
|     def get_object_type(self, obj: PropertyMapping) -> str: | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("propertymapping", "") | ||||
|     def get_component(self, obj: PropertyMapping) -> str: | ||||
|         """Get object's component so that we know how to edit the object""" | ||||
|         return obj.component | ||||
|  | ||||
|     def validate_expression(self, expression: str) -> str: | ||||
|         """Test Syntax""" | ||||
| @ -56,7 +56,7 @@ class PropertyMappingSerializer(ManagedSerializer, ModelSerializer, MetaNameSeri | ||||
|             "managed", | ||||
|             "name", | ||||
|             "expression", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "verbose_name", | ||||
|             "verbose_name_plural", | ||||
|         ] | ||||
|  | ||||
| @ -21,11 +21,11 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): | ||||
|     assigned_application_slug = ReadOnlyField(source="application.slug") | ||||
|     assigned_application_name = ReadOnlyField(source="application.name") | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|  | ||||
|     def get_object_type(self, obj):  # pragma: no cover | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("provider", "") | ||||
|     def get_component(self, obj: Provider):  # pragma: no cover | ||||
|         """Get object component so that we know how to edit the object""" | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
| @ -35,7 +35,7 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): | ||||
|             "name", | ||||
|             "authorization_flow", | ||||
|             "property_mappings", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "assigned_application_slug", | ||||
|             "assigned_application_name", | ||||
|             "verbose_name", | ||||
|  | ||||
| @ -23,11 +23,11 @@ LOGGER = get_logger() | ||||
| class SourceSerializer(ModelSerializer, MetaNameSerializer): | ||||
|     """Source Serializer""" | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|  | ||||
|     def get_object_type(self, obj): | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("source", "") | ||||
|     def get_component(self, obj: Source): | ||||
|         """Get object component so that we know how to edit the object""" | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
| @ -39,7 +39,7 @@ class SourceSerializer(ModelSerializer, MetaNameSerializer): | ||||
|             "enabled", | ||||
|             "authentication_flow", | ||||
|             "enrollment_flow", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "verbose_name", | ||||
|             "verbose_name_plural", | ||||
|             "policy_engine_mode", | ||||
|  | ||||
| @ -23,12 +23,15 @@ LOGGER = get_logger() | ||||
| class StageSerializer(ModelSerializer, MetaNameSerializer): | ||||
|     """Stage Serializer""" | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|     flow_set = FlowSerializer(many=True, required=False) | ||||
|  | ||||
|     def get_object_type(self, obj: Stage) -> str: | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("stage", "") | ||||
|     def get_component(self, obj: Stage) -> str: | ||||
|         """Get object type so that we know how to edit the object""" | ||||
|         # pyright: reportGeneralTypeIssues=false | ||||
|         if obj.__class__ == Stage: | ||||
|             return "" | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
| @ -36,7 +39,7 @@ class StageSerializer(ModelSerializer, MetaNameSerializer): | ||||
|         fields = [ | ||||
|             "pk", | ||||
|             "name", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "verbose_name", | ||||
|             "verbose_name_plural", | ||||
|             "flow_set", | ||||
|  | ||||
| @ -37,7 +37,7 @@ class TestFlowsAPI(APITestCase): | ||||
|     def test_api_serializer(self): | ||||
|         """Test that stage serializer returns the correct type""" | ||||
|         obj = DummyStage() | ||||
|         self.assertEqual(StageSerializer().get_object_type(obj), "dummy") | ||||
|         self.assertEqual(StageSerializer().get_component(obj), "ak-stage-dummy-form") | ||||
|         self.assertEqual(StageSerializer().get_verbose_name(obj), "Dummy Stage") | ||||
|  | ||||
|     def test_api_viewset(self): | ||||
|  | ||||
| @ -22,7 +22,7 @@ def get_attrs(obj: SerializerModel) -> dict[str, Any]: | ||||
|         "user", | ||||
|         "verbose_name", | ||||
|         "verbose_name_plural", | ||||
|         "object_type", | ||||
|         "component", | ||||
|         "flow_set", | ||||
|         "promptstage_set", | ||||
|     ) | ||||
|  | ||||
| @ -31,11 +31,11 @@ from authentik.outposts.models import ( | ||||
| class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): | ||||
|     """ServiceConnection Serializer""" | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|  | ||||
|     def get_object_type(self, obj: OutpostServiceConnection) -> str: | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("serviceconnection", "") | ||||
|     def get_component(self, obj: OutpostServiceConnection) -> str: | ||||
|         """Get object component so that we know how to edit the object""" | ||||
|         return obj.component | ||||
|  | ||||
|     class Meta: | ||||
|  | ||||
| @ -44,7 +44,7 @@ class ServiceConnectionSerializer(ModelSerializer, MetaNameSerializer): | ||||
|             "pk", | ||||
|             "name", | ||||
|             "local", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "verbose_name", | ||||
|             "verbose_name_plural", | ||||
|         ] | ||||
|  | ||||
| @ -33,16 +33,16 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): | ||||
|  | ||||
|     _resolve_inheritance: bool | ||||
|  | ||||
|     object_type = SerializerMethodField() | ||||
|     component = SerializerMethodField() | ||||
|     bound_to = SerializerMethodField() | ||||
|  | ||||
|     def __init__(self, *args, resolve_inheritance: bool = True, **kwargs): | ||||
|         super().__init__(*args, **kwargs) | ||||
|         self._resolve_inheritance = resolve_inheritance | ||||
|  | ||||
|     def get_object_type(self, obj: Policy) -> str: | ||||
|         """Get object type so that we know which API Endpoint to use to get the full object""" | ||||
|         return obj._meta.object_name.lower().replace("policy", "") | ||||
|     def get_component(self, obj: Policy) -> str: | ||||
|         """Get object component so that we know how to edit the object""" | ||||
|         return obj.component | ||||
|  | ||||
|     def get_bound_to(self, obj: Policy) -> int: | ||||
|         """Return objects policy is bound to""" | ||||
| @ -65,7 +65,7 @@ class PolicySerializer(ModelSerializer, MetaNameSerializer): | ||||
|             "pk", | ||||
|             "name", | ||||
|             "execution_logging", | ||||
|             "object_type", | ||||
|             "component", | ||||
|             "verbose_name", | ||||
|             "verbose_name_plural", | ||||
|             "bound_to", | ||||
|  | ||||
| @ -30,7 +30,7 @@ class DummyPolicy(Policy): | ||||
|         return DummyPolicySerializer | ||||
|  | ||||
|     @property | ||||
|     def component(self) -> str: | ||||
|     def component(self) -> str:  # pragma: no cover | ||||
|         return "ak-policy-dummy-form" | ||||
|  | ||||
|     def passes(self, request: PolicyRequest) -> PolicyResult: | ||||
|  | ||||
| @ -0,0 +1,32 @@ | ||||
| # Generated by Django 3.1.7 on 2021-04-03 09:27 | ||||
|  | ||||
| import django.contrib.postgres.fields | ||||
| from django.db import migrations, models | ||||
|  | ||||
| import authentik.stages.authenticator_validate.models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ("authentik_stages_authenticator_validate", "0006_auto_20210301_1757"), | ||||
|     ] | ||||
|  | ||||
|     operations = [ | ||||
|         migrations.AlterField( | ||||
|             model_name="authenticatorvalidatestage", | ||||
|             name="device_classes", | ||||
|             field=django.contrib.postgres.fields.ArrayField( | ||||
|                 base_field=models.TextField( | ||||
|                     choices=[ | ||||
|                         ("static", "Static"), | ||||
|                         ("totp", "TOTP"), | ||||
|                         ("webauthn", "WebAuthn"), | ||||
|                     ] | ||||
|                 ), | ||||
|                 default=authentik.stages.authenticator_validate.models.default_device_classes, | ||||
|                 help_text="Device classes which can be used to authenticate", | ||||
|                 size=None, | ||||
|             ), | ||||
|         ), | ||||
|     ] | ||||
| @ -51,7 +51,7 @@ class AuthenticatorValidateStage(Stage): | ||||
|     ) | ||||
|  | ||||
|     device_classes = ArrayField( | ||||
|         models.TextField(), | ||||
|         models.TextField(choices=DeviceClasses.choices), | ||||
|         help_text=_("Device classes which can be used to authenticate"), | ||||
|         default=default_device_classes, | ||||
|     ) | ||||
|  | ||||
| @ -73,24 +73,6 @@ class TestUserDeleteStage(TestCase): | ||||
|             reverse("authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug}) | ||||
|         ) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|  | ||||
|     def test_user_delete_post(self): | ||||
|         """Test User delete (actual)""" | ||||
|         plan = FlowPlan( | ||||
|             flow_pk=self.flow.pk.hex, stages=[self.stage], markers=[StageMarker()] | ||||
|         ) | ||||
|         plan.context[PLAN_CONTEXT_PENDING_USER] = self.user | ||||
|         session = self.client.session | ||||
|         session[SESSION_KEY_PLAN] = plan | ||||
|         session.save() | ||||
|  | ||||
|         response = self.client.post( | ||||
|             reverse( | ||||
|                 "authentik_api:flow-executor", kwargs={"flow_slug": self.flow.slug} | ||||
|             ), | ||||
|             {}, | ||||
|         ) | ||||
|         self.assertEqual(response.status_code, 200) | ||||
|         self.assertJSONEqual( | ||||
|             force_str(response.content), | ||||
|             {"to": reverse("authentik_core:root-redirect"), "type": "redirect"}, | ||||
|  | ||||
							
								
								
									
										169
									
								
								swagger.yaml
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								swagger.yaml
									
									
									
									
									
								
							| @ -14446,8 +14446,8 @@ definitions: | ||||
|           type: string | ||||
|           format: uuid | ||||
|         uniqueItems: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       assigned_application_slug: | ||||
| @ -15124,8 +15124,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15274,8 +15274,8 @@ definitions: | ||||
|           type: string | ||||
|           format: uuid | ||||
|         uniqueItems: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       assigned_application_slug: | ||||
| @ -15606,8 +15606,8 @@ definitions: | ||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||
|           Integration | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15650,8 +15650,8 @@ definitions: | ||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||
|           Integration | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15702,8 +15702,8 @@ definitions: | ||||
|         description: If enabled, use the local connection. Required Docker socket/Kubernetes | ||||
|           Integration | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15736,8 +15736,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15843,8 +15843,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -15889,8 +15889,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16005,8 +16005,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16042,8 +16042,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16087,8 +16087,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16155,8 +16155,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16196,8 +16196,8 @@ definitions: | ||||
|         description: When this option is enabled, all executions of this policy will | ||||
|           be logged. By default, only execution errors are logged. | ||||
|         type: boolean | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16296,8 +16296,8 @@ definitions: | ||||
|         title: Expression | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16349,8 +16349,8 @@ definitions: | ||||
|         title: Expression | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16394,8 +16394,8 @@ definitions: | ||||
|         title: Expression | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16443,8 +16443,8 @@ definitions: | ||||
|         title: Expression | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16519,8 +16519,8 @@ definitions: | ||||
|           type: string | ||||
|           format: uuid | ||||
|         uniqueItems: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       assigned_application_slug: | ||||
| @ -16602,8 +16602,8 @@ definitions: | ||||
|           type: string | ||||
|           format: uuid | ||||
|         uniqueItems: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       assigned_application_slug: | ||||
| @ -16791,8 +16791,8 @@ definitions: | ||||
|         type: string | ||||
|         format: uuid | ||||
|         x-nullable: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -16871,8 +16871,8 @@ definitions: | ||||
|         type: string | ||||
|         format: uuid | ||||
|         x-nullable: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17062,8 +17062,8 @@ definitions: | ||||
|         type: string | ||||
|         format: uuid | ||||
|         x-nullable: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17186,8 +17186,8 @@ definitions: | ||||
|         type: string | ||||
|         format: uuid | ||||
|         x-nullable: true | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17295,8 +17295,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17338,8 +17338,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17381,8 +17381,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17410,7 +17410,10 @@ definitions: | ||||
|         items: | ||||
|           title: Device classes | ||||
|           type: string | ||||
|           minLength: 1 | ||||
|           enum: | ||||
|             - static | ||||
|             - totp | ||||
|             - webauthn | ||||
|       configuration_stage: | ||||
|         title: Configuration stage | ||||
|         description: Stage used to configure Authenticator when user doesn't have | ||||
| @ -17433,8 +17436,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17472,8 +17475,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17512,8 +17515,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17554,8 +17557,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17584,8 +17587,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17614,8 +17617,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17698,8 +17701,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -17990,8 +17993,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18027,8 +18030,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18135,8 +18138,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18177,8 +18180,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18207,8 +18210,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18243,8 +18246,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
| @ -18273,8 +18276,8 @@ definitions: | ||||
|         title: Name | ||||
|         type: string | ||||
|         minLength: 1 | ||||
|       object_type: | ||||
|         title: Object type | ||||
|       component: | ||||
|         title: Component | ||||
|         type: string | ||||
|         readOnly: true | ||||
|       verbose_name: | ||||
|  | ||||
| @ -5,6 +5,7 @@ import { Table, TableColumn } from "../../elements/table/Table"; | ||||
|  | ||||
| import "../../elements/forms/DeleteForm"; | ||||
| import "../../elements/forms/ModalForm"; | ||||
| import "../../elements/forms/ProxyForm"; | ||||
| import "./StageBindingForm"; | ||||
| import "../../elements/Tabs"; | ||||
| import "../../elements/buttons/ModalButton"; | ||||
| @ -15,7 +16,6 @@ import { until } from "lit-html/directives/until"; | ||||
| import { PAGE_SIZE } from "../../constants"; | ||||
| import { FlowsApi, FlowStageBinding, StagesApi } from "authentik-api"; | ||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | ||||
| import { AdminURLManager } from "../../api/legacy"; | ||||
| import { ifDefined } from "lit-html/directives/if-defined"; | ||||
|  | ||||
| @customElement("ak-bound-stages-list") | ||||
| @ -49,12 +49,24 @@ export class BoundStagesList extends Table<FlowStageBinding> { | ||||
|             html`${item.stageObj?.name}`, | ||||
|             html`${item.stageObj?.verboseName}`, | ||||
|             html` | ||||
|             <ak-modal-button href="${AdminURLManager.stages(`${item.stage}/update/`)}"> | ||||
|                 <ak-spinner-button slot="trigger" class="pf-m-secondary"> | ||||
|             <ak-forms-modal> | ||||
|                 <span slot="submit"> | ||||
|                     ${gettext("Update")} | ||||
|                 </span> | ||||
|                 <span slot="header"> | ||||
|                     ${gettext(`Update ${item.stageObj?.verboseName}`)} | ||||
|                 </span> | ||||
|                 <ak-proxy-form | ||||
|                     slot="form" | ||||
|                     .args=${{ | ||||
|                         "stageUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.stageObj?.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit Stage")} | ||||
|                 </ak-spinner-button> | ||||
|                 <div slot="modal"></div> | ||||
|             </ak-modal-button> | ||||
|                 </button> | ||||
|             </ak-forms-modal> | ||||
|             <ak-forms-modal> | ||||
|                 <span slot="submit"> | ||||
|                     ${gettext("Update")} | ||||
|  | ||||
| @ -84,11 +84,7 @@ export class OutpostServiceConnectionListPage extends TablePage<ServiceConnectio | ||||
|                     .args=${{ | ||||
|                         "scUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "docker": "ak-service-connection-docker-form", | ||||
|                         "kubernetes": "ak-service-connection-kubernetes-form" | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|  | ||||
| @ -6,13 +6,12 @@ import { PoliciesApi, PolicyBinding } from "authentik-api"; | ||||
|  | ||||
| import "../../elements/forms/DeleteForm"; | ||||
| import "../../elements/Tabs"; | ||||
| import "../../elements/buttons/ModalButton"; | ||||
| import "../../elements/forms/ProxyForm"; | ||||
| import "../../elements/buttons/SpinnerButton"; | ||||
| import "../../elements/buttons/Dropdown"; | ||||
| import { until } from "lit-html/directives/until"; | ||||
| import { PAGE_SIZE } from "../../constants"; | ||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | ||||
| import { AdminURLManager } from "../../api/legacy"; | ||||
|  | ||||
| import "../../elements/forms/ModalForm"; | ||||
| import "../groups/GroupForm"; | ||||
| @ -58,12 +57,25 @@ export class BoundPoliciesList extends Table<PolicyBinding> { | ||||
|  | ||||
|     getObjectEditButton(item: PolicyBinding): TemplateResult { | ||||
|         if (item.policy) { | ||||
|             return html`<ak-modal-button href="${AdminURLManager.policies(`${item.policy}/update/`)}"> | ||||
|                 <ak-spinner-button slot="trigger" class="pf-m-secondary"> | ||||
|                     ${gettext("Edit Policy")} | ||||
|                 </ak-spinner-button> | ||||
|                 <div slot="modal"></div> | ||||
|             </ak-modal-button>`; | ||||
|             return html` | ||||
|             <ak-forms-modal> | ||||
|                 <span slot="submit"> | ||||
|                     ${gettext("Update")} | ||||
|                 </span> | ||||
|                 <span slot="header"> | ||||
|                     ${gettext(`Update ${item.policyObj?.name}`)} | ||||
|                 </span> | ||||
|                 <ak-proxy-form | ||||
|                     slot="form" | ||||
|                     .args=${{ | ||||
|                         "policyUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.policyObj?.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|                 </button> | ||||
|             </ak-forms-modal>`; | ||||
|         } else if (item.group) { | ||||
|             return html`<ak-forms-modal> | ||||
|                 <span slot="submit"> | ||||
|  | ||||
| @ -84,16 +84,7 @@ export class PolicyListPage extends TablePage<Policy> { | ||||
|                     .args=${{ | ||||
|                         "policyUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "dummy": "ak-policy-dummy-form", | ||||
|                         "eventmatcher": "ak-policy-event-matcher-form", | ||||
|                         "expression": "ak-policy-expression-form", | ||||
|                         "passwordexpiry": "ak-policy-password-expiry-form", | ||||
|                         "haveibeenpwend": "ak-policy-hibp-form", | ||||
|                         "password": "ak-policy-password-form", | ||||
|                         "reputation": "ak-policy-reputation-form", | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|  | ||||
| @ -76,12 +76,7 @@ export class PropertyMappingListPage extends TablePage<PropertyMapping> { | ||||
|                     .args=${{ | ||||
|                         "mappingUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "scopemapping": "ak-property-mapping-scope-form", | ||||
|                         "ldap": "ak-property-mapping-ldap-form", | ||||
|                         "saml": "ak-property-mapping-saml-form", | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|  | ||||
| @ -80,12 +80,7 @@ export class ProviderListPage extends TablePage<Provider> { | ||||
|                     .args=${{ | ||||
|                         "providerUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "oauth2": "ak-provider-oauth2-form", | ||||
|                         "saml": "ak-provider-saml-form", | ||||
|                         "proxy": "ak-provider-proxy-form", | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|  | ||||
| @ -36,15 +36,15 @@ export class ProviderViewPage extends LitElement { | ||||
|         if (!this.provider) { | ||||
|             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; | ||||
|         } | ||||
|         switch (this.provider?.objectType) { | ||||
|             case "saml": | ||||
|         switch (this.provider?.component) { | ||||
|             case "ak-provider-saml-form": | ||||
|                 return html`<ak-provider-saml-view providerID=${ifDefined(this.provider.pk)}></ak-provider-saml-view>`; | ||||
|             case "oauth2": | ||||
|             case "ak-provider-oauth2-form": | ||||
|                 return html`<ak-provider-oauth2-view providerID=${ifDefined(this.provider.pk)}></ak-provider-oauth2-view>`; | ||||
|             case "proxy": | ||||
|             case "ak-provider-proxy-form": | ||||
|                 return html`<ak-provider-proxy-view providerID=${ifDefined(this.provider.pk)}></ak-provider-proxy-view>`; | ||||
|             default: | ||||
|                 return html`<p>Invalid provider type ${this.provider?.objectType}</p>`; | ||||
|                 return html`<p>Invalid provider type ${this.provider?.component}</p>`; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -37,15 +37,15 @@ export class SourceViewPage extends LitElement { | ||||
|         if (!this.source) { | ||||
|             return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`; | ||||
|         } | ||||
|         switch (this.source?.objectType) { | ||||
|             case "ldap": | ||||
|         switch (this.source?.component) { | ||||
|             case "ak-source-ldap-form": | ||||
|                 return html`<ak-source-ldap-view sourceSlug=${this.source.slug}></ak-source-ldap-view>`; | ||||
|             case "oauth": | ||||
|             case "ak-source-oauth-form": | ||||
|                 return html`<ak-source-oauth-view sourceSlug=${this.source.slug}></ak-source-oauth-view>`; | ||||
|             case "saml": | ||||
|             case "ak-source-saml-form": | ||||
|                 return html`<ak-source-saml-view sourceSlug=${this.source.slug}></ak-source-saml-view>`; | ||||
|             default: | ||||
|                 return html`<p>Invalid source type ${this.source.objectType}</p>`; | ||||
|                 return html`<p>Invalid source type ${this.source.component}</p>`; | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -73,12 +73,7 @@ export class SourceListPage extends TablePage<Source> { | ||||
|                     .args=${{ | ||||
|                         "sourceSlug": item.slug | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "ldap": "ak-source-ldap-form", | ||||
|                         "saml": "ak-source-saml-form", | ||||
|                         "oauth": "ak-source-oauth-form", | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
|  | ||||
| @ -15,23 +15,23 @@ import { Stage, StagesApi } from "authentik-api"; | ||||
| import { DEFAULT_CONFIG } from "../../api/Config"; | ||||
| import { ifDefined } from "lit-html/directives/if-defined"; | ||||
|  | ||||
| import "./pages/stages/authenticator_static/AuthenticatorStaticStageForm.ts"; | ||||
| import "./pages/stages/authenticator_totp/AuthenticatorTOTPStageForm.ts"; | ||||
| import "./pages/stages/authenticator_validate/AuthenticatorValidateStageForm.ts"; | ||||
| import "./pages/stages/authenticator_webauthn/AuthenticateWebAuthnStageForm.ts"; | ||||
| import "./pages/stages/captcha/CaptchaStageForm.ts"; | ||||
| import "./pages/stages/consent/ConsentStageForm.ts"; | ||||
| import "./pages/stages/deny/DenyStageForm.ts"; | ||||
| import "./pages/stages/dummy/DummyStageForm.ts"; | ||||
| import "./pages/stages/email/EmailStageForm.ts"; | ||||
| import "./pages/stages/identification/IdentificationStageForm.ts"; | ||||
| import "./pages/stages/invitation/InvitationStageForm.ts"; | ||||
| import "./pages/stages/password/PasswordStageForm.ts"; | ||||
| import "./pages/stages/prompt/PromptStageForm.ts"; | ||||
| import "./pages/stages/user_delete/UserDeleteStageForm.ts"; | ||||
| import "./pages/stages/user_login/UserLoginStageForm.ts"; | ||||
| import "./pages/stages/user_logout/UserLogoutStageForm.ts"; | ||||
| import "./pages/stages/user_write/UserWriteStageForm.ts"; | ||||
| import "./authenticator_static/AuthenticatorStaticStageForm.ts"; | ||||
| import "./authenticator_totp/AuthenticatorTOTPStageForm.ts"; | ||||
| import "./authenticator_validate/AuthenticatorValidateStageForm.ts"; | ||||
| import "./authenticator_webauthn/AuthenticateWebAuthnStageForm.ts"; | ||||
| import "./captcha/CaptchaStageForm.ts"; | ||||
| import "./consent/ConsentStageForm.ts"; | ||||
| import "./deny/DenyStageForm.ts"; | ||||
| import "./dummy/DummyStageForm.ts"; | ||||
| import "./email/EmailStageForm.ts"; | ||||
| import "./identification/IdentificationStageForm.ts"; | ||||
| import "./invitation/InvitationStageForm.ts"; | ||||
| import "./password/PasswordStageForm.ts"; | ||||
| import "./prompt/PromptStageForm.ts"; | ||||
| import "./user_delete/UserDeleteStageForm.ts"; | ||||
| import "./user_login/UserLoginStageForm.ts"; | ||||
| import "./user_logout/UserLogoutStageForm.ts"; | ||||
| import "./user_write/UserWriteStageForm.ts"; | ||||
|  | ||||
| @customElement("ak-stage-list") | ||||
| export class StageListPage extends TablePage<Stage> { | ||||
| @ -92,16 +92,7 @@ export class StageListPage extends TablePage<Stage> { | ||||
|                     .args=${{ | ||||
|                         "stageUUID": item.pk | ||||
|                     }} | ||||
|                     type=${ifDefined(item.objectType)} | ||||
|                     .typeMap=${{ | ||||
|                         "dummy": "ak-policy-dummy-form", | ||||
|                         "eventmatcher": "ak-policy-event-matcher-form", | ||||
|                         "expression": "ak-policy-expression-form", | ||||
|                         "passwordexpiry": "ak-policy-password-expiry-form", | ||||
|                         "haveibeenpwend": "ak-policy-hibp-form", | ||||
|                         "password": "ak-policy-password-form", | ||||
|                         "reputation": "ak-policy-reputation-form", | ||||
|                     }}> | ||||
|                     type=${ifDefined(item.component)}> | ||||
|                 </ak-proxy-form> | ||||
|                 <button slot="trigger" class="pf-c-button pf-m-secondary"> | ||||
|                     ${gettext("Edit")} | ||||
| @ -148,6 +139,7 @@ export class StageListPage extends TablePage<Stage> { | ||||
|                                     ${type.name}<br> | ||||
|                                     <small>${type.description}</small> | ||||
|                                 </button> | ||||
|                             </ak-forms-modal> | ||||
|                         </li>`; | ||||
|                     }); | ||||
|                 }), html`<ak-spinner></ak-spinner>`)} | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| import { AuthenticatorValidateStage, AuthenticatorValidateStageNotConfiguredActionEnum, StagesApi } from "authentik-api"; | ||||
| import { AuthenticatorValidateStage, AuthenticatorValidateStageNotConfiguredActionEnum, AuthenticatorValidateStageDeviceClassesEnum, StagesApi } from "authentik-api"; | ||||
| import { gettext } from "django"; | ||||
| import { customElement, property } from "lit-element"; | ||||
| import { html, TemplateResult } from "lit-html"; | ||||
| @ -7,7 +7,6 @@ import { Form } from "../../../elements/forms/Form"; | ||||
| import { ifDefined } from "lit-html/directives/if-defined"; | ||||
| import "../../../elements/forms/HorizontalFormElement"; | ||||
| import "../../../elements/forms/FormGroup"; | ||||
| import { DeviceClasses } from "authentik-api/dist/src/flows/stages/authenticator_validate/AuthenticatorValidateStage"; | ||||
| import { until } from "lit-html/directives/until"; | ||||
|  | ||||
| @customElement("ak-stage-authenticator-validate-form") | ||||
| @ -49,7 +48,7 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | ||||
|         } | ||||
|     }; | ||||
|  | ||||
|     isDeviceClassSelected(field: DeviceClasses): boolean { | ||||
|     isDeviceClassSelected(field: AuthenticatorValidateStageDeviceClassesEnum): boolean { | ||||
|         return (this.stage?.deviceClasses || []).filter(isField => { | ||||
|             return field === isField; | ||||
|         }).length > 0; | ||||
| @ -96,13 +95,13 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | ||||
|                         ?required=${true} | ||||
|                         name="transports"> | ||||
|                         <select name="users" class="pf-c-form-control" multiple> | ||||
|                             <option value=${DeviceClasses.STATIC} ?selected=${this.isDeviceClassSelected(DeviceClasses.STATIC)}> | ||||
|                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Static} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Static)}> | ||||
|                                 ${gettext("Static Tokens")} | ||||
|                             </option> | ||||
|                             <option value=${DeviceClasses.TOTP} ?selected=${this.isDeviceClassSelected(DeviceClasses.TOTP)}> | ||||
|                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Totp} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Totp)}> | ||||
|                                 ${gettext("TOTP Authenticators")} | ||||
|                             </option> | ||||
|                             <option value=${DeviceClasses.WEBAUTHN} ?selected=${this.isDeviceClassSelected(DeviceClasses.WEBAUTHN)}> | ||||
|                             <option value=${AuthenticatorValidateStageDeviceClassesEnum.Webauthn} ?selected=${this.isDeviceClassSelected(AuthenticatorValidateStageDeviceClassesEnum.Webauthn)}> | ||||
|                                 ${gettext("WebAuthn Authenticators")} | ||||
|                             </option> | ||||
|                         </select> | ||||
| @ -120,8 +119,8 @@ export class AuthenticatorValidateStageForm extends Form<AuthenticatorValidateSt | ||||
|                                 ordering: "pk", | ||||
|                             }).then(stages => { | ||||
|                                 return stages.results.map(stage => { | ||||
|                                     let selected = this.stage?.configurationStage === stage.pk; | ||||
|                                     return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.objectType})</option>`; | ||||
|                                     const selected = this.stage?.configurationStage === stage.pk; | ||||
|                                     return html`<option value=${ifDefined(stage.pk)} ?selected=${selected}>${stage.name} (${stage.verboseName})</option>`; | ||||
|                                 }); | ||||
|                             }))} | ||||
|                         </select> | ||||
|  | ||||
| @ -106,7 +106,7 @@ export class IdentificationStageForm extends Form<IdentificationStage> { | ||||
|                                 designation: FlowDesignationEnum.Enrollment, | ||||
|                             }).then(flows => { | ||||
|                                 return flows.results.map(flow => { | ||||
|                                     let selected = this.stage?.enrollmentFlow === flow.pk; | ||||
|                                     const selected = this.stage?.enrollmentFlow === flow.pk; | ||||
|                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; | ||||
|                                 }); | ||||
|                             }))} | ||||
| @ -123,7 +123,7 @@ export class IdentificationStageForm extends Form<IdentificationStage> { | ||||
|                                 designation: FlowDesignationEnum.Recovery, | ||||
|                             }).then(flows => { | ||||
|                                 return flows.results.map(flow => { | ||||
|                                     let selected = this.stage?.recoveryFlow === flow.pk; | ||||
|                                     const selected = this.stage?.recoveryFlow === flow.pk; | ||||
|                                     return html`<option value=${ifDefined(flow.pk)} ?selected=${selected}>${flow.name} (${flow.slug})</option>`; | ||||
|                                 }); | ||||
|                             }))} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer