diff --git a/authentik/lib/expression/__init__.py b/authentik/common/expression/__init__.py similarity index 100% rename from authentik/lib/expression/__init__.py rename to authentik/common/expression/__init__.py diff --git a/authentik/lib/expression/evaluator.py b/authentik/common/expression/evaluator.py similarity index 98% rename from authentik/lib/expression/evaluator.py rename to authentik/common/expression/evaluator.py index c20cacff1a..2b67cd08fe 100644 --- a/authentik/lib/expression/evaluator.py +++ b/authentik/common/expression/evaluator.py @@ -18,9 +18,9 @@ from sentry_sdk import start_span from sentry_sdk.tracing import Span from structlog.stdlib import get_logger -from authentik.core.models import User +from authentik.common.expression.exceptions import ControlFlowException +from authentik.core.models import AuthenticatedSession, User from authentik.events.models import Event -from authentik.lib.expression.exceptions import ControlFlowException from authentik.lib.utils.http import get_http_session from authentik.lib.utils.time import timedelta_from_string from authentik.policies.models import Policy, PolicyBinding diff --git a/authentik/lib/expression/exceptions.py b/authentik/common/expression/exceptions.py similarity index 100% rename from authentik/lib/expression/exceptions.py rename to authentik/common/expression/exceptions.py diff --git a/authentik/lib/sync/__init__.py b/authentik/common/sync/__init__.py similarity index 100% rename from authentik/lib/sync/__init__.py rename to authentik/common/sync/__init__.py diff --git a/authentik/lib/sync/mapper.py b/authentik/common/sync/mapper.py similarity index 97% rename from authentik/lib/sync/mapper.py rename to authentik/common/sync/mapper.py index 54bc83bc23..d988f2fe8a 100644 --- a/authentik/lib/sync/mapper.py +++ b/authentik/common/sync/mapper.py @@ -3,12 +3,12 @@ from collections.abc import Generator from django.db.models import QuerySet from django.http import HttpRequest +from authentik.common.expression.exceptions import ControlFlowException from authentik.core.expression.evaluator import PropertyMappingEvaluator from authentik.core.expression.exceptions import ( PropertyMappingExpressionException, ) from authentik.core.models import PropertyMapping, User -from authentik.lib.expression.exceptions import ControlFlowException class PropertyMappingManager: diff --git a/authentik/lib/sync/outgoing/__init__.py b/authentik/common/sync/outgoing/__init__.py similarity index 100% rename from authentik/lib/sync/outgoing/__init__.py rename to authentik/common/sync/outgoing/__init__.py diff --git a/authentik/lib/sync/outgoing/api.py b/authentik/common/sync/outgoing/api.py similarity index 98% rename from authentik/lib/sync/outgoing/api.py rename to authentik/common/sync/outgoing/api.py index ee6a3c8e03..ff1cc06094 100644 --- a/authentik/lib/sync/outgoing/api.py +++ b/authentik/common/sync/outgoing/api.py @@ -7,11 +7,11 @@ from rest_framework.fields import BooleanField, CharField, ChoiceField from rest_framework.request import Request from rest_framework.response import Response +from authentik.common.sync.outgoing.models import OutgoingSyncProvider from authentik.core.api.utils import ModelSerializer, PassiveSerializer from authentik.core.models import Group, User from authentik.events.api.tasks import SystemTaskSerializer from authentik.events.logs import LogEvent, LogEventSerializer -from authentik.lib.sync.outgoing.models import OutgoingSyncProvider from authentik.lib.utils.reflection import class_to_path from authentik.rbac.filters import ObjectFilter diff --git a/authentik/lib/sync/outgoing/base.py b/authentik/common/sync/outgoing/base.py similarity index 93% rename from authentik/lib/sync/outgoing/base.py rename to authentik/common/sync/outgoing/base.py index 77a70c643c..16150f8ee1 100644 --- a/authentik/lib/sync/outgoing/base.py +++ b/authentik/common/sync/outgoing/base.py @@ -7,19 +7,19 @@ from deepmerge import always_merger from django.db import DatabaseError from structlog.stdlib import get_logger +from authentik.common.expression.exceptions import ControlFlowException +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.exceptions import NotFoundSyncException, StopSync from authentik.core.expression.exceptions import ( PropertyMappingExpressionException, ) from authentik.events.models import Event, EventAction -from authentik.lib.expression.exceptions import ControlFlowException -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.exceptions import NotFoundSyncException, StopSync from authentik.lib.utils.errors import exception_to_string if TYPE_CHECKING: from django.db.models import Model - from authentik.lib.sync.outgoing.models import OutgoingSyncProvider + from authentik.common.sync.outgoing.models import OutgoingSyncProvider class Direction(StrEnum): diff --git a/authentik/lib/sync/outgoing/exceptions.py b/authentik/common/sync/outgoing/exceptions.py similarity index 100% rename from authentik/lib/sync/outgoing/exceptions.py rename to authentik/common/sync/outgoing/exceptions.py diff --git a/authentik/lib/sync/outgoing/models.py b/authentik/common/sync/outgoing/models.py similarity index 95% rename from authentik/lib/sync/outgoing/models.py rename to authentik/common/sync/outgoing/models.py index f1dad9de7b..e8d74ca409 100644 --- a/authentik/lib/sync/outgoing/models.py +++ b/authentik/common/sync/outgoing/models.py @@ -5,8 +5,8 @@ from django.db import connection, models from django.db.models import Model, QuerySet, TextChoices from django.utils.translation import gettext_lazy as _ +from authentik.common.sync.outgoing.base import BaseOutgoingSyncClient from authentik.core.models import Group, User -from authentik.lib.sync.outgoing.base import BaseOutgoingSyncClient class OutgoingSyncDeleteAction(TextChoices): diff --git a/authentik/lib/sync/outgoing/signals.py b/authentik/common/sync/outgoing/signals.py similarity index 94% rename from authentik/lib/sync/outgoing/signals.py rename to authentik/common/sync/outgoing/signals.py index 0fd8c63ff2..48234dcada 100644 --- a/authentik/lib/sync/outgoing/signals.py +++ b/authentik/common/sync/outgoing/signals.py @@ -5,10 +5,10 @@ from django.db.models import Model from django.db.models.query import Q from django.db.models.signals import m2m_changed, post_save, pre_delete +from authentik.common.sync.outgoing import PAGE_SIZE, PAGE_TIMEOUT +from authentik.common.sync.outgoing.base import Direction +from authentik.common.sync.outgoing.models import OutgoingSyncProvider from authentik.core.models import Group, User -from authentik.lib.sync.outgoing import PAGE_SIZE, PAGE_TIMEOUT -from authentik.lib.sync.outgoing.base import Direction -from authentik.lib.sync.outgoing.models import OutgoingSyncProvider from authentik.lib.utils.reflection import class_to_path diff --git a/authentik/lib/sync/outgoing/tasks.py b/authentik/common/sync/outgoing/tasks.py similarity index 98% rename from authentik/lib/sync/outgoing/tasks.py rename to authentik/common/sync/outgoing/tasks.py index 48cc4a6f31..b04692d293 100644 --- a/authentik/lib/sync/outgoing/tasks.py +++ b/authentik/common/sync/outgoing/tasks.py @@ -10,21 +10,21 @@ from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ from structlog.stdlib import BoundLogger, get_logger +from authentik.common.sync.outgoing import PAGE_SIZE, PAGE_TIMEOUT +from authentik.common.sync.outgoing.base import Direction +from authentik.common.sync.outgoing.exceptions import ( + BadRequestSyncException, + DryRunRejected, + StopSync, + TransientSyncException, +) +from authentik.common.sync.outgoing.models import OutgoingSyncProvider from authentik.core.expression.exceptions import SkipObjectException from authentik.core.models import Group, User from authentik.events.logs import LogEvent from authentik.events.models import TaskStatus from authentik.events.system_tasks import SystemTask from authentik.events.utils import sanitize_item -from authentik.lib.sync.outgoing import PAGE_SIZE, PAGE_TIMEOUT -from authentik.lib.sync.outgoing.base import Direction -from authentik.lib.sync.outgoing.exceptions import ( - BadRequestSyncException, - DryRunRejected, - StopSync, - TransientSyncException, -) -from authentik.lib.sync.outgoing.models import OutgoingSyncProvider from authentik.lib.utils.reflection import class_to_path, path_to_class diff --git a/authentik/core/expression/evaluator.py b/authentik/core/expression/evaluator.py index a02d7e96d5..98b459bf9b 100644 --- a/authentik/core/expression/evaluator.py +++ b/authentik/core/expression/evaluator.py @@ -7,10 +7,10 @@ from django.db.models import Model from django.http import HttpRequest from prometheus_client import Histogram +from authentik.common.expression.evaluator import BaseEvaluator from authentik.core.expression.exceptions import SkipObjectException from authentik.core.models import User from authentik.events.models import Event, EventAction -from authentik.lib.expression.evaluator import BaseEvaluator from authentik.lib.utils.errors import exception_to_string from authentik.policies.types import PolicyRequest diff --git a/authentik/core/expression/exceptions.py b/authentik/core/expression/exceptions.py index b45987175c..07e178f1d0 100644 --- a/authentik/core/expression/exceptions.py +++ b/authentik/core/expression/exceptions.py @@ -1,6 +1,6 @@ """authentik core exceptions""" -from authentik.lib.expression.exceptions import ControlFlowException +from authentik.common.expression.exceptions import ControlFlowException from authentik.lib.sentry import SentryIgnoredException diff --git a/authentik/core/models.py b/authentik/core/models.py index 1b3c120517..e1e038550b 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -26,10 +26,10 @@ from rest_framework.serializers import Serializer from structlog.stdlib import get_logger from authentik.blueprints.models import ManagedModel +from authentik.common.expression.exceptions import ControlFlowException from authentik.core.expression.exceptions import PropertyMappingExpressionException from authentik.core.types import UILoginButton, UserSettingSerializer from authentik.lib.avatars import get_avatar -from authentik.lib.expression.exceptions import ControlFlowException from authentik.lib.generators import generate_id from authentik.lib.merge import MERGE_LIST_UNIQUE from authentik.lib.models import ( diff --git a/authentik/core/sources/mapper.py b/authentik/core/sources/mapper.py index 8e163edae4..8584c1e30b 100644 --- a/authentik/core/sources/mapper.py +++ b/authentik/core/sources/mapper.py @@ -3,11 +3,11 @@ from typing import Any from django.http import HttpRequest from structlog.stdlib import get_logger +from authentik.common.sync.mapper import PropertyMappingManager from authentik.core.expression.exceptions import PropertyMappingExpressionException from authentik.core.models import Group, PropertyMapping, Source, User from authentik.events.models import Event, EventAction from authentik.lib.merge import MERGE_LIST_UNIQUE -from authentik.lib.sync.mapper import PropertyMappingManager from authentik.policies.utils import delete_none_values LOGGER = get_logger() diff --git a/authentik/enterprise/providers/google_workspace/api/groups.py b/authentik/enterprise/providers/google_workspace/api/groups.py index 28d5eecc89..74f113ca75 100644 --- a/authentik/enterprise/providers/google_workspace/api/groups.py +++ b/authentik/enterprise/providers/google_workspace/api/groups.py @@ -3,11 +3,11 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.used_by import UsedByMixin from authentik.core.api.users import UserGroupSerializer from authentik.core.api.utils import ModelSerializer from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProviderGroup -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin class GoogleWorkspaceProviderGroupSerializer(ModelSerializer): diff --git a/authentik/enterprise/providers/google_workspace/api/providers.py b/authentik/enterprise/providers/google_workspace/api/providers.py index 772789ce05..563514afff 100644 --- a/authentik/enterprise/providers/google_workspace/api/providers.py +++ b/authentik/enterprise/providers/google_workspace/api/providers.py @@ -2,6 +2,7 @@ from rest_framework.viewsets import ModelViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncProviderStatusMixin from authentik.core.api.providers import ProviderSerializer from authentik.core.api.used_by import UsedByMixin from authentik.enterprise.api import EnterpriseRequiredMixin @@ -10,7 +11,6 @@ from authentik.enterprise.providers.google_workspace.tasks import ( google_workspace_sync, google_workspace_sync_objects, ) -from authentik.lib.sync.outgoing.api import OutgoingSyncProviderStatusMixin class GoogleWorkspaceProviderSerializer(EnterpriseRequiredMixin, ProviderSerializer): diff --git a/authentik/enterprise/providers/google_workspace/api/users.py b/authentik/enterprise/providers/google_workspace/api/users.py index a04dd58ae1..d57824da86 100644 --- a/authentik/enterprise/providers/google_workspace/api/users.py +++ b/authentik/enterprise/providers/google_workspace/api/users.py @@ -3,11 +3,11 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.groups import GroupMemberSerializer from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import ModelSerializer from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProviderUser -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin class GoogleWorkspaceProviderUserSerializer(ModelSerializer): diff --git a/authentik/enterprise/providers/google_workspace/clients/base.py b/authentik/enterprise/providers/google_workspace/clients/base.py index fc126ef219..61b2f91314 100644 --- a/authentik/enterprise/providers/google_workspace/clients/base.py +++ b/authentik/enterprise/providers/google_workspace/clients/base.py @@ -6,10 +6,9 @@ from googleapiclient.errors import Error, HttpError from googleapiclient.http import HttpRequest from httplib2 import HttpLib2Error, HttpLib2ErrorWithResponse -from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProvider -from authentik.lib.sync.outgoing import HTTP_CONFLICT -from authentik.lib.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.exceptions import ( +from authentik.common.sync.outgoing import HTTP_CONFLICT +from authentik.common.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient +from authentik.common.sync.outgoing.exceptions import ( BadRequestSyncException, DryRunRejected, NotFoundSyncException, @@ -17,6 +16,7 @@ from authentik.lib.sync.outgoing.exceptions import ( StopSync, TransientSyncException, ) +from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProvider class GoogleWorkspaceSyncClient[TModel: Model, TConnection: Model, TSchema: dict]( diff --git a/authentik/enterprise/providers/google_workspace/clients/groups.py b/authentik/enterprise/providers/google_workspace/clients/groups.py index de85d96c59..8144913873 100644 --- a/authentik/enterprise/providers/google_workspace/clients/groups.py +++ b/authentik/enterprise/providers/google_workspace/clients/groups.py @@ -1,6 +1,14 @@ from django.db import transaction from django.utils.text import slugify +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.base import Direction +from authentik.common.sync.outgoing.exceptions import ( + NotFoundSyncException, + ObjectExistsSyncException, + TransientSyncException, +) +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Group from authentik.enterprise.providers.google_workspace.clients.base import GoogleWorkspaceSyncClient from authentik.enterprise.providers.google_workspace.models import ( @@ -9,14 +17,6 @@ from authentik.enterprise.providers.google_workspace.models import ( GoogleWorkspaceProviderMapping, GoogleWorkspaceProviderUser, ) -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.base import Direction -from authentik.lib.sync.outgoing.exceptions import ( - NotFoundSyncException, - ObjectExistsSyncException, - TransientSyncException, -) -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction class GoogleWorkspaceGroupClient( diff --git a/authentik/enterprise/providers/google_workspace/clients/users.py b/authentik/enterprise/providers/google_workspace/clients/users.py index 3c6206a4ec..77d9ed547d 100644 --- a/authentik/enterprise/providers/google_workspace/clients/users.py +++ b/authentik/enterprise/providers/google_workspace/clients/users.py @@ -1,5 +1,11 @@ from django.db import transaction +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.exceptions import ( + ObjectExistsSyncException, + TransientSyncException, +) +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import User from authentik.enterprise.providers.google_workspace.clients.base import GoogleWorkspaceSyncClient from authentik.enterprise.providers.google_workspace.models import ( @@ -7,12 +13,6 @@ from authentik.enterprise.providers.google_workspace.models import ( GoogleWorkspaceProviderMapping, GoogleWorkspaceProviderUser, ) -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.exceptions import ( - ObjectExistsSyncException, - TransientSyncException, -) -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.policies.utils import delete_none_values diff --git a/authentik/enterprise/providers/google_workspace/models.py b/authentik/enterprise/providers/google_workspace/models.py index e5ab263039..66f3c48ade 100644 --- a/authentik/enterprise/providers/google_workspace/models.py +++ b/authentik/enterprise/providers/google_workspace/models.py @@ -10,6 +10,8 @@ from django.utils.translation import gettext_lazy as _ from google.oauth2.service_account import Credentials from rest_framework.serializers import Serializer +from authentik.common.sync.outgoing.base import BaseOutgoingSyncClient +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction, OutgoingSyncProvider from authentik.core.models import ( BackchannelProvider, Group, @@ -18,8 +20,6 @@ from authentik.core.models import ( UserTypes, ) from authentik.lib.models import SerializerModel, internal_model -from authentik.lib.sync.outgoing.base import BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction, OutgoingSyncProvider def default_scopes() -> list[str]: diff --git a/authentik/enterprise/providers/google_workspace/signals.py b/authentik/enterprise/providers/google_workspace/signals.py index 2e7eb70a94..5dd75a6f0d 100644 --- a/authentik/enterprise/providers/google_workspace/signals.py +++ b/authentik/enterprise/providers/google_workspace/signals.py @@ -1,12 +1,12 @@ """Google provider signals""" +from authentik.common.sync.outgoing.signals import register_signals from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProvider from authentik.enterprise.providers.google_workspace.tasks import ( google_workspace_sync, google_workspace_sync_direct, google_workspace_sync_m2m, ) -from authentik.lib.sync.outgoing.signals import register_signals register_signals( GoogleWorkspaceProvider, diff --git a/authentik/enterprise/providers/google_workspace/tasks.py b/authentik/enterprise/providers/google_workspace/tasks.py index 237076411a..172fd8d3d7 100644 --- a/authentik/enterprise/providers/google_workspace/tasks.py +++ b/authentik/enterprise/providers/google_workspace/tasks.py @@ -1,9 +1,9 @@ """Google Provider tasks""" +from authentik.common.sync.outgoing.exceptions import TransientSyncException +from authentik.common.sync.outgoing.tasks import SyncTasks from authentik.enterprise.providers.google_workspace.models import GoogleWorkspaceProvider from authentik.events.system_tasks import SystemTask -from authentik.lib.sync.outgoing.exceptions import TransientSyncException -from authentik.lib.sync.outgoing.tasks import SyncTasks from authentik.root.celery import CELERY_APP sync_tasks = SyncTasks(GoogleWorkspaceProvider) diff --git a/authentik/enterprise/providers/google_workspace/tests/test_groups.py b/authentik/enterprise/providers/google_workspace/tests/test_groups.py index fbc52a94aa..2af29cbc85 100644 --- a/authentik/enterprise/providers/google_workspace/tests/test_groups.py +++ b/authentik/enterprise/providers/google_workspace/tests/test_groups.py @@ -5,6 +5,7 @@ from unittest.mock import MagicMock, patch from django.test import TestCase from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Application, Group, User from authentik.core.tests.utils import create_test_user from authentik.enterprise.providers.google_workspace.clients.test_http import MockHTTP @@ -16,7 +17,6 @@ from authentik.enterprise.providers.google_workspace.models import ( from authentik.enterprise.providers.google_workspace.tasks import google_workspace_sync from authentik.events.models import Event, EventAction from authentik.lib.generators import generate_id -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.lib.tests.utils import load_fixture from authentik.tenants.models import Tenant diff --git a/authentik/enterprise/providers/google_workspace/tests/test_users.py b/authentik/enterprise/providers/google_workspace/tests/test_users.py index 0f7ec0d14e..42a0e74b48 100644 --- a/authentik/enterprise/providers/google_workspace/tests/test_users.py +++ b/authentik/enterprise/providers/google_workspace/tests/test_users.py @@ -6,6 +6,7 @@ from unittest.mock import MagicMock, patch from django.test import TestCase from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Application, Group, User from authentik.enterprise.providers.google_workspace.clients.test_http import MockHTTP from authentik.enterprise.providers.google_workspace.models import ( @@ -16,7 +17,6 @@ from authentik.enterprise.providers.google_workspace.models import ( from authentik.enterprise.providers.google_workspace.tasks import google_workspace_sync from authentik.events.models import Event, EventAction from authentik.lib.generators import generate_id -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.lib.tests.utils import load_fixture from authentik.tenants.models import Tenant diff --git a/authentik/enterprise/providers/microsoft_entra/api/groups.py b/authentik/enterprise/providers/microsoft_entra/api/groups.py index 596ea4f8fc..20f55aaf3f 100644 --- a/authentik/enterprise/providers/microsoft_entra/api/groups.py +++ b/authentik/enterprise/providers/microsoft_entra/api/groups.py @@ -3,11 +3,11 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.used_by import UsedByMixin from authentik.core.api.users import UserGroupSerializer from authentik.core.api.utils import ModelSerializer from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProviderGroup -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin class MicrosoftEntraProviderGroupSerializer(ModelSerializer): diff --git a/authentik/enterprise/providers/microsoft_entra/api/providers.py b/authentik/enterprise/providers/microsoft_entra/api/providers.py index f1a9396e9d..f223db0d9c 100644 --- a/authentik/enterprise/providers/microsoft_entra/api/providers.py +++ b/authentik/enterprise/providers/microsoft_entra/api/providers.py @@ -2,6 +2,7 @@ from rest_framework.viewsets import ModelViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncProviderStatusMixin from authentik.core.api.providers import ProviderSerializer from authentik.core.api.used_by import UsedByMixin from authentik.enterprise.api import EnterpriseRequiredMixin @@ -10,7 +11,6 @@ from authentik.enterprise.providers.microsoft_entra.tasks import ( microsoft_entra_sync, microsoft_entra_sync_objects, ) -from authentik.lib.sync.outgoing.api import OutgoingSyncProviderStatusMixin class MicrosoftEntraProviderSerializer(EnterpriseRequiredMixin, ProviderSerializer): diff --git a/authentik/enterprise/providers/microsoft_entra/api/users.py b/authentik/enterprise/providers/microsoft_entra/api/users.py index b42971c058..f08e30d70b 100644 --- a/authentik/enterprise/providers/microsoft_entra/api/users.py +++ b/authentik/enterprise/providers/microsoft_entra/api/users.py @@ -3,11 +3,11 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.groups import GroupMemberSerializer from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import ModelSerializer from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProviderUser -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin class MicrosoftEntraProviderUserSerializer(ModelSerializer): diff --git a/authentik/enterprise/providers/microsoft_entra/clients/base.py b/authentik/enterprise/providers/microsoft_entra/clients/base.py index e29676ddec..b1727954ba 100644 --- a/authentik/enterprise/providers/microsoft_entra/clients/base.py +++ b/authentik/enterprise/providers/microsoft_entra/clients/base.py @@ -25,11 +25,9 @@ from msgraph.graph_service_client import GraphServiceClient from msgraph_core import GraphClientFactory from opentelemetry import trace -from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProvider -from authentik.events.utils import sanitize_item -from authentik.lib.sync.outgoing import HTTP_CONFLICT -from authentik.lib.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.exceptions import ( +from authentik.common.sync.outgoing import HTTP_CONFLICT +from authentik.common.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient +from authentik.common.sync.outgoing.exceptions import ( BadRequestSyncException, DryRunRejected, NotFoundSyncException, @@ -37,6 +35,8 @@ from authentik.lib.sync.outgoing.exceptions import ( StopSync, TransientSyncException, ) +from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProvider +from authentik.events.utils import sanitize_item class AuthentikRequestAdapter(GraphRequestAdapter): diff --git a/authentik/enterprise/providers/microsoft_entra/clients/groups.py b/authentik/enterprise/providers/microsoft_entra/clients/groups.py index 2cb135822f..0f0c00637d 100644 --- a/authentik/enterprise/providers/microsoft_entra/clients/groups.py +++ b/authentik/enterprise/providers/microsoft_entra/clients/groups.py @@ -4,6 +4,15 @@ from msgraph.generated.groups.groups_request_builder import GroupsRequestBuilder from msgraph.generated.models.group import Group as MSGroup from msgraph.generated.models.reference_create import ReferenceCreate +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.base import Direction +from authentik.common.sync.outgoing.exceptions import ( + NotFoundSyncException, + ObjectExistsSyncException, + StopSync, + TransientSyncException, +) +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Group from authentik.enterprise.providers.microsoft_entra.clients.base import MicrosoftEntraSyncClient from authentik.enterprise.providers.microsoft_entra.models import ( @@ -12,15 +21,6 @@ from authentik.enterprise.providers.microsoft_entra.models import ( MicrosoftEntraProviderMapping, MicrosoftEntraProviderUser, ) -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.base import Direction -from authentik.lib.sync.outgoing.exceptions import ( - NotFoundSyncException, - ObjectExistsSyncException, - StopSync, - TransientSyncException, -) -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction class MicrosoftEntraGroupClient( diff --git a/authentik/enterprise/providers/microsoft_entra/clients/users.py b/authentik/enterprise/providers/microsoft_entra/clients/users.py index a650b42a52..f9da0bc998 100644 --- a/authentik/enterprise/providers/microsoft_entra/clients/users.py +++ b/authentik/enterprise/providers/microsoft_entra/clients/users.py @@ -3,6 +3,13 @@ from django.db import transaction from msgraph.generated.models.user import User as MSUser from msgraph.generated.users.users_request_builder import UsersRequestBuilder +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.exceptions import ( + ObjectExistsSyncException, + StopSync, + TransientSyncException, +) +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import User from authentik.enterprise.providers.microsoft_entra.clients.base import MicrosoftEntraSyncClient from authentik.enterprise.providers.microsoft_entra.models import ( @@ -10,13 +17,6 @@ from authentik.enterprise.providers.microsoft_entra.models import ( MicrosoftEntraProviderMapping, MicrosoftEntraProviderUser, ) -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.exceptions import ( - ObjectExistsSyncException, - StopSync, - TransientSyncException, -) -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.policies.utils import delete_none_values diff --git a/authentik/enterprise/providers/microsoft_entra/models.py b/authentik/enterprise/providers/microsoft_entra/models.py index a5dac7e74b..07dbbce3b4 100644 --- a/authentik/enterprise/providers/microsoft_entra/models.py +++ b/authentik/enterprise/providers/microsoft_entra/models.py @@ -10,6 +10,8 @@ from django.templatetags.static import static from django.utils.translation import gettext_lazy as _ from rest_framework.serializers import Serializer +from authentik.common.sync.outgoing.base import BaseOutgoingSyncClient +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction, OutgoingSyncProvider from authentik.core.models import ( BackchannelProvider, Group, @@ -18,8 +20,6 @@ from authentik.core.models import ( UserTypes, ) from authentik.lib.models import SerializerModel, internal_model -from authentik.lib.sync.outgoing.base import BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction, OutgoingSyncProvider @internal_model diff --git a/authentik/enterprise/providers/microsoft_entra/signals.py b/authentik/enterprise/providers/microsoft_entra/signals.py index b9063ccb8b..079e4f65ab 100644 --- a/authentik/enterprise/providers/microsoft_entra/signals.py +++ b/authentik/enterprise/providers/microsoft_entra/signals.py @@ -1,12 +1,12 @@ """Microsoft provider signals""" +from authentik.common.sync.outgoing.signals import register_signals from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProvider from authentik.enterprise.providers.microsoft_entra.tasks import ( microsoft_entra_sync, microsoft_entra_sync_direct, microsoft_entra_sync_m2m, ) -from authentik.lib.sync.outgoing.signals import register_signals register_signals( MicrosoftEntraProvider, diff --git a/authentik/enterprise/providers/microsoft_entra/tasks.py b/authentik/enterprise/providers/microsoft_entra/tasks.py index 6985b8acfa..2df4bfc573 100644 --- a/authentik/enterprise/providers/microsoft_entra/tasks.py +++ b/authentik/enterprise/providers/microsoft_entra/tasks.py @@ -1,9 +1,9 @@ """Microsoft Entra Provider tasks""" +from authentik.common.sync.outgoing.exceptions import TransientSyncException +from authentik.common.sync.outgoing.tasks import SyncTasks from authentik.enterprise.providers.microsoft_entra.models import MicrosoftEntraProvider from authentik.events.system_tasks import SystemTask -from authentik.lib.sync.outgoing.exceptions import TransientSyncException -from authentik.lib.sync.outgoing.tasks import SyncTasks from authentik.root.celery import CELERY_APP sync_tasks = SyncTasks(MicrosoftEntraProvider) diff --git a/authentik/enterprise/providers/microsoft_entra/tests/test_groups.py b/authentik/enterprise/providers/microsoft_entra/tests/test_groups.py index c39d0ca206..e05a9d9908 100644 --- a/authentik/enterprise/providers/microsoft_entra/tests/test_groups.py +++ b/authentik/enterprise/providers/microsoft_entra/tests/test_groups.py @@ -13,6 +13,7 @@ from msgraph.generated.models.user_collection_response import UserCollectionResp from msgraph.generated.models.verified_domain import VerifiedDomain from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Application, Group, User from authentik.core.tests.utils import create_test_user from authentik.enterprise.providers.microsoft_entra.models import ( @@ -24,7 +25,6 @@ from authentik.enterprise.providers.microsoft_entra.models import ( from authentik.enterprise.providers.microsoft_entra.tasks import microsoft_entra_sync from authentik.events.models import Event, EventAction from authentik.lib.generators import generate_id -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.tenants.models import Tenant diff --git a/authentik/enterprise/providers/microsoft_entra/tests/test_users.py b/authentik/enterprise/providers/microsoft_entra/tests/test_users.py index 8c46e998aa..4a51171191 100644 --- a/authentik/enterprise/providers/microsoft_entra/tests/test_users.py +++ b/authentik/enterprise/providers/microsoft_entra/tests/test_users.py @@ -13,6 +13,7 @@ from msgraph.generated.models.verified_domain import VerifiedDomain from rest_framework.test import APITestCase from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.core.models import Application, Group, User from authentik.core.tests.utils import create_test_admin_user from authentik.enterprise.providers.microsoft_entra.models import ( @@ -23,7 +24,6 @@ from authentik.enterprise.providers.microsoft_entra.models import ( from authentik.enterprise.providers.microsoft_entra.tasks import microsoft_entra_sync from authentik.events.models import Event, EventAction from authentik.lib.generators import generate_id -from authentik.lib.sync.outgoing.models import OutgoingSyncDeleteAction from authentik.tenants.models import Tenant diff --git a/authentik/lib/tests/test_evaluator.py b/authentik/lib/tests/test_evaluator.py index 73f35f089b..6953f9d1ef 100644 --- a/authentik/lib/tests/test_evaluator.py +++ b/authentik/lib/tests/test_evaluator.py @@ -5,9 +5,9 @@ from django.urls import reverse from jwt import decode from authentik.blueprints.tests import apply_blueprint +from authentik.common.expression.evaluator import BaseEvaluator from authentik.core.tests.utils import create_test_admin_user, create_test_flow, create_test_user from authentik.events.models import Event -from authentik.lib.expression.evaluator import BaseEvaluator from authentik.lib.generators import generate_id from authentik.providers.oauth2.models import OAuth2Provider, ScopeMapping diff --git a/authentik/policies/expression/evaluator.py b/authentik/policies/expression/evaluator.py index 536b2634d8..95dab88e8d 100644 --- a/authentik/policies/expression/evaluator.py +++ b/authentik/policies/expression/evaluator.py @@ -6,8 +6,8 @@ from typing import TYPE_CHECKING, Optional from django.http import HttpRequest from structlog.stdlib import get_logger +from authentik.common.expression.evaluator import BaseEvaluator from authentik.flows.planner import PLAN_CONTEXT_SSO -from authentik.lib.expression.evaluator import BaseEvaluator from authentik.policies.exceptions import PolicyException from authentik.policies.types import PolicyRequest, PolicyResult from authentik.root.middleware import ClientIPMiddleware diff --git a/authentik/providers/radius/api/providers.py b/authentik/providers/radius/api/providers.py index 0ab9d04a10..e0e6b55a93 100644 --- a/authentik/providers/radius/api/providers.py +++ b/authentik/providers/radius/api/providers.py @@ -15,14 +15,14 @@ from rest_framework.request import Request from rest_framework.response import Response from rest_framework.viewsets import GenericViewSet, ModelViewSet +from authentik.common.expression.exceptions import ControlFlowException +from authentik.common.sync.mapper import PropertyMappingManager from authentik.core.api.providers import ProviderSerializer from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import ModelSerializer, PassiveSerializer from authentik.core.expression.exceptions import PropertyMappingExpressionException from authentik.core.models import Application from authentik.events.models import Event, EventAction -from authentik.lib.expression.exceptions import ControlFlowException -from authentik.lib.sync.mapper import PropertyMappingManager from authentik.lib.utils.errors import exception_to_string from authentik.policies.api.exec import PolicyTestResultSerializer from authentik.policies.engine import PolicyEngine diff --git a/authentik/providers/scim/api/groups.py b/authentik/providers/scim/api/groups.py index 8a31da3e9c..52a3ec82b2 100644 --- a/authentik/providers/scim/api/groups.py +++ b/authentik/providers/scim/api/groups.py @@ -3,10 +3,10 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.used_by import UsedByMixin from authentik.core.api.users import UserGroupSerializer from authentik.core.api.utils import ModelSerializer -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.providers.scim.models import SCIMProviderGroup diff --git a/authentik/providers/scim/api/providers.py b/authentik/providers/scim/api/providers.py index 350473d646..193c3dd681 100644 --- a/authentik/providers/scim/api/providers.py +++ b/authentik/providers/scim/api/providers.py @@ -2,9 +2,9 @@ from rest_framework.viewsets import ModelViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncProviderStatusMixin from authentik.core.api.providers import ProviderSerializer from authentik.core.api.used_by import UsedByMixin -from authentik.lib.sync.outgoing.api import OutgoingSyncProviderStatusMixin from authentik.providers.scim.models import SCIMProvider from authentik.providers.scim.tasks import scim_sync, scim_sync_objects diff --git a/authentik/providers/scim/api/users.py b/authentik/providers/scim/api/users.py index f31574a2d4..6626e61eb9 100644 --- a/authentik/providers/scim/api/users.py +++ b/authentik/providers/scim/api/users.py @@ -3,10 +3,10 @@ from rest_framework import mixins from rest_framework.viewsets import GenericViewSet +from authentik.common.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.core.api.groups import GroupMemberSerializer from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import ModelSerializer -from authentik.lib.sync.outgoing.api import OutgoingSyncConnectionCreateMixin from authentik.providers.scim.models import SCIMProviderUser diff --git a/authentik/providers/scim/clients/base.py b/authentik/providers/scim/clients/base.py index b4f46df350..0d796dbcc7 100644 --- a/authentik/providers/scim/clients/base.py +++ b/authentik/providers/scim/clients/base.py @@ -7,14 +7,14 @@ from pydantic import ValidationError from requests import RequestException, Session from authentik.common.scim.schema import ServiceProviderConfiguration -from authentik.lib.sync.outgoing import ( +from authentik.common.sync.outgoing import ( HTTP_CONFLICT, HTTP_NO_CONTENT, HTTP_SERVICE_UNAVAILABLE, HTTP_TOO_MANY_REQUESTS, ) -from authentik.lib.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.exceptions import ( +from authentik.common.sync.outgoing.base import SAFE_METHODS, BaseOutgoingSyncClient +from authentik.common.sync.outgoing.exceptions import ( DryRunRejected, NotFoundSyncException, ObjectExistsSyncException, diff --git a/authentik/providers/scim/clients/exceptions.py b/authentik/providers/scim/clients/exceptions.py index 93adaea750..88f79ef602 100644 --- a/authentik/providers/scim/clients/exceptions.py +++ b/authentik/providers/scim/clients/exceptions.py @@ -4,7 +4,7 @@ from pydantic import ValidationError from requests import Response from authentik.common.scim.schema import SCIMError -from authentik.lib.sync.outgoing.exceptions import TransientSyncException +from authentik.common.sync.outgoing.exceptions import TransientSyncException class SCIMRequestException(TransientSyncException): diff --git a/authentik/providers/scim/clients/groups.py b/authentik/providers/scim/clients/groups.py index ef3cdc2edb..37a716d08a 100644 --- a/authentik/providers/scim/clients/groups.py +++ b/authentik/providers/scim/clients/groups.py @@ -9,14 +9,14 @@ from pydanticscim.responses import PatchOp from authentik.common.scim.schema import SCIM_GROUP_SCHEMA, PatchOperation, PatchRequest from authentik.common.scim.schema import Group as SCIMGroupSchema -from authentik.core.models import Group -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.base import Direction -from authentik.lib.sync.outgoing.exceptions import ( +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.base import Direction +from authentik.common.sync.outgoing.exceptions import ( NotFoundSyncException, ObjectExistsSyncException, StopSync, ) +from authentik.core.models import Group from authentik.policies.utils import delete_none_values from authentik.providers.scim.clients.base import SCIMClient from authentik.providers.scim.clients.exceptions import ( diff --git a/authentik/providers/scim/clients/users.py b/authentik/providers/scim/clients/users.py index e6f16b329d..aab3bf57a3 100644 --- a/authentik/providers/scim/clients/users.py +++ b/authentik/providers/scim/clients/users.py @@ -6,9 +6,9 @@ from pydantic import ValidationError from authentik.common.scim.schema import SCIM_USER_SCHEMA from authentik.common.scim.schema import User as SCIMUserSchema +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.exceptions import ObjectExistsSyncException, StopSync from authentik.core.models import User -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.exceptions import ObjectExistsSyncException, StopSync from authentik.policies.utils import delete_none_values from authentik.providers.scim.clients.base import SCIMClient from authentik.providers.scim.models import SCIMMapping, SCIMProvider, SCIMProviderUser diff --git a/authentik/providers/scim/models.py b/authentik/providers/scim/models.py index ed53fc3c93..dc35674262 100644 --- a/authentik/providers/scim/models.py +++ b/authentik/providers/scim/models.py @@ -9,10 +9,10 @@ from django.templatetags.static import static from django.utils.translation import gettext_lazy as _ from rest_framework.serializers import Serializer +from authentik.common.sync.outgoing.base import BaseOutgoingSyncClient +from authentik.common.sync.outgoing.models import OutgoingSyncProvider from authentik.core.models import BackchannelProvider, Group, PropertyMapping, User, UserTypes from authentik.lib.models import SerializerModel, internal_model -from authentik.lib.sync.outgoing.base import BaseOutgoingSyncClient -from authentik.lib.sync.outgoing.models import OutgoingSyncProvider @internal_model diff --git a/authentik/providers/scim/signals.py b/authentik/providers/scim/signals.py index be9855f26d..fc46269ed4 100644 --- a/authentik/providers/scim/signals.py +++ b/authentik/providers/scim/signals.py @@ -1,6 +1,6 @@ """SCIM provider signals""" -from authentik.lib.sync.outgoing.signals import register_signals +from authentik.common.sync.outgoing.signals import register_signals from authentik.providers.scim.models import SCIMProvider from authentik.providers.scim.tasks import scim_sync, scim_sync_direct, scim_sync_m2m diff --git a/authentik/providers/scim/tasks.py b/authentik/providers/scim/tasks.py index f3c2e4d493..f74c39865c 100644 --- a/authentik/providers/scim/tasks.py +++ b/authentik/providers/scim/tasks.py @@ -1,8 +1,8 @@ """SCIM Provider tasks""" +from authentik.common.sync.outgoing.exceptions import TransientSyncException +from authentik.common.sync.outgoing.tasks import SyncTasks from authentik.events.system_tasks import SystemTask -from authentik.lib.sync.outgoing.exceptions import TransientSyncException -from authentik.lib.sync.outgoing.tasks import SyncTasks from authentik.providers.scim.models import SCIMProvider from authentik.root.celery import CELERY_APP diff --git a/authentik/providers/scim/tests/test_user.py b/authentik/providers/scim/tests/test_user.py index c7fc2c7c40..cc8cd0e5e7 100644 --- a/authentik/providers/scim/tests/test_user.py +++ b/authentik/providers/scim/tests/test_user.py @@ -8,10 +8,10 @@ from jsonschema import validate from requests_mock import Mocker from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.base import SAFE_METHODS from authentik.core.models import Application, Group, User from authentik.events.models import SystemTask from authentik.lib.generators import generate_id -from authentik.lib.sync.outgoing.base import SAFE_METHODS from authentik.providers.scim.models import SCIMMapping, SCIMProvider from authentik.providers.scim.tasks import scim_sync, sync_tasks from authentik.tenants.models import Tenant diff --git a/authentik/sources/kerberos/sync.py b/authentik/sources/kerberos/sync.py index 492c706a43..0d917b8103 100644 --- a/authentik/sources/kerberos/sync.py +++ b/authentik/sources/kerberos/sync.py @@ -7,6 +7,8 @@ from django.db import IntegrityError, transaction from kadmin import KAdmin from structlog.stdlib import BoundLogger, get_logger +from authentik.common.sync.mapper import PropertyMappingManager +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.core.expression.exceptions import ( PropertyMappingExpressionException, SkipObjectException, @@ -15,8 +17,6 @@ from authentik.core.models import Group, User, UserTypes from authentik.core.sources.mapper import SourceMapper from authentik.core.sources.matcher import Action, SourceMatcher from authentik.events.models import Event, EventAction -from authentik.lib.sync.mapper import PropertyMappingManager -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.sources.kerberos.models import ( GroupKerberosSourceConnection, KerberosSource, diff --git a/authentik/sources/kerberos/tasks.py b/authentik/sources/kerberos/tasks.py index 93570c11c4..189114a094 100644 --- a/authentik/sources/kerberos/tasks.py +++ b/authentik/sources/kerberos/tasks.py @@ -3,11 +3,11 @@ from django.core.cache import cache from structlog.stdlib import get_logger +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.events.models import SystemTask as DBSystemTask from authentik.events.models import TaskStatus from authentik.events.system_tasks import SystemTask from authentik.lib.config import CONFIG -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.lib.utils.errors import exception_to_string from authentik.root.celery import CELERY_APP from authentik.sources.kerberos.models import KerberosSource diff --git a/authentik/sources/ldap/api.py b/authentik/sources/ldap/api.py index 167bb2059a..d44ee97f7b 100644 --- a/authentik/sources/ldap/api.py +++ b/authentik/sources/ldap/api.py @@ -14,6 +14,7 @@ from rest_framework.request import Request from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet +from authentik.common.sync.outgoing.api import SyncStatusSerializer from authentik.core.api.property_mappings import PropertyMappingFilterSet, PropertyMappingSerializer from authentik.core.api.sources import ( GroupSourceConnectionSerializer, @@ -24,7 +25,6 @@ from authentik.core.api.sources import ( ) from authentik.core.api.used_by import UsedByMixin from authentik.crypto.models import CertificateKeyPair -from authentik.lib.sync.outgoing.api import SyncStatusSerializer from authentik.sources.ldap.models import ( GroupLDAPSourceConnection, LDAPSource, diff --git a/authentik/sources/ldap/sync/base.py b/authentik/sources/ldap/sync/base.py index 5fa7d699bf..d653fca07b 100644 --- a/authentik/sources/ldap/sync/base.py +++ b/authentik/sources/ldap/sync/base.py @@ -6,9 +6,9 @@ from django.conf import settings from ldap3 import DEREF_ALWAYS, SUBTREE, Connection from structlog.stdlib import BoundLogger, get_logger +from authentik.common.sync.mapper import PropertyMappingManager from authentik.core.sources.mapper import SourceMapper from authentik.lib.config import CONFIG -from authentik.lib.sync.mapper import PropertyMappingManager from authentik.sources.ldap.models import LDAPSource diff --git a/authentik/sources/ldap/sync/groups.py b/authentik/sources/ldap/sync/groups.py index 1562d43247..678d203d8b 100644 --- a/authentik/sources/ldap/sync/groups.py +++ b/authentik/sources/ldap/sync/groups.py @@ -6,6 +6,7 @@ from django.core.exceptions import FieldError from django.db.utils import IntegrityError from ldap3 import ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES, SUBTREE +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.core.expression.exceptions import ( PropertyMappingExpressionException, SkipObjectException, @@ -13,7 +14,6 @@ from authentik.core.expression.exceptions import ( from authentik.core.models import Group from authentik.core.sources.mapper import SourceMapper from authentik.events.models import Event, EventAction -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.sources.ldap.models import ( LDAP_UNIQUENESS, GroupLDAPSourceConnection, diff --git a/authentik/sources/ldap/sync/users.py b/authentik/sources/ldap/sync/users.py index 6bdf66b610..5568607ecf 100644 --- a/authentik/sources/ldap/sync/users.py +++ b/authentik/sources/ldap/sync/users.py @@ -6,6 +6,7 @@ from django.core.exceptions import FieldError from django.db.utils import IntegrityError from ldap3 import ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES, SUBTREE +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.core.expression.exceptions import ( PropertyMappingExpressionException, SkipObjectException, @@ -13,7 +14,6 @@ from authentik.core.expression.exceptions import ( from authentik.core.models import User from authentik.core.sources.mapper import SourceMapper from authentik.events.models import Event, EventAction -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.sources.ldap.models import ( LDAP_UNIQUENESS, LDAPSource, diff --git a/authentik/sources/ldap/tasks.py b/authentik/sources/ldap/tasks.py index 2f0547a6ab..9eafae7aa2 100644 --- a/authentik/sources/ldap/tasks.py +++ b/authentik/sources/ldap/tasks.py @@ -7,11 +7,11 @@ from django.core.cache import cache from ldap3.core.exceptions import LDAPException from structlog.stdlib import get_logger +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.events.models import SystemTask as DBSystemTask from authentik.events.models import TaskStatus from authentik.events.system_tasks import SystemTask from authentik.lib.config import CONFIG -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.lib.utils.errors import exception_to_string from authentik.lib.utils.reflection import class_to_path, path_to_class from authentik.root.celery import CELERY_APP diff --git a/authentik/sources/ldap/tests/test_sync.py b/authentik/sources/ldap/tests/test_sync.py index 951b5805b8..e6bf8e9fac 100644 --- a/authentik/sources/ldap/tests/test_sync.py +++ b/authentik/sources/ldap/tests/test_sync.py @@ -6,12 +6,12 @@ from django.db.models import Q from django.test import TestCase from authentik.blueprints.tests import apply_blueprint +from authentik.common.sync.outgoing.exceptions import StopSync from authentik.core.models import Group, User from authentik.core.tests.utils import create_test_admin_user from authentik.events.models import Event, EventAction, SystemTask from authentik.events.system_tasks import TaskStatus from authentik.lib.generators import generate_id, generate_key -from authentik.lib.sync.outgoing.exceptions import StopSync from authentik.lib.utils.reflection import class_to_path from authentik.sources.ldap.models import LDAPSource, LDAPSourcePropertyMapping from authentik.sources.ldap.sync.groups import GroupLDAPSynchronizer diff --git a/authentik/sources/saml/models.py b/authentik/sources/saml/models.py index c18ccb445e..f06e6b78d7 100644 --- a/authentik/sources/saml/models.py +++ b/authentik/sources/saml/models.py @@ -9,6 +9,7 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ from rest_framework.serializers import Serializer +from authentik.common.expression.evaluator import BaseEvaluator from authentik.common.saml.constants import ( DSA_SHA1, ECDSA_SHA1, @@ -43,7 +44,6 @@ from authentik.core.types import UILoginButton, UserSettingSerializer from authentik.crypto.models import CertificateKeyPair from authentik.flows.challenge import RedirectChallenge from authentik.flows.models import Flow -from authentik.lib.expression.evaluator import BaseEvaluator from authentik.lib.models import DomainlessURLValidator from authentik.lib.utils.time import timedelta_string_validator diff --git a/authentik/sources/scim/views/v2/base.py b/authentik/sources/scim/views/v2/base.py index bcb4a8eed5..2320247d60 100644 --- a/authentik/sources/scim/views/v2/base.py +++ b/authentik/sources/scim/views/v2/base.py @@ -18,9 +18,9 @@ from scim2_filter_parser.transpilers.django_q_object import get_query from structlog import BoundLogger from structlog.stdlib import get_logger +from authentik.common.sync.mapper import PropertyMappingManager from authentik.core.models import Group, User from authentik.core.sources.mapper import SourceMapper -from authentik.lib.sync.mapper import PropertyMappingManager from authentik.sources.scim.models import SCIMSource from authentik.sources.scim.views.v2.auth import SCIMTokenAuth