scimitar 2.7.1 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/app/models/scimitar/resources/base.rb +12 -9
- data/app/models/scimitar/resources/mixin.rb +448 -55
- data/lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb +140 -10
- data/lib/scimitar/support/utilities.rb +55 -0
- data/lib/scimitar/version.rb +2 -2
- data/spec/models/scimitar/resources/base_spec.rb +9 -1
- data/spec/models/scimitar/resources/mixin_spec.rb +683 -112
- data/spec/requests/active_record_backed_resources_controller_spec.rb +181 -5
- data/spec/support/hash_with_indifferent_case_insensitive_access_spec.rb +108 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7524696efa05186edcbba9876a3309d3c8a8d51772e3ac0a009a9e83d8f25d16
|
4
|
+
data.tar.gz: e6cad46dc8754981f1d85cc9bcc98f73f9edddfa0d0386497b710acd11ad666c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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|
|