registrar-rails 0.0.13.alpha → 0.1.0.alpha

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: bfda5870a7c1a99c12972c5aa75a246ae111a3b4
4
- data.tar.gz: 3375d6685f8d21aaa9eceb5b68b38131e9b5dedb
3
+ metadata.gz: 2f36923d9b6c4c211f9793f90b9d0f96c85c6911
4
+ data.tar.gz: d8cdd0cfb9c99d4094adf1b1b5fb36982a706145
5
5
  SHA512:
6
- metadata.gz: 998857c562890df19911e071b25599d153fb64689b46599dc4c145f65c73fe6bea7a5f7198778fa1b3f00176230a7cc0e5bfe93cd4d1e2b9e082ced66e095d7e
7
- data.tar.gz: 2c59d47e9d3c7a259a86d949c052f58119402310c83664ed5d1c2309c714c8cc052673ccf8f6487cc9e1201b938485d36aa19f35af37303450ba6a32864a3a82
6
+ metadata.gz: fc76cc7d8000abca939d10f814777e42f8a202f8a2c0221ddba802ee2248039a6e72df122cfcd3aeabe6e9ef55aaa6f26a3c78c61eff0a94d9f9c79221071714
7
+ data.tar.gz: b5719556812ca6c090dc9fbc75d41736ea6872951d5b7524644d72573513d9f0a9de04001d3ce7d820e8186e19c1cde96ed591ea2a3a3dcab22665993982d7fb
@@ -7,7 +7,6 @@ module Registrar
7
7
 
8
8
  klass.class_eval do
9
9
  helper_method :current_profile
10
- helper_method :reload_current_profile
11
10
  helper_method :current_profile?
12
11
  helper_method :logout
13
12
  end
@@ -23,40 +22,20 @@ module Registrar
23
22
  end
24
23
  end
25
24
 
26
- def store_current_profile_uid(registrar_profile)
27
- session[CURRENT_PROFILE_UID] = registrar_profile.uid
28
- end
29
-
30
- def current_profile_uid
31
- session[CURRENT_PROFILE_UID]
32
- end
33
-
34
25
  def logout
35
26
  session[CURRENT_PROFILE_UID] = nil
36
27
  end
37
28
 
38
- def reload_current_profile
39
- end
40
-
41
29
  def current_profile
42
- return @current_user if @current_user
30
+ return @current_profile if @current_profile
43
31
 
44
- if current_profile_uid
45
- @current_user = Registrar::Middleware::config.handler.call(
32
+ if current_profile_uid_from_session
33
+ @current_profile = Registrar::Middleware::config.handler.call(
46
34
  build_current_profile
47
35
  )
48
36
  end
49
37
 
50
- @current_user
51
- end
52
-
53
- def build_current_profile
54
- {
55
- "provider" => {
56
- "name" => "session",
57
- "uid" => current_profile_uid
58
- }
59
- }
38
+ @current_profile
60
39
  end
61
40
 
62
41
  def current_profile?
@@ -66,6 +45,25 @@ module Registrar
66
45
  def authentication_phase?
67
46
  params[:controller] == 'authentication' && params[:action] = 'callback'
68
47
  end
48
+
49
+ private
50
+
51
+ def store_current_profile_uid(registrar_profile)
52
+ session[CURRENT_PROFILE_UID] = registrar_profile.uid
53
+ end
54
+
55
+ def current_profile_uid_from_session
56
+ session[CURRENT_PROFILE_UID]
57
+ end
58
+
59
+ def build_current_profile
60
+ {
61
+ "provider" => {
62
+ "name" => "session",
63
+ "uid" => current_profile_uid_from_session
64
+ }
65
+ }
66
+ end
69
67
  end
70
68
  end
71
69
  end
@@ -1,5 +1,5 @@
1
1
  module Registrar
2
2
  module Rails
3
- VERSION = "0.0.13.alpha"
3
+ VERSION = "0.1.0.alpha"
4
4
  end
5
5
  end
@@ -878,3 +878,21 @@ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliab
878
878
  Started GET "/" for 127.0.0.1 at 2015-06-02 11:19:44 +0200
879
879
  Processing by SomeController#index as HTML
880
880
  Completed 200 OK in 14ms (Views: 0.2ms)
881
+ ----------------------------------------------------------------------------------
882
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
883
+ ----------------------------------------------------------------------------------
884
+ Started GET "/" for 127.0.0.1 at 2015-06-02 17:21:48 +0200
885
+ Processing by SomeController#index as HTML
886
+ Completed 500 Internal Server Error in 17ms
887
+ ----------------------------------------------------------------------------------
888
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
889
+ ----------------------------------------------------------------------------------
890
+ Started GET "/" for 127.0.0.1 at 2015-06-02 17:22:04 +0200
891
+ Processing by SomeController#index as HTML
892
+ Completed 200 OK in 14ms (Views: 0.1ms)
893
+ ----------------------------------------------------------------------------------
894
+ CurrentProfileTest: test_exposes_current_profile_if_registrar.profile_is_avaliable
895
+ ----------------------------------------------------------------------------------
896
+ Started GET "/" for 127.0.0.1 at 2015-06-02 17:24:43 +0200
897
+ Processing by SomeController#index as HTML
898
+ Completed 200 OK in 14ms (Views: 0.2ms)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: registrar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13.alpha
4
+ version: 0.1.0.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Owiesniak