oso-cloud 1.3.0.dev.5 → 1.3.0.dev.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/oso/oso.rb +28 -12
  3. data/lib/oso/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51dc4187ef8812ede5669c392262eceb0cf09ed962831f0263c0eb931703ba21
4
- data.tar.gz: 37f0a58b35e23da57458685ad36a9171e20c933fa90a80685226ef0d3a9b9cf6
3
+ metadata.gz: 14b5b319f475adefc2e05c6bf2e9cf6f22b20164d38fb9c1cb59b1b7c6c291ee
4
+ data.tar.gz: d9d50d1adcc35c04309b65cde6d2d802eec75ccdd62d6b2d5e05907e7bb9806f
5
5
  SHA512:
6
- metadata.gz: 732ec34bb79ad29287de13c6e6d696e374b21478dd4943059d0b7e4adb41ff96d31908b339e69f346bc7ee64704bdaeca1973ffdb49ae088dd73991615da43b8
7
- data.tar.gz: a397403259a48af1d934cefe3563c0a5816810b00a213e30f99aabaa41affacfa95e276c234da9201f36474ddca0305d83969816ca2ea5021eb862e2b717b579
6
+ metadata.gz: e8f770aaefda73dba90e6410be04dec0dc5ec1089535d7977f1aa5bd1d6310023954c6e2aae3e1d6c9e458ef2ceb5df58cf7dd16bc3c3183036da4965fcdaf02
7
+ data.tar.gz: 669d14ebf88e20a6f2a1bebdc609a7bda2e3eb6c20fc3d5eb7f4efa2b686ea611bc5a7ad28dcd4cd450a36226f1df5594daa09927a755d91ab97abe819363181
data/lib/oso/oso.rb CHANGED
@@ -270,21 +270,37 @@ module OsoCloud
270
270
  OsoCloud::Helpers.facts_to_params(result.results)
271
271
  end
272
272
 
273
- def actions_batch(actor, resources, context_facts = [])
274
- actor_typed_id = actor.to_api_value
275
- data = resources.map do |r|
276
- resource_typed_id = r.to_api_value
277
- OsoCloud::Core::ActionsQuery.new(
278
- actor_type: actor_typed_id.type,
279
- actor_id: actor_typed_id.id,
280
- resource_type: resource_typed_id.type,
281
- resource_id: resource_typed_id.id,
282
- context_facts: OsoCloud::Helpers.params_to_facts(context_facts)
283
- )
273
+ ##
274
+ # List authorized actions for a batch of queries
275
+ #
276
+ # Fetches a list of actions which an actor can perform on a particular resource.
277
+ #
278
+ # @param actor [OsoCloud::Value]
279
+ # @param queries [Array<OsoCloud::Value>] | Array<[OsoCloud::Value, Array<fact>]>
280
+ # @return [Array<Array<String>>]
281
+ # @see Oso for more information about facts
282
+ def actions_batch(actor, queries:)
283
+ actor_typed_id = actor.to_api_value
284
+ data = queries.map do |q|
285
+ context_facts = []
286
+ resource = nil
287
+ if (q.is_a?(Array))
288
+ resource = q[0]
289
+ context_facts = q[1]
290
+ else
291
+ resource = q
292
+ end
293
+ resource_typed_id = resource.to_api_value
294
+ OsoCloud::Core::ActionsQuery.new(
295
+ actor_type: actor_typed_id.type,
296
+ actor_id: actor_typed_id.id,
297
+ resource_type: resource_typed_id.type,
298
+ resource_id: resource_typed_id.id,
299
+ context_facts: OsoCloud::Helpers.params_to_facts(context_facts)
300
+ )
284
301
  end
285
302
  @api.post_actions_batch(data).map { |result| result.results}
286
303
  end
287
304
  end
288
305
 
289
306
  end
290
-
data/lib/oso/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OsoCloud
2
- VERSION = '1.3.0.dev.5'.freeze
2
+ VERSION = '1.3.0.dev.6'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.dev.5
4
+ version: 1.3.0.dev.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-27 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday