authpds 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,12 @@ module Authpds
28
28
  all_institutions[institution_param]
29
29
  end
30
30
 
31
+ # Override Rails ActionController#url_for to add institution.
32
+ def url_for(options={})
33
+ options[institution_param_key] ||= institution_param unless institution_param.nil?
34
+ super options
35
+ end
36
+
31
37
  # Grab the first institution that matches the client IP
32
38
  def primary_institution_from_ip
33
39
  Institutions.with_ip(request.remote_ip).first unless request.nil?
@@ -2,12 +2,6 @@ module Authpds
2
2
  module Controllers
3
3
  module AuthpdsController
4
4
  module UrlHandling
5
- # Override Rails ActionController#url_for to add institution.
6
- def url_for(options={})
7
- options[institution_param_key] ||= institution_param unless institution_param.nil?
8
- super options
9
- end
10
-
11
5
  # Controller method to generate the Appropriate redirect url
12
6
  def user_session_redirect_url(url)
13
7
  (url.nil? or url.empty?) ? (request.referer.nil?) ? root_url : request.referer : url
@@ -48,8 +48,10 @@ module Authpds
48
48
  include Authpds::Session::Callbacks
49
49
  include Authpds::Session::ExceptionHandling
50
50
  include Authpds::Session::InstitutionAttributes
51
+ include Authpds::Session::PdsHandle
51
52
  include Authpds::Session::PdsUser
52
53
  include Authpds::Session::Record
54
+ include Authpds::Session::SessionId
53
55
  include Authpds::Session::UrlHandling
54
56
 
55
57
  def self.included(klass)
@@ -29,17 +29,6 @@ module Authpds
29
29
  def validate_url_name
30
30
  @validate_url_name ||= self.class.validate_url_name
31
31
  end
32
-
33
- def pds_handle
34
- @pds_handle ||= (controller.cookies[:PDS_HANDLE] || controller.params[:pds_handle])
35
- end
36
-
37
- def session_id
38
- @session_id ||=
39
- (controller.session.respond_to?(:session_id)) ?
40
- (controller.session.session_id) ?
41
- controller.session.session_id : controller.session[:session_id] : controller.session[:session_id]
42
- end
43
32
  end
44
33
  end
45
34
  end
@@ -0,0 +1,9 @@
1
+ module Authpds
2
+ module Session
3
+ module PdsHandle
4
+ def pds_handle
5
+ @pds_handle ||= (controller.cookies[:PDS_HANDLE] || controller.params[:pds_handle])
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module Authpds
2
+ module Session
3
+ module SessionId
4
+ def session_id
5
+ @session_id ||=
6
+ (controller.session.respond_to?(:session_id)) ?
7
+ (controller.session.session_id) ?
8
+ controller.session.session_id : controller.session[:session_id] : controller.session[:session_id]
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Authpds
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/test/user_test.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'test_helper'
2
- class UserSessionTest < ActiveSupport::TestCase
2
+ class UserTest < ActiveSupport::TestCase
3
3
  def setup
4
4
  activate_authlogic
5
5
  controller.session[:session_id] = "FakeSessionID"
@@ -47,7 +47,7 @@ class UserSessionTest < ActiveSupport::TestCase
47
47
 
48
48
  test "primary_institution no institutions" do
49
49
  user = User.new
50
- assert_nothing_raised ArgumentError do
50
+ assert_nothing_raised do
51
51
  user.primary_institution= "NYU"
52
52
  end
53
53
  assert_equal(nil, user.primary_institution)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-12 00:00:00.000000000 Z
12
+ date: 2012-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: require_all
@@ -80,17 +80,17 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 0.0.3
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 0.0.3
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rake
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ~>
132
132
  - !ruby/object:Gem::Version
133
- version: 1.9.0
133
+ version: 1.8.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +138,7 @@ dependencies:
138
138
  requirements:
139
139
  - - ~>
140
140
  - !ruby/object:Gem::Version
141
- version: 1.9.0
141
+ version: 1.8.0
142
142
  description: Libraries that use Ex Libris products, can integrate Rails application
143
143
  with PDS to provide single sign-on across systems.
144
144
  email:
@@ -165,8 +165,10 @@ files:
165
165
  - lib/authpds/session/core_attributes.rb
166
166
  - lib/authpds/session/exception_handling.rb
167
167
  - lib/authpds/session/institution_attributes.rb
168
+ - lib/authpds/session/pds_handle.rb
168
169
  - lib/authpds/session/pds_user.rb
169
170
  - lib/authpds/session/record.rb
171
+ - lib/authpds/session/session_id.rb
170
172
  - lib/authpds/session/url_handling.rb
171
173
  - lib/authpds/session.rb
172
174
  - lib/authpds/version.rb
@@ -209,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
211
  version: '0'
210
212
  segments:
211
213
  - 0
212
- hash: -1210947203680701813
214
+ hash: -4197567884040698077
213
215
  required_rubygems_version: !ruby/object:Gem::Requirement
214
216
  none: false
215
217
  requirements:
@@ -218,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
220
  version: '0'
219
221
  segments:
220
222
  - 0
221
- hash: -1210947203680701813
223
+ hash: -4197567884040698077
222
224
  requirements: []
223
225
  rubyforge_project:
224
226
  rubygems_version: 1.8.24