forked from goauthentik/authentik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
providers/sync: improve v3 (goauthentik#9966)
* make external id field externally visible Signed-off-by: Jens Langhammer <[email protected]> * catch up scim provider Signed-off-by: Jens Langhammer <[email protected]> * add missing views to scim provider Signed-off-by: Jens Langhammer <[email protected]> * make neither user nor group required for mapping testing Signed-off-by: Jens Langhammer <[email protected]> * improve SkipObject handling Signed-off-by: Jens Langhammer <[email protected]> * allow deletion of connection objects Signed-off-by: Jens Langhammer <[email protected]> * make entra logs less noisy Signed-off-by: Jens Langhammer <[email protected]> * make event_matcher less noisy Signed-off-by: Jens Langhammer <[email protected]> --------- Signed-off-by: Jens Langhammer <[email protected]>
- Loading branch information
Showing
28 changed files
with
963 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""SCIMProviderGroup API Views""" | ||
|
||
from rest_framework import mixins | ||
from rest_framework.serializers import ModelSerializer | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from authentik.core.api.used_by import UsedByMixin | ||
from authentik.core.api.users import UserGroupSerializer | ||
from authentik.providers.scim.models import SCIMProviderGroup | ||
|
||
|
||
class SCIMProviderGroupSerializer(ModelSerializer): | ||
"""SCIMProviderGroup Serializer""" | ||
|
||
group_obj = UserGroupSerializer(source="group", read_only=True) | ||
|
||
class Meta: | ||
|
||
model = SCIMProviderGroup | ||
fields = [ | ||
"id", | ||
"scim_id", | ||
"group", | ||
"group_obj", | ||
"provider", | ||
] | ||
|
||
|
||
class SCIMProviderGroupViewSet( | ||
mixins.CreateModelMixin, | ||
mixins.RetrieveModelMixin, | ||
mixins.DestroyModelMixin, | ||
UsedByMixin, | ||
mixins.ListModelMixin, | ||
GenericViewSet, | ||
): | ||
"""SCIMProviderGroup Viewset""" | ||
|
||
queryset = SCIMProviderGroup.objects.all().select_related("group") | ||
serializer_class = SCIMProviderGroupSerializer | ||
filterset_fields = ["provider__id", "group__name", "group__group_uuid"] | ||
search_fields = ["provider__name", "group__name"] | ||
ordering = ["group__name"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""SCIMProviderUser API Views""" | ||
|
||
from rest_framework import mixins | ||
from rest_framework.serializers import ModelSerializer | ||
from rest_framework.viewsets import GenericViewSet | ||
|
||
from authentik.core.api.groups import GroupMemberSerializer | ||
from authentik.core.api.used_by import UsedByMixin | ||
from authentik.providers.scim.models import SCIMProviderUser | ||
|
||
|
||
class SCIMProviderUserSerializer(ModelSerializer): | ||
"""SCIMProviderUser Serializer""" | ||
|
||
user_obj = GroupMemberSerializer(source="user", read_only=True) | ||
|
||
class Meta: | ||
|
||
model = SCIMProviderUser | ||
fields = [ | ||
"id", | ||
"scim_id", | ||
"user", | ||
"user_obj", | ||
"provider", | ||
] | ||
|
||
|
||
class SCIMProviderUserViewSet( | ||
mixins.CreateModelMixin, | ||
mixins.RetrieveModelMixin, | ||
mixins.DestroyModelMixin, | ||
UsedByMixin, | ||
mixins.ListModelMixin, | ||
GenericViewSet, | ||
): | ||
"""SCIMProviderUser Viewset""" | ||
|
||
queryset = SCIMProviderUser.objects.all().select_related("user") | ||
serializer_class = SCIMProviderUserSerializer | ||
filterset_fields = ["provider__id", "user__username", "user__id"] | ||
search_fields = ["provider__name", "user__username"] | ||
ordering = ["user__username"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
authentik/providers/scim/migrations/0008_rename_scimgroup_scimprovidergroup_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.0.6 on 2024-06-04 07:45 | ||
|
||
from django.conf import settings | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authentik_core", "0035_alter_group_options_and_more"), | ||
("authentik_providers_scim", "0007_scimgroup_scim_id_scimuser_scim_id_and_more"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name="SCIMGroup", | ||
new_name="SCIMProviderGroup", | ||
), | ||
migrations.RenameModel( | ||
old_name="SCIMUser", | ||
new_name="SCIMProviderUser", | ||
), | ||
] |
Oops, something went wrong.