Skip to content

Problems with Patch operation on group members  #10

Closed

Description

@steverash

Hi,

I've noticed a couple of problems with patch operations on group members.

  1. A patch operation to remove a single member removes all members. This seems to be due to the code creating a new empty list of the value property of the patch operation has a null value.
                            case OperationName.Remove:
                                if (null == group.Members)
                                {
                                    break;
                                }

                                if (operation?.Value?.FirstOrDefault()?.Value == null)
                                {
                                    group.Members = Enumerable.Empty<Member>();
                                    break;
                                }

  1. Adding a member allows the adding of the same user id more than once.

Thanks,

Steve

Activity

  1. ArvindHarinder1 commented on Mar 18, 2020

    @ArvindHarinder1
    Contributor

    steverash thanks for the feedback. Could you provide screenshots of a repro for #1? We're not able to repro it. We're trying to adhere to the standard as described in the screenshot below. We'll be able to address #2.

    https://tools.ietf.org/html/rfc7644#section-3.5.2

    image

  2. steverash commented on Mar 18, 2020

    @steverash
    Author

    ArvindHarinder1 - I think the code above is assuming that if there is no value then it must be that it is trying to remove all members of the group. However that "value" is actually in the path, as per your example requests above.

    For reproduction, here are the steps I went through with this sample app in postman

    First, create a group with 2 members

    {
      "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
      "externalId":"ABCDEFE-B840-47E7-8FBE-543534534543",
      "displayName": "New group",
      "members":
      [
      	{
      		"value":"E367CCBD-B840-47E7-8FBE-B801A18DB3E3",
      		"display":"Test user 1"
      	},
      	{
      		"value":"A367CCBD-B840-47E7-8FBE-B801A18DB3BB",
      		"display":"Test user 2"
      	}	
      ]
    }
    

    Then remove a single member

    {
        "schemas": [
            "urn:ietf:params:scim:api:messages:2.0:PatchOp"
        ],
        "Operations": [
            {
                "op": "remove",
                "path": "members[value eq \"E367CCBD-B840-47E7-8FBE-B801A18DB3E3\"]"
            }
        ]
    }
    
    1. Get the group and you will see no members
    {
        "meta": {
            "resourceType": "Group"
        },
        "displayName": "New group",
        "members": [],
        "externalId": "ABCDEFE-B840-47E7-8FBE-543534534543",
        "id": "e12450c3-2387-4cdd-ae3b-25ee1522acce",
        "schemas": [
            "urn:ietf:params:scim:schemas:core:2.0:Group"
        ]
    }
    
  3. steverash commented on Apr 14, 2020

    @steverash
    Author

    As an alternative fix, I've put a PR in based on a fix I've done on my fork. PR is here : #14

  4. ArvindHarinder1 commented on May 5, 2020

    @ArvindHarinder1
    Contributor

    Closed with this PR. #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy