json2sql 1.0.15 → 1.0.16

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: 698df3c08077bb25df5b606c6cc419891dad06698053d5af5e5fb451d33a9c1c
4
- data.tar.gz: 5e7469e5e323e7226f7a200fbd60daaedc92d1cefdcac7efd78ba8cfd1680897
3
+ metadata.gz: 39f16dc1347524e05a3b12ea619883c5cfec2ebf86c13df6954f549fb7f7d934
4
+ data.tar.gz: 6590f96be14c84a510368e25bf875e5223825162b39b1bb3d06f075a6c43a1cc
5
5
  SHA512:
6
- metadata.gz: 685484a3bc90af693415f4d9bc20321b256e1279b52edcb5abe554195532f205076f3ca5c7e54c627e757f69a1029f9d5acb4eb1f479755503d9eb0208813c25
7
- data.tar.gz: 4558dc87daef35b1b26805fb8d49f35ad1bc67d80395f94fa52ef13ffa1a9c474bb7842a878275e611aafe157496529ff59b1f625537b13f949a6973efe827cc
6
+ metadata.gz: 51c4cc95f0a1fb7d529b2366515a0661f48c26cd6c28da176c0e58f7c7bb7f900853e1ce1ffa76c84cfc65797eab3bae6cecac1fd88558fc70c429253005c9d6
7
+ data.tar.gz: 6a6d13a1d6ba250e52fc7a87f5e3f99852d815cbf6bd34b34a170972a478c35df2836cb124959e662b3abd2fb4d8294cb3deb087fd1d80ba2c044eda4416c96b
@@ -115,7 +115,7 @@ module Json2sql
115
115
 
116
116
  # Filters children/parents relations in :allow mode.
117
117
  # Only relations present as keys in config[relation] pass through.
118
- # If config[relation] is absent or not a Hash, relations are untouched.
118
+ # If config[relation] is absent or not a Hash, all relations are blocked.
119
119
  # No-op in :deny mode.
120
120
 
121
121
  def filter_relations(params, config, relation)
@@ -128,15 +128,14 @@ module Json2sql
128
128
 
129
129
  config_tables = config[relation]
130
130
 
131
- return unless config_tables.is_a?(Hash)
132
-
133
- params[relation] = param_tables.select { |table, _| config_tables.key?(table) }
131
+ params[relation] = config_tables.is_a?(Hash) ? param_tables.select { |table, _| config_tables.key?(table) } : {}
134
132
  end
135
133
 
136
134
  # Filters "columns" using mode (:allow or :deny).
137
135
  # Handles Array (SELECT) and Hash (INSERT/UPDATE) column formats.
138
136
  # Hash entries (function columns) always pass through in :allow mode.
139
- # If no column list is defined for the table, columns are untouched.
137
+ # If no column list is defined: in :allow mode all columns are blocked;
138
+ # in :deny mode columns are untouched.
140
139
 
141
140
  def filter_columns(params, config)
142
141
 
@@ -146,7 +145,10 @@ module Json2sql
146
145
 
147
146
  list = config["columns"]
148
147
 
149
- return unless list.is_a?(Array)
148
+ if !list.is_a?(Array)
149
+ params["columns"] = columns.is_a?(Array) ? [] : {} if @mode == :allow
150
+ return
151
+ end
150
152
 
151
153
  params["columns"] = if @mode == :deny
152
154
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Json2sql
4
- VERSION = "1.0.15"
4
+ VERSION = "1.0.16"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json2sql
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago da Silva