switch_user 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -4
- data/README.md +1 -1
- data/lib/switch_user/provider.rb +9 -2
- data/lib/switch_user/provider/devise.rb +5 -1
- data/lib/switch_user/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06adf7119a277108834d59b13db51a1db026d52b
|
4
|
+
data.tar.gz: 993205a4f732d652bf60d4f083d2d9f0ed54b73a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a190126c3a2323ff087712933e3ace25110c624435897c6df8c803959fbd288ac19130c32c90fff7215e38708730de2fa4d8568aced23d756da1b36bdfe975d5
|
7
|
+
data.tar.gz: 91ab7a7bba1f5535f913e230d8f42a47a9eb84b2575843e91d95ff372631dd3d5cbb1d2e05c91538faa79644f7ac22dc14e810fcc6179adfdc725f1446a77f8f
|
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# Next Release
|
2
2
|
|
3
|
-
## 1.
|
3
|
+
## 1.4.0 (10/21/2016)
|
4
4
|
|
5
|
+
* Add ability to `store_sign_in` info with devise provider
|
5
6
|
* Respect `relative_url_root`
|
6
7
|
* Fix `selected_user_of_helper` bug
|
7
8
|
|
@@ -9,9 +10,6 @@
|
|
9
10
|
|
10
11
|
* Add capybara support
|
11
12
|
* Add class and style options to `switch_user_select`
|
12
|
-
|
13
|
-
## 1.2.1 (12/22/2015)
|
14
|
-
|
15
13
|
* Fix `grouped_options_for_select` for rails 3.2
|
16
14
|
|
17
15
|
## 1.2.0 (12/01/2015)
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ get ':id' => 'pages#show'
|
|
63
63
|
By default, you can switch between Guest and all users in users table, you don't need to do anything. The following is some of the more commonly used configuration options.
|
64
64
|
```ruby
|
65
65
|
SwitchUser.setup do |config|
|
66
|
-
# provider may be :devise, :authlogic, :clearance, :restful_authentication or :
|
66
|
+
# provider may be :devise, :authlogic, :clearance, :restful_authentication, :sorcery, or {name: :devise, store_sign_in: true}
|
67
67
|
config.provider = :devise
|
68
68
|
|
69
69
|
# available_users is a hash,
|
data/lib/switch_user/provider.rb
CHANGED
@@ -10,8 +10,15 @@ module SwitchUser
|
|
10
10
|
autoload :Session, "switch_user/provider/session"
|
11
11
|
|
12
12
|
def self.init(controller)
|
13
|
-
|
14
|
-
|
13
|
+
if SwitchUser.provider.is_a?(Hash)
|
14
|
+
klass_part = SwitchUser.provider[:name]
|
15
|
+
else
|
16
|
+
klass_part = SwitchUser.provider
|
17
|
+
end
|
18
|
+
|
19
|
+
klass_part = klass_part.to_s.classify
|
20
|
+
|
21
|
+
klass = "SwitchUser::Provider::#{klass_part}".constantize
|
15
22
|
|
16
23
|
klass.new(controller)
|
17
24
|
end
|
@@ -7,7 +7,11 @@ module SwitchUser
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def login(user, scope = :user)
|
10
|
-
|
10
|
+
if SwitchUser.provider.is_a?(Hash) && SwitchUser.provider[:store_sign_in]
|
11
|
+
@warden.set_user(user, scope: scope)
|
12
|
+
else
|
13
|
+
@warden.session_serializer.store(user, scope)
|
14
|
+
end
|
11
15
|
end
|
12
16
|
|
13
17
|
def logout(scope = :user)
|
data/lib/switch_user/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: switch_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|