oso-oso 0.20.1.pre.beta → 0.20.1

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
  SHA1:
3
- metadata.gz: 7a6c6bd2d2fb38245a5103c0153f943f51060c90
4
- data.tar.gz: 33dcb41c1c6bd0aeeec56d88391e1e80a66b6061
3
+ metadata.gz: da642b9fbbfcad2d836a8db8c6ac83cbc8f1127a
4
+ data.tar.gz: 1012ef61aa0a1791a1c759ba9f62e108918898b6
5
5
  SHA512:
6
- metadata.gz: 5c025329ad3a4eff57b2cf5e7d5ca8430ef825ee287111690f06439a7c6f623068048d27ea70358af8ffb8f9d935b926cdecf54baa848f95da9ebaa23b0c0e39
7
- data.tar.gz: 2c4a4114eafb5887805a7b92015f466296ae9eaaa4ffe19f1cc60d4f2ec59b6b580ff80ebe60143e639d7f606d79f343c89e3fdd7e7a52789939af9716b9b2c3
6
+ metadata.gz: 48d52111b817769f31086b4adbd7252bcab4355792ba85e378ab4a27c68272e8d2af55f8d2a258e0a3bb3b2cea30b6d0c98f6e20eec7ed9d1b127011a506cab7
7
+ data.tar.gz: f40a6c5565655ee508ebc0c20b7f571616b42d4a76f986b51ad4349c1fe05200d8165990c98a00e2a7388ac41eb96182095b52a9f08ad022cc0880801ad87997
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oso-oso (0.20.1.pre.beta)
4
+ oso-oso (0.20.1)
5
5
  ffi (~> 1.0)
6
6
 
7
7
  GEM
@@ -116,4 +116,4 @@ DEPENDENCIES
116
116
  yard (~> 0.9.25)
117
117
 
118
118
  BUNDLED WITH
119
- 2.2.15
119
+ 2.2.4
Binary file
Binary file
Binary file
data/lib/oso/oso.rb CHANGED
@@ -173,14 +173,14 @@ module Oso
173
173
  fields
174
174
  end
175
175
 
176
- # Returns a query for resources of type +cls+ that +actor+ is allowed
177
- # to perform +action+ on.
176
+ # Create a query for resources of type +cls+ that +actor+ is
177
+ # allowed to perform +action+ on.
178
178
  #
179
179
  # @param actor The actor whose permissions to check.
180
180
  # @param action The action being taken on the resource.
181
181
  # @param resource_cls The resource being accessed.
182
182
  #
183
- # @returns A query for resources accessible to the actor.
183
+ # @return A query for resources accessible to the actor.
184
184
  def authorized_query(actor, action, resource_cls) # rubocop:disable Metrics/MethodLength
185
185
  resource = Polar::Variable.new 'resource'
186
186
 
@@ -204,14 +204,14 @@ module Oso
204
204
  .build_query
205
205
  end
206
206
 
207
- # Returns the resources of type +resource_cls+ that +actor+ is allowed
208
- # to perform +action+ on.
207
+ # Determine the resources of type +resource_cls+ that +actor+
208
+ # is allowed to perform +action+ on.
209
209
  #
210
210
  # @param actor The actor whose permissions to check.
211
211
  # @param action The action being taken on the resource.
212
212
  # @param resource_cls The resource being accessed.
213
213
  #
214
- # @returns A list of resources accessible to the actor.
214
+ # @return A list of resources accessible to the actor.
215
215
  def authorized_resources(actor, action, resource_cls)
216
216
  q = authorized_query actor, action, resource_cls
217
217
  return [] if q.nil?
@@ -87,6 +87,11 @@ module Oso
87
87
  class Relation
88
88
  attr_reader :kind, :other_type, :my_field, :other_field
89
89
 
90
+ # Describe a Relation from one type to another.
91
+ # @param kind [String] The type of relation, either "one" or "many"
92
+ # @param other_type The name or class object of the related type
93
+ # @param my_field The field on this type that matches +other_type+
94
+ # @param other_field The field on +other_type+ that matches this type
90
95
  def initialize(kind:, other_type:, my_field:, other_field:)
91
96
  @kind = kind
92
97
  @other_type = other_type
@@ -125,6 +130,10 @@ module Oso
125
130
  'Contains' => ->(a, b) { a.include? b }
126
131
  }.freeze
127
132
 
133
+ # Create a new predicate for data filtering.
134
+ # @param kind [String] Represents a condition. One of "Eq", "Neq", "In", "Contains".
135
+ # @param field The field the condition applies to.
136
+ # @param value The value with which to compare the field according to the condition.
128
137
  def initialize(kind:, field:, value:)
129
138
  @kind = kind
130
139
  @field = field
@@ -136,12 +136,12 @@ module Oso
136
136
  # @return [self] for chaining.
137
137
  #
138
138
  # @deprecated {#load_file} has been deprecated in favor of {#load_files}
139
- # as of the 0.20.0 release. Please see changelog for migration
139
+ # as of the 0.20 release. Please see changelog for migration
140
140
  # instructions:
141
141
  # https://docs.osohq.com/project/changelogs/2021-09-15.html
142
142
  def load_file(filename)
143
143
  warn <<~WARNING
144
- `Oso#load_file` has been deprecated in favor of `Oso#load_files` as of the 0.20.0 release.
144
+ `Oso#load_file` has been deprecated in favor of `Oso#load_files` as of the 0.20 release.
145
145
 
146
146
  Please see changelog for migration instructions: https://docs.osohq.com/project/changelogs/2021-09-15.html
147
147
  WARNING
@@ -211,6 +211,10 @@ module Oso
211
211
  #
212
212
  # @param cls [Class] the class to register.
213
213
  # @param name [String] the name to register the class as. Defaults to the name of the class.
214
+ # @param fields [Hash] a map from field names on instances of +cls+ to types, or Relation objects.
215
+ # @param build_query [Proc] a method to produce a query for +cls+ objects, given a list of Filters.
216
+ # @param exec_query [Proc] a method to execute a query produced by +build_query+
217
+ # @param combine_query [Proc] a method to merge two queries produced by +build_query+
214
218
  # @raise [DuplicateClassAliasError] if attempting to register a class
215
219
  # under a previously-registered name.
216
220
  # @raise [FFI::Error] if the FFI call returns an error.
data/lib/oso/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Oso
4
- VERSION = '0.20.1-beta'
4
+ VERSION = '0.20.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oso-oso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1.pre.beta
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oso Security, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -197,9 +197,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
197
197
  version: 2.4.0
198
198
  required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  requirements:
200
- - - ">"
200
+ - - ">="
201
201
  - !ruby/object:Gem::Version
202
- version: 1.3.1
202
+ version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
205
  rubygems_version: 2.6.14.4