Skip to content

[Fix] SCIM - Add SCIM PATCH and PUT Ops for Users #11863

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

Merged
merged 15 commits into from
Jun 18, 2025

Conversation

ishaan-jaff
Copy link
Contributor

@ishaan-jaff ishaan-jaff commented Jun 18, 2025

[Fix] SCIM - Add SCIM PATCH and PUT Ops for Users

  • Add handling for existing user_emails when using SCIM
  • Add handling for PUT, PATCH SCIM Ops for Users
  • Refactor SCIM functions to use common utils for team memberships

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
🧹 Refactoring
✅ Test

Changes

Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 9:02pm

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for SCIM PATCH and PUT operations for users, refactors team membership handling into shared utilities, and includes new tests for the patch functionality.

  • Added unit tests covering field replacement and group membership changes in patch_user
  • Made userName and name fields optional in SCIM user models to support partial updates
  • Updated SCIM transformation logic to handle both Member instances and dicts when serializing team members

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.

File Description
tests/test_litellm/proxy/management_endpoints/scim/test_scim_patch_user.py New async tests for patch_user covering field updates and group ops
litellm/types/proxy/management_endpoints/scim_v2.py Changed SCIMUserName and SCIMUser fields to be optional
litellm/proxy/management_endpoints/scim/scim_transformations.py Added handling for dict-based Member objects in SCIM conversion
Comments suppressed due to low confidence (3)

tests/test_litellm/proxy/management_endpoints/scim/test_scim_patch_user.py:102

  • It would strengthen this test to also assert that mock_db.litellm_usertable.update is called after group membership changes to ensure the updated team list is persisted.
    assert mock_add_fn.called

litellm/types/proxy/management_endpoints/scim_v2.py:46

  • [nitpick] Since userName and name are now optional, consider updating the class docstring or relevant API documentation to clarify when these fields may be None and how downstream consumers should handle their absence.
    userName: Optional[str] = None

litellm/proxy/management_endpoints/scim/scim_transformations.py:127

  • The Member class is referenced here but not imported in this module, which will raise a NameError at runtime. Please add the appropriate import for Member at the top of the file.
            if isinstance(member, dict):

@ishaan-jaff ishaan-jaff merged commit 4782d43 into main Jun 18, 2025
36 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant