zuora_connect 3.0.2.pre.i → 3.0.2.pre.m

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: acded16be82a4aa36090fda0248e1d62b739e6ea1bbe39a7b365c137c07c4481
4
- data.tar.gz: 263c629b6b718b068f4a6dcc3b9603ab04f0c6895d928a6f1841eae2e5343149
3
+ metadata.gz: 5e7c7ce2e0e78ef1a25360865897abc69fa2c3f21b80e1ca42cee49a85c9cb01
4
+ data.tar.gz: 71882230203de07dada155bcc578f7256bd5db78b868ed3a8a58dca134d7559d
5
5
  SHA512:
6
- metadata.gz: f06d9884240c45a96f17dc2a3927a8addca134d74d96fcdc38e0905b7d1d53f54e32babc95745fb241a754fbbc56d82e835bc1162f459364917abe8295861b63
7
- data.tar.gz: 14deefe69fe5b535538f93092606b228397c60ef5ae11417d9c193ec349e50786abd1155673bec58b005cb0fae244f23411850f21cf3b7e5b1f5ef6ecd9f99e8
6
+ metadata.gz: 044cf34d49fc00ef25d5a6ede5069daef812b5344a6b33a854cdb02e8129e7e92f7b80c8c3a151183ecbffaf91a562e55f6816bdd8ec57a64d2f699e20eca9d5
7
+ data.tar.gz: 739faf051944ccf5f6db4ab88dfee35408939a939c72784902146af9dc98864045b57551e1b967933cb5984240fa00e783bbceb13073bbc4ba224ad37ae96557
@@ -12,6 +12,9 @@ module ZuoraConnect
12
12
  before_update :set_updated_by_id
13
13
  before_destroy :set_updated_by_id
14
14
 
15
+ belongs_to :updated_by, class_name: 'ZuoraConnect::ZuoraUser', foreign_key: 'updated_by_id', primary_key: "zuora_user_id", optional: true
16
+ belongs_to :created_by, class_name: 'ZuoraConnect::ZuoraUser', foreign_key: 'created_by_id', primary_key: "zuora_user_id", optional: true
17
+
15
18
  private
16
19
 
17
20
  def set_created_by_id
@@ -128,7 +128,7 @@ module ZuoraConnect
128
128
  raise
129
129
  end
130
130
  end
131
- if migrate && ActiveRecord::Migrator.needs_migration?
131
+ if migrate
132
132
  Apartment::Migrator.migrate(self.id)
133
133
  end
134
134
  end
@@ -267,7 +267,7 @@ module ZuoraConnect
267
267
  params = {
268
268
  name: self.task_data.dig('name'),
269
269
  zuora_entity_ids: (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).select {|entity| !entity['skip'].to_bool}.map{|e| e['id']}.uniq,
270
- zuora_global_entity_id: task_data.dig(LOGIN_TENANT_DESTINATION, 'entities', 0, 'globalEntityId').to_i, # tenant id of the global/parent entity, 0 if nil
270
+ zuora_global_tenant_id: task_data.dig(LOGIN_TENANT_DESTINATION, 'entities', 0, 'globalEntityId').to_i, # tenant id of the global/parent entity, 0 if nil
271
271
  zuora_tenant_ids: tenants.map(&:to_s).uniq,
272
272
  organizations: organizations
273
273
  }
@@ -8,13 +8,16 @@ module ZuoraConnect
8
8
  # zuora_user_id/zuora_entity_id both come from cookie or headers
9
9
  # zuora_current_identity comes from session
10
10
  # app_instance is only needed to try to migrate :/
11
- def self.update_id_response(zuora_user_id, zuora_entity_id, zuora_current_identity, app_instance)
11
+ def self.update_id_response(zuora_user_id, zuora_entity_id, zuora_current_identity, app_instance, permissions)
12
12
  zuora_user = find_or_create_by!(zuora_user_id: zuora_user_id) do |user|
13
13
  user.zuora_identity_response = { zuora_entity_id => zuora_current_identity }
14
+ user.app_permissions = permissions
14
15
  end
15
16
 
16
- if zuora_user.stale_identity?
17
- zuora_user.zuora_identity_response[zuora_entity_id] = zuora_current_identity
17
+ zuora_user.zuora_identity_response[zuora_entity_id] = zuora_current_identity
18
+ zuora_user.app_permissions = permissions
19
+
20
+ if zuora_user.changed?
18
21
  zuora_user.save!
19
22
  end
20
23
 
@@ -28,11 +31,5 @@ module ZuoraConnect
28
31
  app_instance.apartment_switch(nil, true)
29
32
  retry
30
33
  end
31
-
32
- # NOTE(hartley): this value was extracted from original usage in helper,
33
- # need to investigate when exactly the identity_response should be updated
34
- def stale_identity?
35
- updated_at < Time.now - 1.day
36
- end
37
34
  end
38
35
  end
@@ -18,7 +18,7 @@ BEGIN
18
18
 
19
19
  FOR schema IN EXECUTE
20
20
  format(
21
- 'SELECT schema_name FROM information_schema.schemata WHERE schema_name ~ ''^[0-9]+$'''
21
+ 'SELECT nspname FROM pg_catalog.pg_namespace where nspname ~ ''^[0-9]+$'''
22
22
  )
23
23
  LOOP
24
24
  IF NOT created THEN
@@ -26,7 +26,7 @@ BEGIN
26
26
  EXECUTE format(
27
27
  'CREATE TABLE "public".%I (LIKE %I.%I)',
28
28
  aggregate_table_name,
29
- schema.schema_name, table_name
29
+ schema.nspname, table_name
30
30
  );
31
31
  -- Add a special `schema_name` column, which we'll populate with the name of the schema
32
32
  -- each row originated from
@@ -68,17 +68,17 @@ BEGIN
68
68
  -- and insert them into our new aggregate table
69
69
  EXECUTE format(
70
70
  'SELECT string_agg(column_name, '','') from information_schema.columns where table_name = ''%s'' AND table_schema = ''%s''',
71
- table_name, schema.schema_name
71
+ table_name, schema.nspname
72
72
  ) into fields_order;
73
73
 
74
- raise notice 'Importing Schema %', schema.schema_name;
74
+ raise notice 'Importing Schema %', schema.nspname;
75
75
 
76
76
  EXECUTE format(
77
77
  'INSERT INTO "public".%I (schema_name, %s) (SELECT ''%s'' AS schema_name, * FROM %I.%I %s )',
78
78
  aggregate_table_name,
79
79
  fields_order,
80
- schema.schema_name,
81
- schema.schema_name, table_name,
80
+ schema.nspname,
81
+ schema.nspname, table_name,
82
82
  filter
83
83
  );
84
84
  END LOOP;
@@ -64,6 +64,8 @@ module ZuoraConnect
64
64
  else
65
65
  check_instance
66
66
  end
67
+
68
+ @zuora_user = ZuoraConnect::ZuoraUser.find_by(zuora_user_id: ZuoraConnect::ZuoraUser.current_user_id)
67
69
  end
68
70
  end
69
71
 
@@ -419,7 +421,8 @@ module ZuoraConnect
419
421
  if defined?(@appinstance) && !@appinstance['zuora_logins'].nil?
420
422
  @zuora_user = ZuoraConnect::ZuoraUser.update_id_response(
421
423
  zuora_user_id, zuora_entity_id, session["ZuoraCurrentIdentity"],
422
- @appinstance
424
+ @appinstance,
425
+ session['ZuoraCurrentUserInfo']['permissions']
423
426
  )
424
427
  @zuora_user.session = session
425
428
  ZuoraConnect::ZuoraUser.current_user_id = zuora_user_id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZuoraConnect
4
- VERSION = "3.0.2-i"
4
+ VERSION = "3.0.2-m"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zuora_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2.pre.i
4
+ version: 3.0.2.pre.m
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connect Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-30 00:00:00.000000000 Z
11
+ date: 2022-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment
@@ -445,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
445
  - !ruby/object:Gem::Version
446
446
  version: 1.3.1
447
447
  requirements: []
448
- rubygems_version: 3.2.22
448
+ rubygems_version: 3.2.32
449
449
  signing_key:
450
450
  specification_version: 4
451
451
  summary: Summary of Connect.