Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/scim: clamp batch size for patch requests #11797

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions authentik/providers/scim/clients/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
chunk_size = self._config.bulk.maxOperations
if chunk_size < 1:
chunk_size = len(ops)
if len(ops) < 1:
return

Check warning on line 201 in authentik/providers/scim/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/providers/scim/clients/groups.py#L201

Added line #L201 was not covered by tests
for chunk in batched(ops, chunk_size):
req = PatchRequest(Operations=list(chunk))
self._request(
Expand Down Expand Up @@ -244,6 +246,9 @@
for user in users_should:
if len([x for x in current_group.members if x.value == user]) < 1:
users_to_add.append(user)
# Only send request if we need to make changes
if len(users_to_add) < 1 and len(users_to_remove) < 1:
return

Check warning on line 251 in authentik/providers/scim/clients/groups.py

View check run for this annotation

Codecov / codecov/patch

authentik/providers/scim/clients/groups.py#L250-L251

Added lines #L250 - L251 were not covered by tests
return self._patch_chunked(
scim_group.scim_id,
*[
Expand Down
Loading