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 +4 -4
- data/pg_engine/app/controllers/pg_engine/base_controller.rb +9 -2
- data/pg_engine/app/controllers/pg_engine/base_public_controller.rb +3 -1
- data/pg_engine/app/controllers/users/account_switcher_controller.rb +4 -2
- data/pg_engine/app/views/users/accounts/show.html.slim +2 -0
- data/pg_rails/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6147cb183d30183dd5d8a80431d86acf783df0d94b0521a3cd68d25a71e75feb
|
4
|
+
data.tar.gz: 2a25529a08aa2883675013101c688ef2d2afd9e84294438e67aac9393fcfe3c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|
data/pg_rails/lib/version.rb
CHANGED