From 66a04aeec592830f6ab9e3e38c93ff1ad84e0566 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 30 May 2021 01:01:58 +0200 Subject: [PATCH] api: add can_geo_ip capability Signed-off-by: Jens Langhammer --- authentik/api/v2/config.py | 4 ++++ schema.yml | 1 + 2 files changed, 5 insertions(+) diff --git a/authentik/api/v2/config.py b/authentik/api/v2/config.py index 37b5287dd..e6de567f7 100644 --- a/authentik/api/v2/config.py +++ b/authentik/api/v2/config.py @@ -11,6 +11,7 @@ from rest_framework.response import Response from rest_framework.views import APIView from authentik.core.api.utils import PassiveSerializer +from authentik.events.geo import GEOIP_READER from authentik.lib.config import CONFIG @@ -18,6 +19,7 @@ class Capabilities(models.TextChoices): """Define capabilities which influence which APIs can/should be used""" CAN_SAVE_MEDIA = "can_save_media" + CAN_GEO_IP = "can_geo_ip" class ConfigSerializer(PassiveSerializer): @@ -41,6 +43,8 @@ class ConfigView(APIView): deb_test = settings.DEBUG or settings.TEST if path.ismount(settings.MEDIA_ROOT) or deb_test: caps.append(Capabilities.CAN_SAVE_MEDIA) + if GEOIP_READER: + caps.append(Capabilities.CAN_GEO_IP) return caps @extend_schema(responses={200: ConfigSerializer(many=False)}) diff --git a/schema.yml b/schema.yml index fe6e7d3ad..ae25606df 100644 --- a/schema.yml +++ b/schema.yml @@ -16185,6 +16185,7 @@ components: CapabilitiesEnum: enum: - can_save_media + - can_geo_ip type: string CaptchaChallenge: type: object