scimitar 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be3285b59b4b124288a68cbfcc308caff2c44c788d66ee537e6a1db3780e8633
4
- data.tar.gz: e04d556655ee3dc440dd5eda89b217c3a5a6d9b96697686c0bb71241268d09d0
3
+ metadata.gz: 7524696efa05186edcbba9876a3309d3c8a8d51772e3ac0a009a9e83d8f25d16
4
+ data.tar.gz: e6cad46dc8754981f1d85cc9bcc98f73f9edddfa0d0386497b710acd11ad666c
5
5
  SHA512:
6
- metadata.gz: 53a364cee0f0ea429b51a521131c186a0b51f16b78dacf89dd62a0eb3565ecd3dc21c22acb2cb453c9ca61d6764bc18ff3a0a4c2f4ef805988e1a5adb3a18cd0
7
- data.tar.gz: 8e649ec7793576b31acca746025c02f325162c3d7f715a9554d8c6bdfc3b57b6734b571473c84e9d74eda7e2c3d909d576960464d8a00be8f418e9a56510a6dc
6
+ metadata.gz: d040bbf693140f5e62dea569d02d977cb5fd966d2464c0a722bea449428de097901471a2f4b0c2380cf935c424195336d7eed4f469a8ebd019d4277dbe90c629
7
+ data.tar.gz: 15616cedc7fffc3df69dcc1b2f35e9bd3c5408e12f8cccd536d724ce2925c72e4aa9a8f63732135ba3a71d23438dc02e8835978ff37977722cd23cab63c1ee28
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|