mikras_utils 0.14.0 → 0.14.1

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: '09748841bbccd2fc59e03f01fd240ac333963e7f6e8f35ed68d3d8268fdb4a97'
4
- data.tar.gz: b058155721495e702725d5cf1a68d37139e3c8abe82089939e3c018ac5b3e7b3
3
+ metadata.gz: a7a7d9d893a73103e2159bfbc3ec2d0ff48fc644dec46bff98e35173d98bcff0
4
+ data.tar.gz: 872e5596dead57f495e4b7f903a5607063a4efd2e46b7716414fdfd0c6688e34
5
5
  SHA512:
6
- metadata.gz: b25c043d64872f36c9b8d92e0f86d314164ef19695273255030d685e42497d0f7497395cf66718a41bf65e2ee6d4a4c1fad7db1b9202358ca6180e30df88eb76
7
- data.tar.gz: b66d7b04e85ff125b6f8b5dc143bdb7893db08686c036899ca37ac0aa6aa7dd58edda99b976962266ebae4e00343fd80d1e66aa9c719846bf327dedc42c89888
6
+ metadata.gz: 198336a960602043f627077526bbdb1962ea32709aa9d82cecd6b244bdc64a59034db125f429c11fe51b19037e5d08141077f7b8d9145924169f06ebb9eb4daf
7
+ data.tar.gz: ace4fdcf35f66b9be6ee8e4ecdac0e0a70f6fdd4d9e79468bfbb39819a5a7c554f1be6ca4c73a7280139c0de1ad9e814c2eba90029d4482600c2ddf8fd8f937e
data/exe/mkacl CHANGED
@@ -79,10 +79,12 @@ end
79
79
 
80
80
  spec = MkAcl::Parser.parse(file)
81
81
  MkAcl::Analyzer.analyze(spec, conn, warn: !opts.no_warn?)
82
+
82
83
  if opts.dump?
83
84
  spec.dump
84
85
  exit
85
86
  end
87
+
86
88
  MkAcl::Generator.generate(spec, conn, modules, interactive: opts.interactive?)
87
89
 
88
90
 
@@ -26,11 +26,15 @@ module MkAcl
26
26
  delete from acl_portal.acl_actions;
27
27
  delete from acl_portal.acl_tables;
28
28
  ).align
29
+ puts
29
30
  end
30
31
 
31
32
  def generate_seeds
32
33
  for table in spec.tables
33
34
  puts %(
35
+ --
36
+ -- #{table.name.gsub("_", " ").upcase}
37
+ --
34
38
  insert into acl_portal.acl_tables (
35
39
  schema_name, table_name, record_name, domain,
36
40
  parent_schema_name, parent_table_name, parent_link_field,
@@ -50,7 +54,7 @@ module MkAcl
50
54
 
51
55
  table.actions.values.each { |action|
52
56
  puts %(
53
- insert into acl_portal.acl_actions (table_id, kind)
57
+ insert into acl_portal.acl_actions (acl_table_id, kind)
54
58
  values (:table_id, '#{action.name.upcase}')
55
59
  returning id as "action_id"
56
60
  \\gset
@@ -63,21 +67,22 @@ module MkAcl
63
67
  puts %(
64
68
  insert into acl_portal.acl_rules (
65
69
  acl_action_id, roles, filter, assert, function_name, fields, tables, ordinal)
66
- values (:action_id, #{values.join(', ')});
70
+ values (:action_id, #{values.join(', ')})
71
+ returning id as "rule_id"
72
+ \\gset
67
73
  ).align
68
74
  puts
69
- }
70
75
 
71
- action.stamps.each { |stamp|
72
- puts %(
73
- insert into acl_portal.acl_stamps (action_id, watch, stamp)
74
- values (
75
- :action_id,
76
- #{conn.quote_value(stamp.watch)},
77
- #{conn.quote_value(stamp.stamp)}
78
- );
79
- ).align
80
- puts
76
+ rule.stamps.each { |stamp|
77
+ puts %(
78
+ insert into acl_portal.acl_stamps (acl_rule_id, watch, stamp)
79
+ values (
80
+ :rule_id,
81
+ #{conn.quote_value(stamp.watch)},
82
+ #{conn.quote_value(stamp.stamp)}
83
+ );
84
+ ).align
85
+ }
81
86
  }
82
87
  }
83
88
  end
@@ -164,19 +164,23 @@ module MkAcl
164
164
 
165
165
  def to_s() name end
166
166
 
167
- def dump(header)
168
- header = "#{header || name}:"
167
+ def dump_body
169
168
  if rules.size == 1
170
- puts header
171
- indent { rules.first.dump }
169
+ rules.first.dump
172
170
  elsif rules.size > 1
173
- puts header
174
- indent {
175
- for rule in rules.sort_by(&:ordinal)
176
- print "- "
177
- indent(bol: false) { rule.dump }
178
- end
179
- }
171
+ for rule in rules.sort_by(&:ordinal)
172
+ print "- "
173
+ indent(bol: false) { rule.dump }
174
+ end
175
+ end
176
+ end
177
+
178
+ def dump(header = nil)
179
+ if header
180
+ header = "#{header || name}:"
181
+ indent { dump_body }
182
+ else
183
+ dump_body
180
184
  end
181
185
  end
182
186
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MikrasUtils
4
- VERSION = "0.14.0"
4
+ VERSION = "0.14.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikras_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen