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 +4 -4
- data/Gemfile.lock +2 -2
- data/ext/oso-oso/lib/libpolar.dylib +0 -0
- data/ext/oso-oso/lib/libpolar.so +0 -0
- data/ext/oso-oso/lib/polar.dll +0 -0
- data/lib/oso/oso.rb +6 -6
- data/lib/oso/polar/data_filtering.rb +9 -0
- data/lib/oso/polar/polar.rb +6 -2
- data/lib/oso/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da642b9fbbfcad2d836a8db8c6ac83cbc8f1127a
|
4
|
+
data.tar.gz: 1012ef61aa0a1791a1c759ba9f62e108918898b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48d52111b817769f31086b4adbd7252bcab4355792ba85e378ab4a27c68272e8d2af55f8d2a258e0a3bb3b2cea30b6d0c98f6e20eec7ed9d1b127011a506cab7
|
7
|
+
data.tar.gz: f40a6c5565655ee508ebc0c20b7f571616b42d4a76f986b51ad4349c1fe05200d8165990c98a00e2a7388ac41eb96182095b52a9f08ad022cc0880801ad87997
|
data/Gemfile.lock
CHANGED
Binary file
|
data/ext/oso-oso/lib/libpolar.so
CHANGED
Binary file
|
data/ext/oso-oso/lib/polar.dll
CHANGED
Binary file
|
data/lib/oso/oso.rb
CHANGED
@@ -173,14 +173,14 @@ module Oso
|
|
173
173
|
fields
|
174
174
|
end
|
175
175
|
|
176
|
-
#
|
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
|
-
# @
|
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
|
-
#
|
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
|
-
# @
|
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
|
data/lib/oso/polar/polar.rb
CHANGED
@@ -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
|
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
|
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
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
|
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-
|
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:
|
202
|
+
version: '0'
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
205
|
rubygems_version: 2.6.14.4
|