scimitar 2.7.1 → 2.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be3285b59b4b124288a68cbfcc308caff2c44c788d66ee537e6a1db3780e8633
4
- data.tar.gz: e04d556655ee3dc440dd5eda89b217c3a5a6d9b96697686c0bb71241268d09d0
3
+ metadata.gz: 6898633f866963ccaacd5f16120a957f698e2e1aacd51b985c483616fe5c49d5
4
+ data.tar.gz: d24f2017fab7ae3432c21d5eacb281fa8cd1ac3b43a25756ccbf105a426bf85f
5
5
  SHA512:
6
- metadata.gz: 53a364cee0f0ea429b51a521131c186a0b51f16b78dacf89dd62a0eb3565ecd3dc21c22acb2cb453c9ca61d6764bc18ff3a0a4c2f4ef805988e1a5adb3a18cd0
7
- data.tar.gz: 8e649ec7793576b31acca746025c02f325162c3d7f715a9554d8c6bdfc3b57b6734b571473c84e9d74eda7e2c3d909d576960464d8a00be8f418e9a56510a6dc
6
+ metadata.gz: cefe2b8fb441822a751ba93d54b43dc6e75281cc707095f3880c9927d413d310dbcb0676405499f46e641cb767a6d50d3d03b9a0d1b6d1218fbd59e3c036caba
7
+ data.tar.gz: 34bc849312df18601c49df4f7e9019ed258b74bb84a002309a5d33b8119c4776edfb1e7cbacdcebbc92533b9cf63586c33631ac505ca1bb17bc859a9d1a65078
data/README.md CHANGED
@@ -244,8 +244,6 @@ If you use ActiveRecord, your controllers can potentially be extremely simple by
244
244
  module Scim
245
245
  class UsersController < Scimitar::ActiveRecordBackedResourcesController
246
246
 
247
- skip_before_action :verify_authenticity_token
248
-
249
247
  protected
250
248
 
251
249
  def storage_class
@@ -129,7 +129,7 @@ module Scimitar
129
129
 
130
130
  if scim_attribute && scim_attribute.complexType
131
131
  if scim_attribute.multiValued
132
- self.send("#{attr_name}=", attr_value.map {|attr_for_each_item| complex_type_from_hash(scim_attribute, attr_for_each_item)})
132
+ self.send("#{attr_name}=", attr_value&.map {|attr_for_each_item| complex_type_from_hash(scim_attribute, attr_for_each_item)})
133
133
  else
134
134
  self.send("#{attr_name}=", complex_type_from_hash(scim_attribute, attr_value))
135
135
  end
@@ -137,18 +137,21 @@ module Scimitar
137
137
  end
138
138
  end
139
139
 
140
+ # Renders *in full* as JSON; typically used for write-based operations...
141
+ #
142
+ # record = self.storage_class().new
143
+ # record.from_scim!(scim_hash: scim_resource.as_json())
144
+ # self.save!(record)
145
+ #
146
+ # ...so all fields, even those marked "returned: false", are included.
147
+ # Use Scimitar::Resources::Mixin::to_scim to obtain a SCIM object with
148
+ # non-returnable fields omitted, rendering *that* as JSON via #to_json.
149
+ #
140
150
  def as_json(options = {})
141
151
  self.meta = Meta.new unless self.meta && self.meta.is_a?(Meta)
142
152
  self.meta.resourceType = self.class.resource_type_id
143
153
 
144
- non_returnable_attributes = self.class
145
- .schemas
146
- .flat_map(&:scim_attributes)
147
- .filter_map { |attribute| attribute.name if attribute.returned == 'never' }
148
-
149
- non_returnable_attributes << 'errors'
150
-
151
- original_hash = super(options).except(*non_returnable_attributes)
154
+ original_hash = super(options).except('errors')
152
155
  original_hash.merge!('schemas' => self.class.schemas.map(&:id))
153
156
 
154
157
  self.class.extended_schemas.each do |extension_schema|