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 <jens@goauthentik.io>

* format

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-05-17 16:19:33 +02:00 committed by GitHub
parent 68a1bcf233
commit 79dcc30778
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 4 deletions

View File

@ -4,8 +4,8 @@
{% block head %}
<script src="{% static 'dist/user/UserInterface.js' %}?version={{ version }}" type="module"></script>
<meta name="theme-color" content="#151515" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#151515" media="(prefers-color-scheme: dark)">
<meta name="theme-color" content="#1c1e21" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1c1e21" media="(prefers-color-scheme: dark)">
<link rel="icon" href="{{ tenant.branding_favicon }}">
<link rel="shortcut icon" href="{{ tenant.branding_favicon }}">
{% include "base/header_js.html" %}

View File

@ -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

View File

@ -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

View File

@ -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`<div slot="header" class="pf-c-banner pf-m-warning">
${t`Warning: Provider is not used by any Outpost.`}
</div>`
: html``}
<div class="pf-u-display-flex pf-u-justify-content-center">
<div class="pf-u-w-75">
<div class="pf-c-card">
@ -152,7 +157,7 @@ export class RadiusProviderViewPage extends AKElement {
<ak-object-changelog
targetModelPk=${this.provider.pk || ""}
targetModelApp="authentik_providers_radius"
targetModelName="RadiusProvider"
targetModelName="radiusprovider"
>
</ak-object-changelog>
</div>