Commit aac91c37b30338ec703f359104bab0f7bdde393c
1 parent
b75f92f4
Exists in
master
fix path_for
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
app/controllers/scim_rails/scim_users_controller.rb
... | ... | @@ -109,7 +109,8 @@ module ScimRails |
109 | 109 | end |
110 | 110 | |
111 | 111 | ScimRails.config.mutable_user_attributes.each do |attribute| |
112 | - hash[attribute] ||= find_value_for(attribute) | |
112 | + value = find_value_for(attribute) | |
113 | + hash[attribute] ||= value if value.present? | |
113 | 114 | end |
114 | 115 | |
115 | 116 | Rails.logger.error("scim permitted_user_params: #{hash.inspect}") |
... | ... | @@ -130,7 +131,10 @@ module ScimRails |
130 | 131 | |
131 | 132 | def path_for(attribute, object = ScimRails.config.mutable_user_attributes_schema, path = []) |
132 | 133 | at_path = path.empty? ? object : object.dig(*path) |
133 | - return path if at_path == attribute | |
134 | + if at_path == attribute && (params.dig(*path) rescue nil).present? | |
135 | + return path | |
136 | + end | |
137 | + | |
134 | 138 | result = nil |
135 | 139 | case at_path |
136 | 140 | when Hash | ... | ... |
lib/scim_rails/version.rb