devise_masquerade 2.0.0 → 2.0.1

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: 99dc9de6d6af53393db0f0f0a8c8b80191bf203bad2ba604eb50dce7708aa314
4
- data.tar.gz: a8a89851d08443baaf4e7106bec7267d7a0c8209f01da40431874672ff56d1c9
3
+ metadata.gz: 0e7178dc0f54d070a2f4e839f320f65c5506b215a902cc2180b8e357d1a9f62d
4
+ data.tar.gz: 5466190dbaae779ca45abaa8e65f526e1b99805a493019c8dc67572d387b8022
5
5
  SHA512:
6
- metadata.gz: 13133209d039b4f64ff124fc88935198e4cde0ee181abd6ce973b9d31f2618d6ed2512a27adf9c3f5d32be4fff16084f15135a6f95b97ff96b0a430ba4f9819a
7
- data.tar.gz: 0b4455f0adfd73ea7a49794349d686010c47157e4e30a836ea9a811f05005f8533af55a1945401f2595845ccd82cc2a84f4b6aa392ef0dcc3bea5b423f9ef35a
6
+ metadata.gz: f2b85a5241c5aef644ca6139f89807631b6e93ebcbc2fc77f0b88f74e43bd411a056bb49c3340ae63322e22cf13a5ca4185208d7c8c778e124d04fa37bb19cbd
7
+ data.tar.gz: 374dacc212988505fca5cfea9188a7fcdce44d174b54b3cd980363b37c377bb92713ab8467858eefa62d23568783e09929bcdace08efa344bf5610f382e32f31
data/Gemfile.lock CHANGED
@@ -52,7 +52,7 @@ GIT
52
52
  PATH
53
53
  remote: .
54
54
  specs:
55
- devise_masquerade (2.0.0)
55
+ devise_masquerade (2.0.1)
56
56
  devise (>= 4.7.0)
57
57
  globalid (>= 0.3.6)
58
58
  railties (>= 5.2.0)
@@ -77,13 +77,15 @@ class Devise::MasqueradesController < DeviseController
77
77
  def find_owner_resource(masqueradable_resource)
78
78
  skey = session_key(masqueradable_resource, masquerading_guid)
79
79
 
80
- data = if Devise.masquerade_storage_method_session?
81
- session[skey]
80
+ if Devise.masquerade_storage_method_session?
81
+ resource_id = session[skey]
82
+
83
+ masqueraded_resource_class.find(resource_id)
82
84
  else
83
- Rails.cache.read(skey)
84
- end
85
+ data = Rails.cache.read(skey)
85
86
 
86
- GlobalID::Locator.locate_signed(data, for: 'masquerade')
87
+ GlobalID::Locator.locate_signed(data, for: 'masquerade')
88
+ end
87
89
  end
88
90
 
89
91
  def go_back(user, path:)
@@ -161,13 +163,13 @@ class Devise::MasqueradesController < DeviseController
161
163
 
162
164
  skey = session_key(masqueradable_resource, guid)
163
165
 
164
- resource_gid = send("current_#{masquerading_resource_name}").to_sgid(for: 'masquerade')
166
+ resource_obj = send("current_#{masquerading_resource_name}")
165
167
 
166
168
  if Devise.masquerade_storage_method_session?
167
- session[skey] = resource_gid
169
+ session[skey] = resource_obj.to_param
168
170
  else
169
171
  # skip sharing owner id via session
170
- Rails.cache.write(skey, resource_gid)
172
+ Rails.cache.write(skey, resource_obj.to_sgid(for: 'masquerade'))
171
173
 
172
174
  session[skey] = true
173
175
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseMasquerade
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  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.0
4
+ version: 2.0.1
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-10-10 00:00:00.000000000 Z
11
+ date: 2022-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler