gooddata 2.1.4 → 2.1.5

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
  SHA256:
3
- metadata.gz: 41ac427d12089548d4824b45b9c4a0c7ec48cc4accf9392c0fc5de9690ba4938
4
- data.tar.gz: f26af740b01d6a250372ebcadea0507187b3a4f4358d920dd0ec145c4570a707
3
+ metadata.gz: 70f65a982340755509b16b9cac033476c61bdad813acaa9ae74859133811d488
4
+ data.tar.gz: 8e5886e65ee704d6f5ebc7391f362457bd0e7c5d160d0f20c84986637101544f
5
5
  SHA512:
6
- metadata.gz: da45fbe1725e9415277718dc40ecc24ff4ddd120de3c2e6fc265bbfa7956fe2cdcc641af92467c0063ac49993ec3c580d1869da47f0aec87136445b47d78b6b0
7
- data.tar.gz: 05d051f23c87ddf0fd89e8428643f589bd7a795e68fa20a3c24d7dd346d925e3350dfdd42b120a6a1d0e379c162cfb1f1b6c0d5f4adbd86bbdb14a0f81dcc452
6
+ metadata.gz: 9fc2c4915c452d3e1781983d363d1a9506e6d56fde7a6b3883c624b4dd953e82ab05a06f74503788f13dbc41357712493c705d165357c2f5aeecf0e5ad6cf5bb
7
+ data.tar.gz: ceab4299659706880e0b555b5303c7623e948872cdf60272d8b117c2f0abb6f322a608026871673feb364b846d4ce6bec701276b2a6103c9adcfb4f395b0d4f5
data/.gdc-ii-config.yaml CHANGED
@@ -15,3 +15,7 @@ integratedTests:
15
15
  repo_mount_dir: /src
16
16
  microservices:
17
17
  - lcm-bricks
18
+
19
+ configFilesForUpdate:
20
+ - '.gdc-ii-config.yaml'
21
+ - '.gdc-ii-config-chart.yaml'
data/.travis.yml CHANGED
@@ -256,7 +256,7 @@ jobs:
256
256
  script: bundle exec rake test:unit
257
257
  os: osx
258
258
  osx_image: xcode9.3
259
- rvm: 2.4
259
+ rvm: 2.4.3
260
260
 
261
261
  - name: unit tests 2.5
262
262
  stage: after-merge
data/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 2.1.5
3
+ - BUGFIX: TMA-1534 LCM Dynamic Params do not work correctly for secure params
4
+ - BUGFIX: TMA-1520 fix NPE when given client does not exist in data product
5
+ - BUGFIX: TMA-1361 Allow user see all values of one label when set MUF on multiple labels
6
+ - BUGFIX: TMA-1521 update datasource payload to new json format
7
+ - BUGFIX: TMA-1506 fixing unit tests 2.4 failed on xcode9.3
8
+ - II-371: Handle multitple configuration files
9
+ - FEATURE: TMA-1275 release bricks 3.7.2
10
+ - Bump version to 2.1.4
11
+
2
12
  ## 2.1.4
3
13
  - BUGFIX: TMA-906 LCM Rollout/Provisioning does not set dynamic params in case apply for all schedules on client
4
14
  - BUGFIX: TMA-1519 Add limit param when get all projects
data/SDK_VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.1.5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.7.2
1
+ 3.7.3
@@ -230,6 +230,17 @@ module GoodData
230
230
  Base64.encode64(random_iv + encrypted)
231
231
  end
232
232
 
233
+ # Simple encrypt data with given key
234
+ def simple_encrypt(data, key)
235
+ cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
236
+ cipher.encrypt
237
+ cipher.key = key
238
+ encrypted = cipher.update(data)
239
+ encrypted << cipher.final
240
+
241
+ Base64.encode64(encrypted)
242
+ end
243
+
233
244
  def decrypt(database64, key)
234
245
  if key.nil? || key.empty?
235
246
  GoodData.logger.warn('WARNING: No encryption key provided.')
@@ -248,6 +259,23 @@ module GoodData
248
259
  decrypted << cipher.final
249
260
  decrypted
250
261
  end
262
+
263
+ # Simple decrypt data with given key
264
+ def simple_decrypt(database64, key)
265
+ if key.nil? || key.empty?
266
+ GoodData.logger.warn('WARNING: No encryption key provided.')
267
+ return 'no_key_provided'
268
+ end
269
+
270
+ data = Base64.decode64(database64)
271
+
272
+ cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
273
+ cipher.decrypt
274
+ cipher.key = key
275
+ decrypted = cipher.update(data)
276
+ decrypted << cipher.final
277
+ decrypted
278
+ end
251
279
  end
252
280
  end
253
281
 
@@ -29,6 +29,9 @@ module GoodData
29
29
 
30
30
  description 'Should the param be hidden?'
31
31
  param :param_secure_column, instance_of(Type::StringType), required: false
32
+
33
+ description 'Dynamic params encryption key'
34
+ param :dynamic_params_encryption_key, instance_of(Type::StringType), required: false
32
35
  end
33
36
 
34
37
  class << self
@@ -40,6 +43,10 @@ module GoodData
40
43
  param_name_column = params.param_name_column || 'param_name'
41
44
  param_value_column = params.param_value_column || 'param_value'
42
45
  param_secure_column = params.param_secure_column || 'param_secure'
46
+
47
+ encryption_key = params.dynamic_params_encryption_key || ''
48
+ exist_encryption_key = encryption_key.blank? ? false : true
49
+
43
50
  results = []
44
51
 
45
52
  input_source = params.dynamic_params.input_source
@@ -49,9 +56,14 @@ module GoodData
49
56
  end
50
57
 
51
58
  schedule_params = {}
59
+ schedule_hidden_params = {}
60
+ exist_param_secure = false
52
61
 
53
62
  CSV.foreach(input_data, :headers => true, :return_headers => false, encoding: 'utf-8') do |row|
54
63
  is_param_secure = row[param_secure_column] == 'true'
64
+ is_decrypt_secure_value = is_param_secure && exist_encryption_key ? true : false
65
+ exist_param_secure = true if is_param_secure
66
+
55
67
  safe_to_print_row = row.to_hash
56
68
  safe_to_print_row[param_value_column] = '******' if is_param_secure
57
69
  GoodData.logger.debug("Processing row: #{safe_to_print_row}")
@@ -63,19 +75,31 @@ module GoodData
63
75
  schedule_title_column_value = row[schedule_title_column]
64
76
  schedule_name = schedule_title_column_value.blank? ? :all_schedules : schedule_title_column_value
65
77
 
66
- schedule_params[client_id] ||= {}
67
- schedule_params[client_id][schedule_name] ||= {}
78
+ param_name = row[param_name_column]
79
+ param_value = row[param_value_column]
80
+ param_value = GoodData::Helpers.simple_decrypt(param_value, encryption_key) if is_decrypt_secure_value
68
81
 
69
- schedule_params[client_id][schedule_name].merge!(row[param_name_column] => row[param_value_column])
82
+ add_dynamic_param(is_param_secure ? schedule_hidden_params : schedule_params, client_id, schedule_name, param_name, param_value)
70
83
  end
71
84
 
85
+ GoodData.logger.warn("dynamic_params_encryption_key parameter doesn't exist") if exist_param_secure && !exist_encryption_key
86
+
72
87
  {
73
88
  results: results,
74
89
  params: {
75
- schedule_params: schedule_params
90
+ schedule_params: schedule_params,
91
+ schedule_hidden_params: schedule_hidden_params
76
92
  }
77
93
  }
78
94
  end
95
+
96
+ private
97
+
98
+ def add_dynamic_param(params, client_id, schedule_name, param_name, param_value)
99
+ params[client_id] ||= {}
100
+ params[client_id][schedule_name] ||= {}
101
+ params[client_id][schedule_name].merge!(param_name => param_value)
102
+ end
79
103
  end
80
104
  end
81
105
  end
@@ -33,6 +33,9 @@ module GoodData
33
33
  description 'Schedule Parameters'
34
34
  param :schedule_params, instance_of(Type::HashType), required: false, default: {}
35
35
 
36
+ description 'Schedule Hidden Parameters'
37
+ param :schedule_hidden_params, instance_of(Type::HashType), required: false, default: {}
38
+
36
39
  description 'DataProduct to manage'
37
40
  param :data_product, instance_of(Type::GDDataProductType), required: false
38
41
 
@@ -98,10 +101,16 @@ module GoodData
98
101
  end
99
102
 
100
103
  delete_extra_process_schedule = GoodData::Helpers.to_boolean(params.delete_extra_process_schedule)
104
+
101
105
  schedule_params = params.schedule_params || {}
106
+ schedule_hidden_params = params.schedule_hidden_params || {}
107
+
102
108
  params_for_all_projects = schedule_params[:all_clients] || {}
103
109
  params_for_all_schedules_in_all_projects = params_for_all_projects[:all_schedules]
104
110
 
111
+ hidden_params_for_all_projects = schedule_hidden_params[:all_clients] || {}
112
+ hidden_params_for_all_schedules_in_all_projects = hidden_params_for_all_projects[:all_schedules]
113
+
105
114
  params.synchronize.peach do |info|
106
115
  from_project_etl_names = get_process_n_schedule_names(client, info.from) if delete_extra_process_schedule
107
116
 
@@ -122,9 +131,13 @@ module GoodData
122
131
  end
123
132
 
124
133
  client_id = entry[:client_id]
134
+
125
135
  params_for_this_client = schedule_params[client_id] || {}
126
136
  params_for_all_schedules_in_this_client = params_for_this_client[:all_schedules]
127
137
 
138
+ hidden_params_for_this_client = schedule_hidden_params[client_id] || {}
139
+ hidden_params_for_all_schedules_in_this_client = hidden_params_for_this_client[:all_schedules]
140
+
128
141
  to_project.set_metadata('GOODOT_CUSTOM_PROJECT_ID', client_id) # TMA-210
129
142
 
130
143
  to_project.schedules.each do |schedule|
@@ -136,13 +149,17 @@ module GoodData
136
149
  end
137
150
 
138
151
  schedule.update_params(schedule_additional_params) if schedule_additional_params
139
-
140
152
  schedule.update_params(params_for_all_schedules_in_all_projects) if params_for_all_schedules_in_all_projects
141
153
  schedule.update_params(params_for_all_projects[schedule.name]) if params_for_all_projects[schedule.name]
142
154
  schedule.update_params(params_for_all_schedules_in_this_client) if params_for_all_schedules_in_this_client
143
155
  schedule.update_params(params_for_this_client[schedule.name]) if params_for_this_client[schedule.name]
144
156
 
145
157
  schedule.update_hidden_params(schedule_additional_hidden_params) if schedule_additional_hidden_params
158
+ schedule.update_hidden_params(hidden_params_for_all_schedules_in_all_projects) if hidden_params_for_all_schedules_in_all_projects
159
+ schedule.update_hidden_params(hidden_params_for_all_projects[schedule.name]) if hidden_params_for_all_projects[schedule.name]
160
+ schedule.update_hidden_params(hidden_params_for_all_schedules_in_this_client) if hidden_params_for_all_schedules_in_this_client
161
+ schedule.update_hidden_params(hidden_params_for_this_client[schedule.name]) if hidden_params_for_this_client[schedule.name]
162
+
146
163
  schedule.enable
147
164
  schedule.save
148
165
  end
@@ -262,6 +262,8 @@ module GoodData
262
262
  fail "Client id cannot be empty" if client_id.blank?
263
263
 
264
264
  c = domain_clients.detect { |specific_client| specific_client.id == client_id }
265
+ fail "The client \"#{client_id}\" does not exist in data product \"#{data_product.data_product_id}\"" if c.nil?
266
+
265
267
  if params.segments && !segment_uris.include?(c.segment_uri)
266
268
  GoodData.logger.info("Client #{client_id} is outside segments_filter #{params.segments}")
267
269
  next
@@ -199,6 +199,16 @@ module GoodData
199
199
  attr_cache
200
200
  end
201
201
 
202
+ def self.create_muf_expression_cache(filters)
203
+ filters.reduce({}) do |a, e|
204
+ a[e[:login]] = e[:filters].reduce({}) do |h, filter|
205
+ h[filter[:label]] = :none
206
+ h
207
+ end
208
+ a
209
+ end
210
+ end
211
+
202
212
  # Walks over provided labels and picks those that have fewer than certain amount of values
203
213
  # This tries to balance for speed when working with small datasets (like users)
204
214
  # so it precaches the values and still be able to function for larger ones even
@@ -215,6 +225,7 @@ module GoodData
215
225
  values = filter[:values]
216
226
  label = labels_cache[filter[:label]]
217
227
  errors = []
228
+ muf_expression_cache = options[:muf_expression_cache]
218
229
 
219
230
  element_uris_by_values = Hash[values.map do |v|
220
231
  if lookups_cache.key?(label.uri)
@@ -238,12 +249,17 @@ module GoodData
238
249
  # happens when data is not yet loaded in the project
239
250
  no_values = element_uris.empty?
240
251
 
241
- expression = if no_values && options[:restrict_if_missing_all_values] && options[:type] == :muf
252
+ expression = if no_values && options[:restrict_if_missing_all_values]
242
253
  # create a filter that is always false to ensure the user can not see any data
243
254
  # as the proper MUF can not be constructed yet
244
255
  case options[:type]
245
256
  when :muf
246
- '1 <> 1'
257
+ muf_expression_cache[filter[:label]] = :all
258
+ if muf_expression_cache.value?(:none) || muf_expression_cache.value?(:restrict)
259
+ 'TRUE'
260
+ else
261
+ '1 <> 1'
262
+ end
247
263
  when :variable
248
264
  nil
249
265
  end
@@ -251,13 +267,14 @@ module GoodData
251
267
  # create a filter that is always true to ensure the user can see all data
252
268
  'TRUE'
253
269
  elsif filter[:over] && filter[:to]
270
+ muf_expression_cache[filter[:label]] = :restrict
254
271
  over = attr_cache[filter[:over]]
255
272
  to = attr_cache[filter[:to]]
256
273
  "([#{label.attribute_uri}] IN (#{element_uris.sort.map { |e| '[' + e + ']' }.join(', ')})) OVER [#{over && over.uri}] TO [#{to && to.uri}]"
257
274
  else
275
+ muf_expression_cache[filter[:label]] = :restrict
258
276
  "[#{label.attribute_uri}] IN (#{element_uris.sort.map { |e| '[' + e + ']' }.join(', ')})"
259
277
  end
260
-
261
278
  [expression, errors]
262
279
  end
263
280
 
@@ -288,8 +305,9 @@ module GoodData
288
305
  small_labels = get_small_labels(labels_cache)
289
306
  lookups_cache = create_lookups_cache(small_labels)
290
307
  attrs_cache = create_attrs_cache(filters, options)
308
+ muf_expression_cache = create_muf_expression_cache(filters)
291
309
  create_filter_proc = proc do |login, f|
292
- expression, errors = create_expression(f, labels_cache, lookups_cache, attrs_cache, options)
310
+ expression, errors = create_expression(f, labels_cache, lookups_cache, attrs_cache, options.merge(muf_expression_cache: muf_expression_cache[login]))
293
311
  safe_login = login.downcase
294
312
  profiles_uri = if options[:type] == :muf
295
313
  project_user = project_users.find { |u| u.login == safe_login }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-06-03 00:00:00.000000000 Z
17
+ date: 2019-07-16 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: license_finder