mirror of
https://github.com/goauthentik/authentik
synced 2026-04-25 17:15:26 +02:00
* endpoints: fix tasks failing Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
28 lines
786 B
Python
28 lines
786 B
Python
"""Endpoint tasks"""
|
|
|
|
from typing import Any
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
from dramatiq.actor import actor
|
|
from structlog.stdlib import get_logger
|
|
|
|
from authentik.endpoints.controller import Capabilities
|
|
from authentik.endpoints.models import Connector
|
|
|
|
LOGGER = get_logger()
|
|
|
|
|
|
@actor(description=_("Sync endpoints."))
|
|
def endpoints_sync(connector_pk: Any):
|
|
connector: Connector | None = (
|
|
Connector.objects.filter(pk=connector_pk).select_subclasses().first()
|
|
)
|
|
if not connector:
|
|
return
|
|
controller = connector.controller
|
|
ctrl = controller(connector)
|
|
if Capabilities.ENROLL_AUTOMATIC_API not in ctrl.capabilities():
|
|
return
|
|
LOGGER.info("Syncing connector", connector=connector.name)
|
|
ctrl.sync_endpoints()
|