jelhub / scimgateway

Using SCIM protocol as a gateway for user provisioning to other endpoints
MIT License
176 stars 57 forks source link

PATCH replace empty members is not calling modifyGroup #113

Closed christinedraper closed 9 months ago

christinedraper commented 9 months ago

Using scimgateway 4.4.5 with the Okta replace request with empty members:

PATCH {{basePath}}/Groups/org-cd1:viewer
Content-Type: application/json
Authorization: {{authz}}

{
  "Operations":[{"op":"replace","value":{ "members":  [], "id":"org-cd1:viewer","displayName":"org-cd1:viewer"}}]
}

this never calls modifyGroup, so no change is made to the group.

What I think is happening is this. It is calling replaceUsrGrp, but for some reason it is deleting the members element rather than setting it to empty, and so because there are no attributes other than id and displayName there's nothing left to replace and it doesnt call modifyGroup.

christinedraper commented 9 months ago

Closing while I make sure this isnt my mistake

jelhub commented 9 months ago

members=[] => remove all members if there are any displayName=org-cd1:viewer => change displayName if needed

modifyGroup will not be called if there are no members to be removed or no need for changing displayName

christinedraper commented 9 months ago

I've tried this multiple times now after making sure there is initially a value in members and then passing members=[]

By the time it gets to the update object statement if (Object.keys(scimdata).length > 0) in replaceUsrGrp, the scimdata object is empty so modifyGroup isnt called.

I'll keep trying to find where exactly it is going wrong

christinedraper commented 9 months ago

OK, sorry for the bother! I had temporarily set putSoftSync to true. It works fine with putSoftSync = false

jelhub commented 9 months ago

Yes, putSoftSync will not do any removal, only add missing.