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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 765e1b2a1c4a2ae6f4708ad80b7f69745093be77070aaffb0415a71e870d3d3e
4
- data.tar.gz: ccfd44dc5346385d69a5b0bd6ef69f7504cb36e4d092568744b3e3bbbda34a07
3
+ metadata.gz: 02fcf52821938df133246e4b36ed07ee85ab96c036cd8da0cf35ace09c229491
4
+ data.tar.gz: 3247bf4be6fe21dc5ba5c83d804dab155d92286ef8c8c1625e92b181cb0c01dc
5
5
  SHA512:
6
- metadata.gz: 02f79998f7f9364a32628b3fa246e1e82b0b7a6007bfa344861ee5cf6fb168166cb73350733e554017922bd889709dcf29d374a08cf39cb191d68ca4e2fea811
7
- data.tar.gz: 0b814c4cef685103f3a846dbdc2ee62f4b070b9be2c20e913eb63605e518e125d8aae6933c1006437a3b7fdfc5e5677820b4640c50d204e66174c6c4b1687800
6
+ metadata.gz: b6f6902ea81dd6d5ffef2cd48cfa7e5b4521906f912a02b3986117ef933ebea89d7b63f2d5eb43372c1ad76a84d63ae433f236394bd1c16e83891efcaa300760
7
+ data.tar.gz: 40b48f52e4a162e2033c13ccc6a9fabf2b882dcfd64ad236a27f08e20f54862fd3139d07cb8a0c780d50d3f3c6cc06f9e1e9ffaf2dd16ffd3e42a7a67930f144
data/Gemfile.lock CHANGED
@@ -52,7 +52,7 @@ GIT
52
52
  PATH
53
53
  remote: .
54
54
  specs:
55
- devise_masquerade (1.3.10)
55
+ devise_masquerade (1.3.11)
56
56
  devise (>= 4.7.0)
57
57
  globalid (>= 0.3.6)
58
58
  railties (>= 5.2.0)
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.masqueraded_resource_class || resource_class
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.masquerading_resource_class || resource_class
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.masqueraded_resource_class
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
@@ -1,3 +1,3 @@
1
1
  module DeviseMasquerade
2
- VERSION = '1.3.10'.freeze
2
+ VERSION = '1.3.11'.freeze
3
3
  end
@@ -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.10
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-22 00:00:00.000000000 Z
11
+ date: 2022-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler