From 79dcc3077868d143f35e3e6afacd5d8ac0988fe8 Mon Sep 17 00:00:00 2001 From: Jens L Date: Wed, 17 May 2023 16:19:33 +0200 Subject: [PATCH] providers/radius: add warning message when radius provider is not used with outpost (#5656) * providers/radius: add warning message when radius provider is not used with outpost same message as Proxy and LDAP provider have Signed-off-by: Jens Langhammer * format Signed-off-by: Jens Langhammer --------- Signed-off-by: Jens Langhammer --- authentik/core/templates/if/user.html | 4 ++-- authentik/providers/radius/api.py | 5 ++++- schema.yml | 6 ++++++ web/src/admin/providers/radius/RadiusProviderViewPage.ts | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/authentik/core/templates/if/user.html b/authentik/core/templates/if/user.html index 39f882f41..98b59bfe3 100644 --- a/authentik/core/templates/if/user.html +++ b/authentik/core/templates/if/user.html @@ -4,8 +4,8 @@ {% block head %} - - + + {% include "base/header_js.html" %} diff --git a/authentik/providers/radius/api.py b/authentik/providers/radius/api.py index 30376a52b..d9a2578ce 100644 --- a/authentik/providers/radius/api.py +++ b/authentik/providers/radius/api.py @@ -1,5 +1,5 @@ """RadiusProvider API Views""" -from rest_framework.fields import CharField +from rest_framework.fields import CharField, ListField from rest_framework.serializers import ModelSerializer from rest_framework.viewsets import ModelViewSet, ReadOnlyModelViewSet @@ -11,6 +11,8 @@ from authentik.providers.radius.models import RadiusProvider class RadiusProviderSerializer(ProviderSerializer): """RadiusProvider Serializer""" + outpost_set = ListField(child=CharField(), read_only=True, source="outpost_set.all") + class Meta: model = RadiusProvider fields = ProviderSerializer.Meta.fields + [ @@ -18,6 +20,7 @@ class RadiusProviderSerializer(ProviderSerializer): # Shared secret is not a write-only field, as # an admin might have to view it "shared_secret", + "outpost_set", ] extra_kwargs = ProviderSerializer.Meta.extra_kwargs diff --git a/schema.yml b/schema.yml index 3a308de9d..4b758674e 100644 --- a/schema.yml +++ b/schema.yml @@ -38956,6 +38956,11 @@ components: shared_secret: type: string description: Shared secret between clients and server to hash packets. + outpost_set: + type: array + items: + type: string + readOnly: true required: - assigned_application_name - assigned_application_slug @@ -38965,6 +38970,7 @@ components: - component - meta_model_name - name + - outpost_set - pk - verbose_name - verbose_name_plural diff --git a/web/src/admin/providers/radius/RadiusProviderViewPage.ts b/web/src/admin/providers/radius/RadiusProviderViewPage.ts index 1e6de7747..67f6b73b8 100644 --- a/web/src/admin/providers/radius/RadiusProviderViewPage.ts +++ b/web/src/admin/providers/radius/RadiusProviderViewPage.ts @@ -79,6 +79,11 @@ export class RadiusProviderViewPage extends AKElement { data-tab-title="${t`Overview`}" class="pf-c-page__main-section pf-m-no-padding-mobile" > + ${this.provider?.outpostSet.length < 1 + ? html`
+ ${t`Warning: Provider is not used by any Outpost.`} +
` + : html``}
@@ -152,7 +157,7 @@ export class RadiusProviderViewPage extends AKElement {