mikras_utils 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c16e80939523ecb0aaaf1c5bcc688f78868fc3074e9baf59f33376b119048816
|
4
|
+
data.tar.gz: 1d8ff5f5f1b5cf67841f6e21737b31bb12b3d5ed5f0813694e403450b5c9324f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83cf23edadfd58d6aa08af29bf832146f7860924d9a2899f69473e82431d8bf2bbfb0707f375d3c11a0947830cde968c3481e04cdb92e2928306d21cd60b256d
|
7
|
+
data.tar.gz: 9520bc10e0e990be7d5a17efba03682881396b4ab6928a06dea92357213abe430d06af02705090c561d8a2b00eca6faeda2e6a06bebb78c8fadcfe59fa63c1a2
|
@@ -58,10 +58,11 @@ module MkAcl
|
|
58
58
|
puts
|
59
59
|
|
60
60
|
action.rules.each { |rule|
|
61
|
-
fields = %w(roles filter assert fields tables ordinal)
|
61
|
+
fields = %w(roles filter assert mutation fields tables ordinal)
|
62
62
|
values = fields.map { |field| conn.quote_value(rule.send(field.to_sym), elem_type: :text) }
|
63
63
|
puts %(
|
64
|
-
insert into acl_portal.acl_rules (
|
64
|
+
insert into acl_portal.acl_rules (
|
65
|
+
acl_action_id, roles, filter, assert, mutation, fields, tables, ordinal)
|
65
66
|
values (:action_id, #{values.join(', ')});
|
66
67
|
).align
|
67
68
|
puts
|
@@ -59,6 +59,7 @@ module MkAcl
|
|
59
59
|
constrain?(action_name, :insert, :select, :update, :delete, :attach, :detach) or
|
60
60
|
error "Illegal action '#{action_name}'"
|
61
61
|
|
62
|
+
# real_action_names break :attach into both :attach and :detach
|
62
63
|
for real_action_name in (action_name == :attach ? [:attach, :detach] : [action_name])
|
63
64
|
constrain?(entries, String, Array, Hash) or
|
64
65
|
error "Illegal value for #{action_name} entry '#{entries}'"
|
@@ -72,6 +73,7 @@ module MkAcl
|
|
72
73
|
when String
|
73
74
|
entries = [{ roles: entries }]
|
74
75
|
when Array
|
76
|
+
# Arrays can't specify mutations (for now)
|
75
77
|
entries.reject! { |element|
|
76
78
|
timestamps = element.delete(:timestamps) and parse_timestamps(action, timestamps)
|
77
79
|
}
|
@@ -127,6 +129,7 @@ module MkAcl
|
|
127
129
|
when :roles; rule.roles = norm_array(value)
|
128
130
|
when :filter; rule.filter = norm_value(value)
|
129
131
|
when :assert; rule.assert = norm_value(value)
|
132
|
+
when :mutation; rule.mutation = value.nil? ? nil : norm_value(value)
|
130
133
|
when :fields; rule.fields = value.nil? ? nil : norm_array(value)
|
131
134
|
when :tables; rule.tables = norm_array(value)
|
132
135
|
else
|
@@ -140,4 +143,27 @@ module MkAcl
|
|
140
143
|
end
|
141
144
|
end
|
142
145
|
end
|
146
|
+
|
147
|
+
#def declare_record(name, array_arg = nil, &record_
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
143
169
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
|
2
2
|
module MkAcl
|
3
|
+
DEFAULT_MUTATION = "app_portal.mutate"
|
4
|
+
|
3
5
|
class Spec
|
4
6
|
# Source SPEC file. Only for informational purposes
|
5
7
|
attr_reader :file
|
@@ -218,6 +220,7 @@ module MkAcl
|
|
218
220
|
attr_accessor :roles # Roles that this rule applies to
|
219
221
|
attr_accessor :filter # Goes into the postgres policy, may be nil
|
220
222
|
attr_accessor :assert # Goes into the postgres trigger, may be nil
|
223
|
+
attr_accessor :mutation # Mutation function to use, may be nil. Default app_portal.mutate()
|
221
224
|
attr_accessor :fields # Only used for insert and update, nil otherwise
|
222
225
|
attr_accessor :tables # Only used for attach and detach, nil otherwise
|
223
226
|
attr_reader :ordinal
|
@@ -234,6 +237,7 @@ module MkAcl
|
|
234
237
|
@roles = []
|
235
238
|
@filter = nil
|
236
239
|
@assert = nil
|
240
|
+
@mutation = DEFAULT_MUTATION
|
237
241
|
@fields = %w(insert update).include?(action.name) ? [] : nil
|
238
242
|
@tables = %w(attach).include?(action.name) ? [] : nil
|
239
243
|
|
@@ -244,6 +248,7 @@ module MkAcl
|
|
244
248
|
puts "roles: [#{roles.join(' ')}]"
|
245
249
|
puts "filter: #{filter}" if filter
|
246
250
|
puts "assert: #{assert}" if assert
|
251
|
+
puts "mutation: #{mutation || 'nil'}" if mutation != DEFAULT_MUTATION
|
247
252
|
puts "fields: [#{fields.join(' ')}]" if fields && !fields.empty?
|
248
253
|
puts "tables: [#{tables.join(' ')}]" if tables && !tables.empty?
|
249
254
|
puts "ordinal: #{ordinal}"
|
data/lib/mikras_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikras_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg_conn
|