providers/scim: ensure scim group member isn't None (#5391)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
b058906074
commit
7b0d8f8991
|
@ -15,6 +15,7 @@ from h11 import LocalProtocolError
|
||||||
from ldap3.core.exceptions import LDAPException
|
from ldap3.core.exceptions import LDAPException
|
||||||
from redis.exceptions import ConnectionError as RedisConnectionError
|
from redis.exceptions import ConnectionError as RedisConnectionError
|
||||||
from redis.exceptions import RedisError, ResponseError
|
from redis.exceptions import RedisError, ResponseError
|
||||||
|
from requests_mock.exceptions import NoMockAddress
|
||||||
from rest_framework.exceptions import APIException
|
from rest_framework.exceptions import APIException
|
||||||
from sentry_sdk import HttpTransport
|
from sentry_sdk import HttpTransport
|
||||||
from sentry_sdk import init as sentry_sdk_init
|
from sentry_sdk import init as sentry_sdk_init
|
||||||
|
@ -140,6 +141,8 @@ def before_send(event: dict, hint: dict) -> Optional[dict]:
|
||||||
Http404,
|
Http404,
|
||||||
# AsyncIO
|
# AsyncIO
|
||||||
CancelledError,
|
CancelledError,
|
||||||
|
# Requests
|
||||||
|
NoMockAddress,
|
||||||
)
|
)
|
||||||
exc_value = None
|
exc_value = None
|
||||||
if "exc_info" in hint:
|
if "exc_info" in hint:
|
||||||
|
|
|
@ -81,12 +81,15 @@ class SCIMGroupClient(SCIMClient[Group, SCIMGroupSchema]):
|
||||||
|
|
||||||
users = list(obj.users.order_by("id").values_list("id", flat=True))
|
users = list(obj.users.order_by("id").values_list("id", flat=True))
|
||||||
connections = SCIMUser.objects.filter(provider=self.provider, user__pk__in=users)
|
connections = SCIMUser.objects.filter(provider=self.provider, user__pk__in=users)
|
||||||
|
members = []
|
||||||
for user in connections:
|
for user in connections:
|
||||||
scim_group.members.append(
|
members.append(
|
||||||
GroupMember(
|
GroupMember(
|
||||||
value=user.id,
|
value=user.id,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if members:
|
||||||
|
scim_group.members = members
|
||||||
return scim_group
|
return scim_group
|
||||||
|
|
||||||
def _create(self, group: Group):
|
def _create(self, group: Group):
|
||||||
|
|
Reference in a new issue