authpds 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,13 +30,13 @@ module Authpds
30
30
  def current_primary_institution
31
31
  @current_primary_institution ||=
32
32
  (InstitutionList.institutions_defined?) ?
33
- (params["institution"].nil? or InstitutionList.instance.get(params["institution"]).nil?) ?
33
+ (params["#{institution_param_key}"].nil? or InstitutionList.instance.get(params["#{institution_param_key}"]).nil?) ?
34
34
  (primary_institution_from_ip.nil?) ?
35
35
  (current_user.nil? or current_user.primary_institution.nil?) ?
36
36
  InstitutionList.instance.default_institutions.first :
37
37
  current_user.primary_institution :
38
38
  primary_institution_from_ip :
39
- InstitutionList.instance.get(params["institution"]) :
39
+ InstitutionList.instance.get(params["#{institution_param_key}"]) :
40
40
  nil
41
41
  end
42
42
 
@@ -55,13 +55,19 @@ module Authpds
55
55
 
56
56
  # Override to add institution.
57
57
  def url_for(options={})
58
- options["institution"] = params["institution"] unless params["institution"].nil? or options["institution"]
58
+ options["#{institution_param_key}"] =
59
+ params["#{institution_param_key}"] unless params["#{institution_param_key}"].nil? or
60
+ options["#{institution_param_key}"]
59
61
  super(options)
60
62
  end
61
63
 
62
64
  def user_session_redirect_url(url)
63
65
  (url.nil?) ? (request.referer.nil?) ? root_url : request.referer : url
64
66
  end
67
+
68
+ def institution_param_key
69
+ @institution_param_key ||= UserSession.insitution_param
70
+ end
65
71
  end
66
72
  end
67
73
  end
@@ -137,6 +137,12 @@ module Authpds
137
137
  rw_config(:pds_record_primary_institution, value, :institute)
138
138
  end
139
139
  alias_method :pds_record_primary_institution=, :pds_record_primary_institution
140
+
141
+ # Querystring parameter key for the institution value
142
+ def institution_param_key(value = nil)
143
+ rw_config(:institution_param_key, value, "institute")
144
+ end
145
+ alias_method :institution_param_key=, :institution_param_key
140
146
  end
141
147
 
142
148
  module AuthpdsCallbackMethods
@@ -1,3 +1,3 @@
1
1
  module Authpds
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-02 00:00:00.000000000 Z
12
+ date: 2012-03-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2151877340 !ruby/object:Gem::Requirement
16
+ requirement: &2151878000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.2.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151877340
24
+ version_requirements: *2151878000
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: authlogic
27
- requirement: &2151876140 !ruby/object:Gem::Requirement
27
+ requirement: &2151876580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2151876140
35
+ version_requirements: *2151876580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &2151870360 !ruby/object:Gem::Requirement
38
+ requirement: &2151871400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2151870360
46
+ version_requirements: *2151871400
47
47
  description: Libraries that use Ex Libris products, can integrate Rails application
48
48
  with PDS to provide single sign-on across systems.
49
49
  email: