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

Cannot add new entry to multi-valued attribute using a path filter #176

Closed
barryhagan opened this issue Jan 20, 2022 · 0 comments · Fixed by #177
Closed

Cannot add new entry to multi-valued attribute using a path filter #176

barryhagan opened this issue Jan 20, 2022 · 0 comments · Fixed by #177

Comments

@barryhagan
Copy link
Contributor

Describe the bug

Similar to the issue in #42, when using Azure AD, SCIM PATCH requests can be sent using filters to add entries to a multi-valued attribute. The fix for #42 handles completely missing or empty array attributes, but we also need to support adding a new value to an existing non-empty array.

Attempting this type of PATCH currently throws with this message: Invalid SCIM Patch: Target location is a multi-valued attribute for which a value selection filter (:patch.value) has been supplied and no record match was made.

Additionally, when throwing NoTarget, the message should include the patch.path, not the patch.value. Right now you get the value you are trying to set, not the filter path.

To Reproduce

  • Create a SCIM user that has a "home" address.
  • Attempt to PATCH that user with a new "work" address.
{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations":
    [
        {"op":"Add", "path":"addresses[type eq \"work\"].formatted", "value":"123 fake st."}
    ]   
}

Expected behavior
The new work address is added, and the user now has both "home" and "work" type addresses.

Additional context
Add any other context about the problem here.

barryhagan added a commit to barryhagan/scim-patch that referenced this issue Jan 20, 2022
thomaspoignant pushed a commit that referenced this issue Jan 21, 2022
)

* fix #176 - allow adds when there is no matching target in an array, but the array exists

* remove unreachable code path
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 a pull request may close this issue.

1 participant