authentik.admin.apps
authentik admin app config
1"""authentik admin app config""" 2 3from prometheus_client import Info 4 5from authentik.blueprints.apps import ManagedAppConfig 6from authentik.lib.config import CONFIG 7from authentik.lib.utils.time import fqdn_rand 8from authentik.tasks.schedules.common import ScheduleSpec 9 10PROM_INFO = Info("authentik_version", "Currently running authentik version") 11 12 13class AuthentikAdminConfig(ManagedAppConfig): 14 """authentik admin app config""" 15 16 name = "authentik.admin" 17 label = "authentik_admin" 18 verbose_name = "authentik Admin" 19 default = True 20 21 @ManagedAppConfig.reconcile_global 22 def clear_update_notifications(self): 23 """Clear update notifications on startup if the notification was for the version 24 we're running now.""" 25 from packaging.version import parse 26 27 from authentik.admin.tasks import LOCAL_VERSION 28 from authentik.events.models import EventAction, Notification 29 30 for notification in Notification.objects.filter(event__action=EventAction.UPDATE_AVAILABLE): 31 if "new_version" not in notification.event.context: 32 continue 33 notification_version = notification.event.context["new_version"] 34 if LOCAL_VERSION >= parse(notification_version): 35 notification.delete() 36 37 @property 38 def global_schedule_specs(self) -> list[ScheduleSpec]: 39 from authentik.admin.tasks import update_latest_version 40 41 return [ 42 ScheduleSpec( 43 actor=update_latest_version, 44 crontab=f"{fqdn_rand('admin_latest_version')} * * * *", 45 paused=CONFIG.get_bool("disable_update_check"), 46 ), 47 ]
PROM_INFO =
prometheus_client.metrics.Info(authentik_version)
14class AuthentikAdminConfig(ManagedAppConfig): 15 """authentik admin app config""" 16 17 name = "authentik.admin" 18 label = "authentik_admin" 19 verbose_name = "authentik Admin" 20 default = True 21 22 @ManagedAppConfig.reconcile_global 23 def clear_update_notifications(self): 24 """Clear update notifications on startup if the notification was for the version 25 we're running now.""" 26 from packaging.version import parse 27 28 from authentik.admin.tasks import LOCAL_VERSION 29 from authentik.events.models import EventAction, Notification 30 31 for notification in Notification.objects.filter(event__action=EventAction.UPDATE_AVAILABLE): 32 if "new_version" not in notification.event.context: 33 continue 34 notification_version = notification.event.context["new_version"] 35 if LOCAL_VERSION >= parse(notification_version): 36 notification.delete() 37 38 @property 39 def global_schedule_specs(self) -> list[ScheduleSpec]: 40 from authentik.admin.tasks import update_latest_version 41 42 return [ 43 ScheduleSpec( 44 actor=update_latest_version, 45 crontab=f"{fqdn_rand('admin_latest_version')} * * * *", 46 paused=CONFIG.get_bool("disable_update_check"), 47 ), 48 ]
authentik admin app config
name =
'authentik.admin'
@ManagedAppConfig.reconcile_global
def
clear_update_notifications(self):
22 @ManagedAppConfig.reconcile_global 23 def clear_update_notifications(self): 24 """Clear update notifications on startup if the notification was for the version 25 we're running now.""" 26 from packaging.version import parse 27 28 from authentik.admin.tasks import LOCAL_VERSION 29 from authentik.events.models import EventAction, Notification 30 31 for notification in Notification.objects.filter(event__action=EventAction.UPDATE_AVAILABLE): 32 if "new_version" not in notification.event.context: 33 continue 34 notification_version = notification.event.context["new_version"] 35 if LOCAL_VERSION >= parse(notification_version): 36 notification.delete()
Clear update notifications on startup if the notification was for the version we're running now.
global_schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
38 @property 39 def global_schedule_specs(self) -> list[ScheduleSpec]: 40 from authentik.admin.tasks import update_latest_version 41 42 return [ 43 ScheduleSpec( 44 actor=update_latest_version, 45 crontab=f"{fqdn_rand('admin_latest_version')} * * * *", 46 paused=CONFIG.get_bool("disable_update_check"), 47 ), 48 ]
Get a list of schedule specs that must exist in the default tenant