providers/scim: ensure scim group member isn't None (#5391)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-04-27 15:03:50 +03:00 committed by GitHub
parent b058906074
commit 7b0d8f8991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,7 @@ from h11 import LocalProtocolError
from ldap3.core.exceptions import LDAPException
from redis.exceptions import ConnectionError as RedisConnectionError
from redis.exceptions import RedisError, ResponseError
from requests_mock.exceptions import NoMockAddress
from rest_framework.exceptions import APIException
from sentry_sdk import HttpTransport
from sentry_sdk import init as sentry_sdk_init
@ -140,6 +141,8 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
Http404,
# AsyncIO
CancelledError,
# Requests
NoMockAddress,
)
exc_value = None
if "exc_info" in hint:

View File

@ -81,12 +81,15 @@ class SCIMGroupClient(SCIMClient[Group, SCIMGroupSchema]):
users = list(obj.users.order_by("id").values_list("id", flat=True))
connections = SCIMUser.objects.filter(provider=self.provider, user__pk__in=users)
members = []
for user in connections:
scim_group.members.append(
members.append(
GroupMember(
value=user.id,
)
)
if members:
scim_group.members = members
return scim_group
def _create(self, group: Group):