osiam / resource-server

[DEPRECATED] OSIAM resource server
MIT License
3 stars 10 forks source link

Update User with PATCH: add and delete same email address depends on the order #31

Closed tkrille closed 9 years ago

tkrille commented 9 years ago

When updating a user's email address in way that removes the email address and then adds it back again, the order of the respective statements matters. This is wrong regarding the SCIM 2.0 spec that states something like: first values that are marked for deletion have to be removed, and then new values should be added.

Steps to reproduce:

  1. Create a new User with an email address
  2. Create an UpdateUser and add and then delete the email address:

    Email email = user.getEmails().get(0);
    UpdateUser updateUser = new UpdateUser.Builder()
           .addEmail(email)
           .deleteEmail(email)
           .build();
  3. Update the User

Expected result:

The User has not been changed.

Actual result:

The User's email address has been deleted

See also: osiam/connector4java-integration-tests#253

tkrille commented 9 years ago

Original issue from Jira:

Scim says that always first all deletion should be done. After this all new attribtues will be added. If we send

"emails": [
    { "value": "bjensen@example.com", "type": "work", "operation": "delete" },
    { "value": "bjensen@example.com", "type": "work" }
]

it works. But if we send

"emails": [
    { "value": "bjensen@example.com", "type": "work" },
    { "value": "bjensen@example.com", "type": "work", "operation": "delete" }
]

The email will be deleted in the db.

tkrille commented 9 years ago

There's already an ignored test for this: https://github.com/osiam/connector4java-integration-tests/pull/253/files#diff-c758a0069eda26940e37b2a0ef9e62efR308

dacrome commented 9 years ago

Close this issue because PATCH will be removed https://github.com/osiam/osiam/issues/21