devise_masquerade 2.0.3 → 2.1.2

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: 4c0668fdf45d72f5919bd9ca487fe2b664948fc9399029832cc426500c030daa
4
- data.tar.gz: f61869c2877366a03922b6f0a8aecce6d9adea6a48f1f006a6311d97a2b83d2a
3
+ metadata.gz: b0e13952e75ddf9b6008616eccb45a46e841e9b02bb0d15855557aedab811054
4
+ data.tar.gz: 68197e8c30372ac89d5fd3cd7f40c1af95108fe3fa50fd5e331f499517434550
5
5
  SHA512:
6
- metadata.gz: d98eefe89ce90e177bffdf7d81bdcb7904351d4a8e2de9b519c91e9a81b998398339bdfbbf922146c177b739f22a140b450b5cda5afa4f578d254e02f443f0f7
7
- data.tar.gz: f2120c2b253f5f306589abd2b259607e3959e6910e7a8d5cf9661198a5b36a7d0372391995ef8b633a50cc6109e90f500a4dac3603950000eff1419b509cd9ac
6
+ metadata.gz: a9fb11b5a260ea9cd3091f48237beb82de6875ed27b9230b4656b1674670fe5e239467b8c0ac9bf9a085c9dcdad5816e0016f2866fcb00abe6f7bddf59899078
7
+ data.tar.gz: b08f92f89b5100cfa472f26ea7b5e26e09931551ab25b2f32fd839eba0520ce053a5fa27fafaf7c314a4a0eab91bbb3edfed192d8c95168382564aa05cf07513
@@ -17,7 +17,7 @@ jobs:
17
17
  - name: Set up Ruby
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 2.6
20
+ ruby-version: 2.7
21
21
 
22
22
  # This step is not necessary if you add the gem to your Gemfile
23
23
  - name: Install Code Scanning integration
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.6.0
4
- - 2.7.3
3
+ - 2.7.7
4
+ - 3.0.4
5
5
  script: time ./script/travis.sh
6
6
  addons:
7
7
  apt:
data/Gemfile.lock CHANGED
@@ -52,7 +52,7 @@ GIT
52
52
  PATH
53
53
  remote: .
54
54
  specs:
55
- devise_masquerade (2.0.3)
55
+ devise_masquerade (2.1.2)
56
56
  devise (>= 4.7.0)
57
57
  globalid (>= 0.3.6)
58
58
  railties (>= 5.2.0)
@@ -118,7 +118,7 @@ GEM
118
118
  archive-zip (~> 0.10)
119
119
  nokogiri (~> 1.8)
120
120
  coderay (1.1.3)
121
- concurrent-ruby (1.1.5)
121
+ concurrent-ruby (1.1.10)
122
122
  crass (1.0.6)
123
123
  cucumber (3.2.0)
124
124
  builder (>= 2.1.2)
@@ -156,11 +156,11 @@ GEM
156
156
  factory_bot_rails (5.1.1)
157
157
  factory_bot (~> 5.1.0)
158
158
  railties (>= 4.2.0)
159
- ffi (1.11.1)
159
+ ffi (1.15.5)
160
160
  formatador (0.2.5)
161
161
  gherkin (5.1.0)
162
- globalid (0.4.2)
163
- activesupport (>= 4.2.0)
162
+ globalid (1.0.1)
163
+ activesupport (>= 5.0)
164
164
  guard (2.17.0)
165
165
  formatador (>= 0.2.4)
166
166
  listen (>= 2.7, < 4.0)
@@ -183,7 +183,7 @@ GEM
183
183
  guard (~> 2.1)
184
184
  guard-compat (~> 1.1)
185
185
  rspec (>= 2.99.0, < 4.0)
186
- i18n (1.7.0)
186
+ i18n (1.12.0)
187
187
  concurrent-ruby (~> 1.0)
188
188
  io-like (0.3.1)
189
189
  launchy (2.4.3)
@@ -191,7 +191,7 @@ GEM
191
191
  listen (3.7.1)
192
192
  rb-fsevent (~> 0.10, >= 0.10.3)
193
193
  rb-inotify (~> 0.9, >= 0.9.10)
194
- loofah (2.18.0)
194
+ loofah (2.19.1)
195
195
  crass (~> 1.0.2)
196
196
  nokogiri (>= 1.5.9)
197
197
  lumberjack (1.0.13)
@@ -204,11 +204,11 @@ GEM
204
204
  mime-types-data (3.2019.1009)
205
205
  mini_mime (1.0.2)
206
206
  mini_portile2 (2.8.0)
207
- minitest (5.16.3)
207
+ minitest (5.17.0)
208
208
  multi_json (1.14.1)
209
209
  multi_test (0.1.2)
210
210
  nenv (0.3.0)
211
- nokogiri (1.13.9)
211
+ nokogiri (1.13.10)
212
212
  mini_portile2 (~> 2.8.0)
213
213
  racc (~> 1.4)
214
214
  notiffany (0.1.3)
@@ -223,15 +223,15 @@ GEM
223
223
  byebug (~> 11.0)
224
224
  pry (~> 0.10)
225
225
  public_suffix (4.0.6)
226
- racc (1.6.0)
227
- rack (2.2.3.1)
226
+ racc (1.6.1)
227
+ rack (2.2.6.2)
228
228
  rack-test (2.0.2)
229
229
  rack (>= 1.3)
230
230
  rails-dom-testing (2.0.3)
231
231
  activesupport (>= 4.2.0)
232
232
  nokogiri (>= 1.6)
233
- rails-html-sanitizer (1.4.3)
234
- loofah (~> 2.3)
233
+ rails-html-sanitizer (1.4.4)
234
+ loofah (~> 2.19, >= 2.19.1)
235
235
  railties (6.0.0)
236
236
  actionpack (= 6.0.0)
237
237
  activesupport (= 6.0.0)
@@ -243,9 +243,9 @@ GEM
243
243
  rb-inotify (0.10.0)
244
244
  ffi (~> 1.0)
245
245
  regexp_parser (2.6.0)
246
- responders (3.0.1)
247
- actionpack (>= 5.0)
248
- railties (>= 5.0)
246
+ responders (3.1.0)
247
+ actionpack (>= 5.2)
248
+ railties (>= 5.2)
249
249
  rubyzip (2.0.0)
250
250
  selenium-webdriver (3.142.6)
251
251
  childprocess (>= 0.5, < 4.0)
@@ -269,7 +269,7 @@ GEM
269
269
  rack (>= 2.0.9)
270
270
  xpath (3.2.0)
271
271
  nokogiri (~> 1.8)
272
- zeitwerk (2.6.1)
272
+ zeitwerk (2.6.6)
273
273
 
274
274
  PLATFORMS
275
275
  ruby
data/README.md CHANGED
@@ -145,7 +145,7 @@ For example, if you use FriendlyId:
145
145
  class Admin::MasqueradesController < Devise::MasqueradesController
146
146
  protected
147
147
 
148
- def find_resource
148
+ def find_masqueradable_resource
149
149
  masqueraded_resource_class.friendly.find(params[:id])
150
150
  end
151
151
  end
@@ -148,7 +148,7 @@ class Devise::MasqueradesController < DeviseController
148
148
  resource_obj = send("current_#{masquerading_resource_name}")
149
149
 
150
150
  if Devise.masquerade_storage_method_session?
151
- session[skey] = resource_obj.to_param
151
+ session[skey] = resource_obj.id
152
152
  else
153
153
  # skip sharing owner id via session
154
154
  Rails.cache.write(skey, resource_obj.to_sgid(for: 'masquerade'))
@@ -172,7 +172,7 @@ class Devise::MasqueradesController < DeviseController
172
172
  end
173
173
 
174
174
  def session_key(masqueradable_resource, guid)
175
- "devise_masquerade_#{masqueraded_resource_name}_#{masqueradable_resource.to_param}_#{guid}".to_sym
175
+ "devise_masquerade_#{masqueraded_resource_name}_#{masqueradable_resource.id}_#{guid}".to_sym
176
176
  end
177
177
 
178
178
  def masquerading_current_user
@@ -67,7 +67,7 @@ module DeviseMasquerade
67
67
  private
68
68
 
69
69
  def #{name}_helper_session_key
70
- ["devise_masquerade_#{name}", current_#{name}.to_param, #{name}_helper_masquerading_resource_guid].join("_")
70
+ ["devise_masquerade_#{name}", current_#{name}.id, #{name}_helper_masquerading_resource_guid].join("_")
71
71
  end
72
72
 
73
73
  def #{name}_helper_masquerading_resource_guid
@@ -92,7 +92,7 @@ module DeviseMasquerade
92
92
  params[:masqueraded_resource_class].constantize
93
93
  else
94
94
  unless session[session_key_masqueraded_resource_class].blank?
95
- session[session_key_masquerading_resource_class].constantize
95
+ session[session_key_masqueraded_resource_class].constantize
96
96
  else
97
97
  if Devise.masqueraded_resource_class_name.present?
98
98
  Devise.masqueraded_resource_class_name.constantize
@@ -1,3 +1,3 @@
1
1
  module DeviseMasquerade
2
- VERSION = '2.0.3'.freeze
2
+ VERSION = '2.1.2'.freeze
3
3
  end
@@ -14,7 +14,7 @@ describe Devise::MasqueradesController, type: :controller do
14
14
  let(:mask) { create(:student) }
15
15
 
16
16
  before do
17
- get :show, params: { id: mask.to_param, masqueraded_resource_class: mask.class.name, masquerade: mask.masquerade_key }
17
+ get :show, params: { id: mask.id, masqueraded_resource_class: mask.class.name, masquerade: mask.masquerade_key }
18
18
  end
19
19
 
20
20
  it { expect(cache_read(mask)).to be }
@@ -33,7 +33,7 @@ describe Devise::MasqueradesController, type: :controller do
33
33
  let(:mask) { create(:user) }
34
34
 
35
35
  before do
36
- get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key }
36
+ get :show, params: { id: mask.id, masquerade: mask.masquerade_key }
37
37
  end
38
38
 
39
39
  it { expect(cache_read(mask)).to be }
@@ -61,7 +61,7 @@ describe Devise::MasqueradesController, type: :controller do
61
61
  context 'with http referrer' do
62
62
  before do
63
63
  @request.env['HTTP_REFERER'] = 'previous_location'
64
- get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key }
64
+ get :show, params: { id: mask.id, masquerade: mask.masquerade_key }
65
65
  end # before
66
66
 
67
67
  it { should redirect_to('previous_location') }
@@ -73,7 +73,7 @@ describe Devise::MasqueradesController, type: :controller do
73
73
  receive(:after_masquerade_path_for).and_return("/dashboard?color=red"))
74
74
  end
75
75
 
76
- before { get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key } }
76
+ before { get :show, params: { id: mask.id, masquerade: mask.masquerade_key } }
77
77
 
78
78
  it { should redirect_to("/dashboard?color=red") }
79
79
  end # context
@@ -81,7 +81,7 @@ describe Devise::MasqueradesController, type: :controller do
81
81
 
82
82
  context 'and back' do
83
83
  before do
84
- get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key }
84
+ get :show, params: { id: mask.id, masquerade: mask.masquerade_key }
85
85
 
86
86
  get :back
87
87
  end
@@ -91,7 +91,7 @@ describe Devise::MasqueradesController, type: :controller do
91
91
 
92
92
  context 'and back fallback if http_referer not present' do
93
93
  before do
94
- get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key }
94
+ get :show, params: { id: mask.id, masquerade: mask.masquerade_key }
95
95
 
96
96
  @request.env['HTTP_REFERER'] = 'previous_location'
97
97
  get :back
@@ -123,6 +123,6 @@ describe Devise::MasqueradesController, type: :controller do
123
123
  end
124
124
 
125
125
  def cache_key(user)
126
- "devise_masquerade_#{mask.class.name.downcase}_#{mask.to_param}_#{guid}"
126
+ "devise_masquerade_#{mask.class.name.downcase}_#{mask.id}_#{guid}"
127
127
  end
128
128
  end
@@ -16,7 +16,7 @@ describe MasqueradesTestsController, type: :controller do
16
16
 
17
17
  let(:mask) { create(:user) }
18
18
 
19
- before { get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key } }
19
+ before { get :show, params: { id: mask.id, masquerade: mask.masquerade_key } }
20
20
 
21
21
  it { expect(response.status).to eq(403) }
22
22
  it { expect(cache_read(mask)).not_to be }
@@ -34,7 +34,7 @@ describe MasqueradesTestsController, type: :controller do
34
34
  let(:mask) { create(:user) }
35
35
 
36
36
  before do
37
- get :show, params: { id: mask.to_param, masquerade: mask.masquerade_key }
37
+ get :show, params: { id: mask.id, masquerade: mask.masquerade_key }
38
38
  end
39
39
 
40
40
  it { expect(response.status).to eq(302) }
@@ -52,6 +52,6 @@ describe MasqueradesTestsController, type: :controller do
52
52
  end
53
53
 
54
54
  def cache_key(user)
55
- "devise_masquerade_#{mask.class.name.downcase}_#{mask.to_param}_#{guid}"
55
+ "devise_masquerade_#{mask.class.name.downcase}_#{mask.id}_#{guid}"
56
56
  end
57
57
  end
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: 2.0.3
4
+ version: 2.1.2
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-11-01 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler