devise_masquerade 1.3.10 → 1.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -0
- data/app/controllers/devise/masquerades_controller.rb +10 -2
- data/lib/devise_masquerade/controllers/helpers.rb +3 -1
- data/lib/devise_masquerade/version.rb +1 -1
- data/lib/devise_masquerade.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02fcf52821938df133246e4b36ed07ee85ab96c036cd8da0cf35ace09c229491
|
4
|
+
data.tar.gz: 3247bf4be6fe21dc5ba5c83d804dab155d92286ef8c8c1625e92b181cb0c01dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f6902ea81dd6d5ffef2cd48cfa7e5b4521906f912a02b3986117ef933ebea89d7b63f2d5eb43372c1ad76a84d63ae433f236394bd1c16e83891efcaa300760
|
7
|
+
data.tar.gz: 40b48f52e4a162e2033c13ccc6a9fabf2b882dcfd64ad236a27f08e20f54862fd3139d07cb8a0c780d50d3f3c6cc06f9e1e9ffaf2dd16ffd3e42a7a67930f144
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -167,9 +167,14 @@ in `routes.rb`:
|
|
167
167
|
Devise.masquerade_bypass_warden_callback = false
|
168
168
|
Devise.masquerade_routes_back = false # if true, route back to the page the user was on via redirect_back
|
169
169
|
Devise.masquerading_resource_class = AdminUser
|
170
|
+
# optional: Devise.masquerading_resource_class = 'AdminUser'
|
171
|
+
|
170
172
|
# optional, default: masquerading_resource_class.model_name.param_key
|
171
173
|
Devise.masquerading_resource_name = :admin_user
|
174
|
+
|
172
175
|
Devise.masqueraded_resource_class = User
|
176
|
+
# optional: Devise.masqueraded_resource_class_name = 'User'
|
177
|
+
|
173
178
|
# optional, default: masqueraded_resource_class.model_name.param_key
|
174
179
|
Devise.masqueraded_resource_name = :user
|
175
180
|
```
|
@@ -98,7 +98,11 @@ class Devise::MasqueradesController < DeviseController
|
|
98
98
|
unless session[session_key_masqueraded_resource_class].blank?
|
99
99
|
session[session_key_masquerading_resource_class].constantize
|
100
100
|
else
|
101
|
-
Devise.
|
101
|
+
if Devise.masqueraded_resource_class_name.present?
|
102
|
+
Devise.masqueraded_resource_class_name.constantize
|
103
|
+
else
|
104
|
+
Devise.masqueraded_resource_class || resource_class
|
105
|
+
end
|
102
106
|
end
|
103
107
|
end
|
104
108
|
end
|
@@ -116,7 +120,11 @@ class Devise::MasqueradesController < DeviseController
|
|
116
120
|
unless session[session_key_masquerading_resource_class].blank?
|
117
121
|
session[session_key_masquerading_resource_class].constantize
|
118
122
|
else
|
119
|
-
Devise.
|
123
|
+
if Devise.masquerading_resource_class_name.present?
|
124
|
+
Devise.masquerading_resource_class_name.constantize
|
125
|
+
else
|
126
|
+
Devise.masquerading_resource_class || resource_class
|
127
|
+
end
|
120
128
|
end
|
121
129
|
end
|
122
130
|
end
|
@@ -12,7 +12,9 @@ module DeviseMasquerade
|
|
12
12
|
klass = unless params[:masqueraded_resource_class].blank?
|
13
13
|
params[:masqueraded_resource_class].constantize
|
14
14
|
else
|
15
|
-
if Devise.
|
15
|
+
if Devise.masqueraded_resource_class_name.present?
|
16
|
+
Devise.masqueraded_resource_class_name.constantize
|
17
|
+
elsif Devise.masqueraded_resource_class
|
16
18
|
Devise.masqueraded_resource_class
|
17
19
|
elsif defined?(User)
|
18
20
|
User
|
data/lib/devise_masquerade.rb
CHANGED
@@ -24,12 +24,18 @@ module Devise
|
|
24
24
|
# Example: Devise.masqueraded_resource_class = User
|
25
25
|
mattr_accessor :masqueraded_resource_class
|
26
26
|
|
27
|
+
# Example: Devise.masqueraded_resource_class_name = 'User'
|
28
|
+
mattr_accessor :masqueraded_resource_class_name
|
29
|
+
|
27
30
|
# Example: Devise.masqueraded_resource_name = :user
|
28
31
|
mattr_accessor :masqueraded_resource_name
|
29
32
|
|
30
33
|
# Example: Devise.masquerading_resource_class = AdminUser
|
31
34
|
mattr_accessor :masquerading_resource_class
|
32
35
|
|
36
|
+
# Example: Devise.masquerading_resource_class_name = 'AdminUser'
|
37
|
+
mattr_accessor :masquerading_resource_class_name
|
38
|
+
|
33
39
|
# Example: Devise.masquerading_resource_name = :admin_user
|
34
40
|
mattr_accessor :masquerading_resource_name
|
35
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_masquerade
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandr Korsak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|