diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py index 4bb6d4bf1..f790ad7c3 100644 --- a/authentik/core/api/propertymappings.py +++ b/authentik/core/api/propertymappings.py @@ -91,7 +91,7 @@ class PropertyMappingViewSet( { "name": verbose_name(subclass), "description": subclass.__doc__, - "link": subclass.component, + "component": subclass.component, } ) return Response(TypeCreateSerializer(data, many=True).data) diff --git a/authentik/core/api/providers.py b/authentik/core/api/providers.py index 3993b0c6f..7699b623c 100644 --- a/authentik/core/api/providers.py +++ b/authentik/core/api/providers.py @@ -23,7 +23,7 @@ class ProviderSerializer(ModelSerializer, MetaNameSerializer): object_type = SerializerMethodField() - def get_object_type(self, obj): + 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", "") @@ -74,14 +74,14 @@ class ProviderViewSet( { "name": verbose_name(subclass), "description": subclass.__doc__, - "link": subclass().component, + "component": subclass().component, } ) data.append( { "name": _("SAML Provider from Metadata"), "description": _("Create a SAML Provider by importing its Metadata."), - "link": "ak-provider-saml-import-form", + "component": "ak-provider-saml-import-form", } ) return Response(TypeCreateSerializer(data, many=True).data) diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index 6290d0e38..416ff30d7 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -71,7 +71,7 @@ class SourceViewSet( { "name": verbose_name(subclass), "description": subclass.__doc__, - "link": subclass().component, + "component": subclass().component, } ) return Response(TypeCreateSerializer(data, many=True).data) diff --git a/authentik/core/api/utils.py b/authentik/core/api/utils.py index 390955a39..70155b06e 100644 --- a/authentik/core/api/utils.py +++ b/authentik/core/api/utils.py @@ -34,7 +34,7 @@ class TypeCreateSerializer(PassiveSerializer): name = CharField(required=True) description = CharField(required=True) - link = CharField(required=True) + component = CharField(required=True) class CacheSerializer(PassiveSerializer): diff --git a/authentik/events/api/event.py b/authentik/events/api/event.py index 04030fd09..b13e28c69 100644 --- a/authentik/events/api/event.py +++ b/authentik/events/api/event.py @@ -156,7 +156,7 @@ class EventViewSet(ReadOnlyModelViewSet): { "name": name, "description": "", - "link": value, + "component": value, } ) return Response(TypeCreateSerializer(data, many=True).data) diff --git a/authentik/flows/api/stages.py b/authentik/flows/api/stages.py index 2917256e3..cbfc0c65f 100644 --- a/authentik/flows/api/stages.py +++ b/authentik/flows/api/stages.py @@ -70,7 +70,7 @@ class StageViewSet( { "name": verbose_name(subclass), "description": subclass.__doc__, - "link": reverse("authentik_admin:stage-create") + "component": reverse("authentik_admin:stage-create") + f"?type={subclass.__name__}", } ) diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py index 86ea476ed..195e7e4ad 100644 --- a/authentik/policies/api/policies.py +++ b/authentik/policies/api/policies.py @@ -104,7 +104,7 @@ class PolicyViewSet( { "name": verbose_name(subclass), "description": subclass.__doc__, - "link": subclass().component, + "component": subclass().component, } ) return Response(TypeCreateSerializer(data, many=True).data) diff --git a/authentik/policies/tests/test_policies_api.py b/authentik/policies/tests/test_policies_api.py index 8c3abc941..fc20a0177 100644 --- a/authentik/policies/tests/test_policies_api.py +++ b/authentik/policies/tests/test_policies_api.py @@ -26,3 +26,10 @@ class TestPoliciesAPI(APITestCase): self.assertJSONEqual( response.content.decode(), {"passing": True, "messages": ["dummy"]} ) + + def test_types(self): + """Test Policy's types endpoint""" + response = self.client.get( + reverse("authentik_api:policy-types"), + ) + self.assertEqual(response.status_code, 200) diff --git a/swagger.yaml b/swagger.yaml index 99576ee87..d34490fb1 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -14821,7 +14821,7 @@ definitions: required: - name - description - - link + - component type: object properties: name: @@ -14832,8 +14832,8 @@ definitions: title: Description type: string minLength: 1 - link: - title: Link + component: + title: Component type: string minLength: 1 EventTopPerUser: diff --git a/web/src/pages/flows/BoundStagesList.ts b/web/src/pages/flows/BoundStagesList.ts index f0a8c7cc5..88a4c255a 100644 --- a/web/src/pages/flows/BoundStagesList.ts +++ b/web/src/pages/flows/BoundStagesList.ts @@ -133,7 +133,7 @@ export class BoundStagesList extends Table { ${until(new StagesApi(DEFAULT_CONFIG).stagesAllTypes().then((types) => { return types.map((type) => { return html`
  • - + diff --git a/web/src/pages/outposts/ServiceConnectionListPage.ts b/web/src/pages/outposts/ServiceConnectionListPage.ts index 5adf433be..2002f54af 100644 --- a/web/src/pages/outposts/ServiceConnectionListPage.ts +++ b/web/src/pages/outposts/ServiceConnectionListPage.ts @@ -129,7 +129,7 @@ export class OutpostServiceConnectionListPage extends TablePage + type=${type.component}> diff --git a/web/src/pages/policies/PolicyListPage.ts b/web/src/pages/policies/PolicyListPage.ts index 2e2b2e153..219b7dd75 100644 --- a/web/src/pages/policies/PolicyListPage.ts +++ b/web/src/pages/policies/PolicyListPage.ts @@ -147,7 +147,7 @@ export class PolicyListPage extends TablePage { + type=${type.component}>