switch_user 1.3.1 → 1.4.0

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
  SHA1:
3
- metadata.gz: f5884c55c483cc8783d01b9826a61036e4c8c0f8
4
- data.tar.gz: c427f1b701df9bf6689f75ec46c12422421bd494
3
+ metadata.gz: 06adf7119a277108834d59b13db51a1db026d52b
4
+ data.tar.gz: 993205a4f732d652bf60d4f083d2d9f0ed54b73a
5
5
  SHA512:
6
- metadata.gz: dce7ff61f4148662b60ef5e7763bb46c31f4250de7ff986679a4a96554744be4b9d57dcfd63c9c102cb0485bb043c73a3a0d885b17503eae19f3e4da6e9e623e
7
- data.tar.gz: c03171c6b23c247638253224d5fc9a2016abb8a90bbc409f4e3492284d1e2857c29bb6830b3818768bd939b6988e846202f2ad485b4334cbd5eb93cc1fc719d9
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
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 :sorcery
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,
@@ -10,8 +10,15 @@ module SwitchUser
10
10
  autoload :Session, "switch_user/provider/session"
11
11
 
12
12
  def self.init(controller)
13
- klass_part = SwitchUser.provider.to_s.classify
14
- klass = "SwitchUser::Provider::#{klass_part}".constantize
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
- @warden.session_serializer.store(user, scope)
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)
@@ -1,3 +1,3 @@
1
1
  module SwitchUser
2
- VERSION = "1.3.1"
2
+ VERSION = "1.4.0"
3
3
  end
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.3.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-08-21 00:00:00.000000000 Z
12
+ date: 2016-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport