Patch adding members does not seem to work
Janne-ka opened this issue · 2 comments
request data:
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "add",
"path": "members",
"value": [
{
"display": "testing@bobbboo.com",
"value": "818eee32-9d8e-4fc0-b140-0124891b5318",
"$ref": "http://localhost:3000/scim_v2/users/818eee32-9d8e-4fc0-b140-0124891b5318"
}
]
}
]
}
code:
def update
patch_hash = self.safe_params().to_hash()
Rails.logger.fatal(patch_hash.inspect)
record = self.find_record(params[:id])
scim_hash = record.to_scim(location: '(unused)').as_json()
Rails.logger.fatal(scim_hash.inspect)
record.from_scim_patch!(patch_hash: patch_hash)
scim_hash = record.to_scim(location: '(unused)').as_json()
Rails.logger.fatal(scim_hash.inspect)
super
end
Log:
initial input
2021-09-14 10:20:41.294736 F [17630:puma threadpool 005 groups_controller.rb:54] [[]] Rails -- {"schemas"=>["urn:ietf:params:scim:api:messages:2.0:PatchOp"], "Operations"=>[{"op"=>"add", "path"=>"members", "value"=>[{"display"=>"testing@bobbboo.com", "value"=>"818eee32-9d8e-4fc0-b140-0124891b5318", "$ref"=>"http://localhost:3000/scim_v2/users/818eee32-9d8e-4fc0-b140-0124891b5318"}]}], "controller"=>"scim_v2/groups", "action"=>"update", "id"=>"1429"}
initial object hash
2021-09-14 10:20:41.337278 F [17630:puma threadpool 005 groups_controller.rb:59] [[]] Rails -- {"displayName"=>"Namme", "members"=>[{"value"=>"4a9dcec5-c5f4-45f2-ae9d-22a64df387dd", "display"=>"testing@bob5.com"}], "id"=>"1429", "externalId"=>nil, "meta"=>{"location"=>"(unused)", "resourceType"=>"Group"}, "schemas"=>["urn:ietf:params:scim:schemas:core:2.0:Group"]}
unchanged object hash
2021-09-14 10:20:41.338268 F [17630:puma threadpool 005 groups_controller.rb:64] [[]] Rails -- {"displayName"=>"Namme", "members"=>[{"value"=>"4a9dcec5-c5f4-45f2-ae9d-22a64df387dd", "display"=>"testing@bob5.com"}], "id"=>"1429", "externalId"=>nil, "meta"=>{"location"=>"(unused)", "resourceType"=>"Group"}, "schemas"=>["urn:ietf:params:scim:schemas:core:2.0:Group"]}
2021-09-14 10:20:41.339171 D [17630:puma threadpool 005]
seems like I am missing find_with: -> (scim_list_entry) {...}
I had not added
find_with: -> (scim_list_entry) { User.where(uuid: scim_list_entry['value']).first}