deep_unrest 0.1.53 → 0.1.54

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: dc233f787b4e6ca3f10280e1135c157365fd935e591c1a8299cb0a9a467be212
4
- data.tar.gz: 688e7d5d6154737fd0d98bf38284b64e0146023da377174efce8cde1794f695b
3
+ metadata.gz: bf36ddb88a73244347e83a8a8b265b40d98e6f821a739e5c94435d329a38a5de
4
+ data.tar.gz: 9451ce3688642554c81b753efe7e2e2badd71d3be73d36398323c4a7c6171e91
5
5
  SHA512:
6
- metadata.gz: 1f57d7014f8fe2b1241fe0580b573578c68737c9bb48f1e4e6733909bd702cd3e78beafa18703a0b4d60c9d1c2a0948abf50c1b01499a6094e3e05c6321767fb
7
- data.tar.gz: c7cbdcad79344872fc986f0ea893ce62234eee398a6b9447ea15ba14e0dbe013d5e951f839bbe494cfbc6615a459c8295c63b534ed5f73eb953590e30b110d0d
6
+ metadata.gz: 9ad246d65a81431253ddac7d9f3adb2bd975249402a2f7ed2d637c129a0d284ccf10b8dd7ac09bb5372908e21f560bc89b968803890441e7bf9f3c45286749be
7
+ data.tar.gz: 1b67db7bff81345c443824b74663953955d3c6e5f96a23894bcb82347b20f422aa48ed8a03823d5ceae3a3e39e71841ae5931fd78020e6050f9d9c19761feab4
@@ -2,7 +2,7 @@
2
2
 
3
3
  module DeepUnrest
4
4
  module Read
5
- def self.create_read_mappings(params, addr = [])
5
+ def self.create_read_mappings(params, user, addr = [])
6
6
  return unless params
7
7
 
8
8
  params.map do |k, v|
@@ -16,8 +16,9 @@ module DeepUnrest
16
16
  addr: resource_addr,
17
17
  key: k.camelize(:lower),
18
18
  uuid: uuid,
19
+ current_user: user,
19
20
  query: DeepUnrest.deep_underscore_keys(v) },
20
- *create_read_mappings(v[:include], [*resource_addr, :include])]
21
+ *create_read_mappings(v[:include], user, [*resource_addr, :include])]
21
22
  end.flatten.compact
22
23
  end
23
24
 
@@ -64,6 +65,7 @@ module DeepUnrest
64
65
 
65
66
  def self.query_item(mapping, mappings, parent_context, included, meta, addr, _parent)
66
67
  query = resolve_conditions(mapping[:query].deep_dup, parent_context)
68
+
67
69
  raise DeepUnrest::InvalidQuery unless query[:id] || query[:find]
68
70
 
69
71
  if query.key?(:if)
@@ -124,6 +126,7 @@ module DeepUnrest
124
126
  processor = JSONAPI::Processor.new(resource,
125
127
  :find,
126
128
  filters: query[:filter] || {},
129
+ context: { current_user: item[:current_user] },
127
130
  sort_criteria: sort_criteria,
128
131
  paginator: paginator)
129
132
 
@@ -195,7 +198,7 @@ module DeepUnrest
195
198
 
196
199
  def self.read(ctx, params, user)
197
200
  # create mappings for assembly / disassembly
198
- mappings = create_read_mappings(params.to_unsafe_h)
201
+ mappings = create_read_mappings(params.to_unsafe_h, user)
199
202
 
200
203
  # authorize user for requested scope(s)
201
204
  DeepUnrest.authorization_strategy.authorize(mappings, user)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.53'
4
+ VERSION = '0.1.54'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.53
4
+ version: 0.1.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley