pg_rails 7.5.4 → 7.5.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: 0f12846cd393967f0aac07acebf37b6799a9e67983da3ee892311aac4fd8a93b
4
- data.tar.gz: dc6a9d65a1454b891de4bcd751f5f74f1b51a27d2fdc46c0baaf216db28a9306
3
+ metadata.gz: 6147cb183d30183dd5d8a80431d86acf783df0d94b0521a3cd68d25a71e75feb
4
+ data.tar.gz: 2a25529a08aa2883675013101c688ef2d2afd9e84294438e67aac9393fcfe3c9
5
5
  SHA512:
6
- metadata.gz: a832616bb110d3662bc1b2f07991f4dc9015ba95a0e17584b749c36058cea9d87928ca7403cc3c46a62789f13abdaff3c827be6bce8d3468420861380bddff3b
7
- data.tar.gz: 3c103db1aa747b5fd09757c680505d203d06afad591b46ee1903d36037a35de5b2b02ef0475f15f4f8e222accfafb21a8f75a2932b83e93f7fa6c2a82eb763b7
6
+ metadata.gz: 4f3e802e2f8f75c265744ee30602c192a4e7ebbee6551295ef140e5d0af978ce5729bb9520cc98557518961bb0c2805252797de899fadafbdec183623822c8c1
7
+ data.tar.gz: 15ccca5fb52f689ce26402d75fcbf3b7794f8bf2b374c15e5d4ca385b012c17c4228bb45c475a5dc43ee449403eedaab4c95f17ebb1f9c1b8326124870b37af4
@@ -18,11 +18,17 @@ module PgEngine
18
18
  # raise ActsAsTenant::Errors::NoTenantSet
19
19
  # end
20
20
  # FIXME: if current_tenant.present? check it's not discarded
21
-
21
+ # FIXME: if session['current_user_account'] present? check
22
+ # user belongs to it, and if not, cleanup
22
23
  if Current.user.present?
23
24
  user_accounts = Current.user.user_accounts.kept
24
25
  if ActsAsTenant.current_tenant.present?
25
26
  unless user_accounts.exists?(account: ActsAsTenant.current_tenant)
27
+ pg_warn <<~WARN
28
+ #{Current.user.to_gid} not belongs to \
29
+ #{ActsAsTenant.current_tenant.to_gid}. Signed out
30
+ WARN
31
+
26
32
  sign_out(Current.user)
27
33
  throw :warden, scope: :user, message: :invalid
28
34
  end
@@ -32,8 +38,9 @@ module PgEngine
32
38
  account = if user_accounts.count == 1
33
39
  user_accounts.first.account
34
40
  elsif session['current_user_account'].present?
35
- UserAccount.where(id: session['current_user_account']).first&.account
41
+ user_accounts.where(id: session['current_user_account']).first&.account
36
42
  end
43
+
37
44
  set_current_tenant(account)
38
45
  end
39
46
  end
@@ -6,12 +6,14 @@ module PgEngine
6
6
 
7
7
  # :nocov:
8
8
  def login_as
9
+ # FIXME: make a POST route
9
10
  return head :bad_request unless dev_user_or_env?
10
11
 
11
12
  usuario = User.find(params[:id])
12
13
  if usuario.confirmed_at.present?
13
14
  sign_in(:user, usuario)
14
- redirect_to after_sign_in_path_for(usuario)
15
+ # redirect_to after_sign_in_path_for(usuario)
16
+ redirect_to users_root_path
15
17
  else
16
18
  go_back('No está confirmado')
17
19
  end
@@ -10,11 +10,13 @@ module Users
10
10
  layout 'pg_layout/centered'
11
11
 
12
12
  def list
13
- @user_accounts = Current.user.user_accounts
13
+ @user_accounts = Current.user.user_accounts.kept
14
14
  end
15
15
 
16
16
  def switch
17
- user_account = UserAccount.find(params[:user_account_id])
17
+ # FIXME: handle not found
18
+ scope = Current.user.user_accounts.kept
19
+ user_account = scope.find(UserAccount.decode_id(params[:user_account_id]))
18
20
  session['current_user_account'] = user_account.id
19
21
  redirect_to root_path
20
22
  end
@@ -6,8 +6,10 @@ div style="max-width: 30em"
6
6
  table.table.table-sm
7
7
  tr
8
8
  th Nombre
9
+ th Email
9
10
  th Roles
10
11
  - @account.user_accounts.each do |user_account|
11
12
  tr
12
13
  td = user_account.user
14
+ td = user_account.user.email
13
15
  td = user_account.profiles.texts.join(', ')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.5.4'
4
+ VERSION = '7.5.5'
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.4
4
+ version: 7.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso