pg_rails 7.5.0 → 7.5.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: c9044a5f343884a27bcfdb2be81907fcaaa743b4c1419c4dd1646214a50c5f7e
4
- data.tar.gz: 2542d054eb7ec2ae29e95fdff5a7a0d8cccdef4d57e5a7073b4c0fe945f91fff
3
+ metadata.gz: 99e5df3ed137be9ec63699ccfd381f75f63cf1a7a272c36e49177147be1ad958
4
+ data.tar.gz: f95e10f28d40ab3c513e0a9e680baf268fe500f3a740cbde18fe3754b4f6941e
5
5
  SHA512:
6
- metadata.gz: 19ebd2bc479aab28961ba3280a2c0bf276e202501eecfc0474863a00e89882c79bef6c369e9d1ae7a533ad9118716389af0964ae66395a34ff0572011fb5e4ac
7
- data.tar.gz: 5a37d34ab77355940e8c8988af1a9c4d839069b9b37bf645088ea5325c18f8e4829c99ae31877c53195d08caf22bae6ba01efa0d55cf8d95872056a481d51473
6
+ metadata.gz: 69842b1daf20fce9bfb7a62196d44a83e5b16d6f18198fdf7afcaa229e7ce86f51383106e8d4158259af3eebc9190bc26724cd39cb00afb837902c34e45fe7ae
7
+ data.tar.gz: d27a734ecdd58f0d552b76a2fbc4225341572b24ba467b398be5e93f489eac4d60a116333a828b3382be9791f830aea715e506f4fda01a923f6d5c00ee41a16f
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module PgEngine
4
+ module RequireTenantSet
5
+ def self.included(klass)
6
+ klass.before_action :require_tenant_set
7
+ end
8
+
9
+ def require_tenant_set
10
+ return if ActsAsTenant.current_tenant.present?
11
+
12
+ redirect_to users_account_switcher_path
13
+ end
14
+ end
15
+ end
@@ -29,10 +29,9 @@ module PgEngine
29
29
  account = if session['current_user_account'].present?
30
30
  UserAccount.where(id: session['current_user_account']).first&.account
31
31
  elsif Current.user.user_accounts.count == 1
32
- Current.user.user_accounts.first
32
+ Current.user.user_accounts.first.account
33
33
  end
34
34
  set_current_tenant(account)
35
- # FIXME: un concern que redirija al switcher si no hay current tenant
36
35
  end
37
36
  Current.account = ActsAsTenant.current_tenant
38
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.5.0'
4
+ VERSION = '7.5.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.5.0
4
+ version: 7.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso
@@ -677,6 +677,7 @@ files:
677
677
  - pg_engine/app/controllers/admin/eventos_controller.rb
678
678
  - pg_engine/app/controllers/admin/user_accounts_controller.rb
679
679
  - pg_engine/app/controllers/admin/users_controller.rb
680
+ - pg_engine/app/controllers/concerns/pg_engine/require_tenant_set.rb
680
681
  - pg_engine/app/controllers/concerns/pg_engine/resource.rb
681
682
  - pg_engine/app/controllers/pg_engine/base_controller.rb
682
683
  - pg_engine/app/controllers/pg_engine/devise_controller.rb