authpds 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  class Institution < Struct.new(:display_name, :name, :default,
2
- :application_layout, :ip_addresses, :parent_institution, :view_attributes, :login_attributes)
2
+ :layouts, :ip_addresses, :parent_institution, :view_attributes, :login_attributes)
3
3
  require 'ipaddr'
4
4
 
5
5
  # Better initializer than Struct gives us, take a hash instead
@@ -23,7 +23,7 @@ class InstitutionList
23
23
 
24
24
  # Returns an array of Institutions
25
25
  def defaults
26
- return institutions.values.find_all {|institution| institution.default == true}
26
+ return institutions.values.find_all {|institution| institution.default === true}
27
27
  end
28
28
 
29
29
  # Returns an array of Institutions
@@ -46,19 +46,30 @@ class InstitutionList
46
46
  "The file #{@@institutions_yaml_path} does not exist. "+
47
47
  "In order to use the institution feature you must create the file."
48
48
  ) unless File.exists?(@@institutions_yaml_path)
49
- institution_list = YAML.load_file( @@institutions_yaml_path )
49
+ institutions_hash = YAML.load_file( @@institutions_yaml_path )
50
+ institutions_with_parents = {}
51
+ # Prepare institution definitions
52
+ institutions_hash.each do |name, definition|
53
+ definition["name"] = name
54
+ definition["default"] = false unless definition.key?("default")
55
+ institutions_with_parents[name] = definition if definition.key?("parent_institution")
56
+ end
57
+ # Handle inheritance for institutions
58
+ institutions_with_parents.each do |name, definition|
59
+ institutions_hash[name] = merge_with_parent(institutions_hash, definition)
60
+ end
61
+ # Turn the institution definitions to Institutions
50
62
  @institutions = {}
51
- # Turn the institution hashes to Institutions
52
- institution_list.each_pair do |institution_name, institution_hash|
53
- institution_hash["name"] = institution_name
54
- institution_hash["default"] = false if institution_hash["default"].nil?
55
- # Merge with parent institution
56
- institution_hash =
57
- institution_list[institution_hash["parent_institution"]].
58
- merge(institution_hash) unless institution_hash["parent_institution"].nil?
59
- @institutions[institution_name] = Institution.new(institution_hash)
63
+ institutions_hash.each do |name, definition|
64
+ @institutions[name] = Institution.new(definition)
60
65
  end
61
66
  end
62
67
  return @institutions
63
68
  end
69
+
70
+ private
71
+ def merge_with_parent(institutions, child)
72
+ parent = institutions[child["parent_institution"]]
73
+ return (parent["parent_institution"].nil?) ? parent.merge(child) : merge_with_parent(institutions, parent).merge(child)
74
+ end
64
75
  end
@@ -1,3 +1,3 @@
1
1
  module Authpds
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
@@ -0,0 +1,352 @@
1
+ # Configure what service plugins are used by Umlaut. This skeleton file
2
+ # has been generated into your app to help you get started.
3
+ #
4
+ # If a service has "disabled:true", it's currently turned off.
5
+ #
6
+ # Some services require local api key or connection details as config.
7
+ # Most services take other options for custom configuration too, not
8
+ # all options are neccesarily listed as examples here, see source
9
+ # or source-generated docs for more info.
10
+ default:
11
+ display_name: "NYU Libraries"
12
+ layouts:
13
+ resolve: layouts/nyu/resolve
14
+ search: layouts/nyu/search
15
+ login_attributes:
16
+ link_code: NYU
17
+ view_attributes:
18
+ tabs_partial: search/nyu/tabs
19
+ tip1_partial: search/nyu/tip1
20
+ tip2_partial: search/nyu/tip2
21
+ sfx_base_url: http://sfx.library.nyu.edu/sfxlcl41?
22
+ services:
23
+ # Priority 2
24
+ NYU_Primo:
25
+ type: PrimoService
26
+ priority: 2 # After SFX, to get SFX metadata enhancement
27
+ status: active
28
+ base_url: http://bobcatdev.library.nyu.edu
29
+ vid: NYU
30
+ institution: NYU
31
+ holding_search_institution: NYU
32
+ holding_search_text: Search for this title in BobCat.
33
+ suppress_holdings: [ !ruby/regexp '/\$\$LBWEB/', !ruby/regexp '/\$\$LNWEB/', !ruby/regexp '/\$\$LTWEB/', !ruby/regexp '/\$\$LWEB/', !ruby/regexp '/\$\$1Restricted Internet Resources/' ]
34
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.nyu\.edu\/login\?url=/'
35
+ service_types:
36
+ - primo_source
37
+ - holding_search
38
+ - fulltext
39
+ - table_of_contents
40
+ - referent_enhance
41
+ - cover_image
42
+ # Priority 3
43
+ # First half of Amazon, run in foreground, get metadata and cover images.
44
+ Amazon:
45
+ disabled: true
46
+ display_name: Amazon.com
47
+ type: Amazon
48
+ url: http://webservices.amazon.com/onca/xml
49
+ api_key: 1ZQ8VEWY2A7VSJ93CW82
50
+ secret_key: jZNsa8uaOxo2mj1TvHQVDs464TcPEvuidSF/xepO
51
+ associate_tag: nyli0a-20
52
+ priority: 3
53
+ service_types:
54
+ - referent_enhance
55
+ - cover_image
56
+ # Priority a: Background
57
+ NYU_Primo_Source:
58
+ type: PrimoSource
59
+ priority: a
60
+ status: active
61
+ base_url: http://bobcatdev.library.nyu.edu
62
+ vid: NYU
63
+ # Priority c: Background
64
+ # Second half of Amazon. It's Slow to lookup highlighted_link and search_inside
65
+ # availability, so we do it in a bg wave.
66
+ Amazon_bg:
67
+ type: Amazon
68
+ disabled: true
69
+ api_key: 1ZQ8VEWY2A7VSJ93CW82
70
+ secret_key: jZNsa8uaOxo2mj1TvHQVDs464TcPEvuidSF/xepO
71
+ associate_tag: nyli0a-20
72
+ priority: c
73
+ make_aws_call: false
74
+ service_types:
75
+ - abstract
76
+ - highlighted_link
77
+ - search_inside
78
+ - excerpts
79
+ CoverThing:
80
+ type: CoverThing
81
+ disabled: true
82
+ developer_key: 0db3ae0934bc35aed93ea676c883128c
83
+ priority: c
84
+ # Pre-empted by says if we already have a cover_image response
85
+ # from somewhere else that runs earlier, don't run this.
86
+ preempted_by:
87
+ existing_type: cover_image
88
+ ElsevierCover:
89
+ type: ElsevierCover
90
+ priority: c
91
+ UlrichsCover:
92
+ type: UlrichsCover
93
+ priority: c
94
+ GoogleBookSearch:
95
+ type: GoogleBookSearch
96
+ disabled: true
97
+ priority: c
98
+ api_key: AIzaSyADjP7PRPsGaPYJB9tvfm8ZSpdmhUsCR1w
99
+ Ulrichs:
100
+ display_name: "Ulrich's Directory"
101
+ type: UlrichsLink
102
+ priority: c
103
+ IsbnDb:
104
+ display_name: isbndb.com
105
+ disabled: true
106
+ type: IsbnDb
107
+ priority: c
108
+ access_key: 9FAOAU2Z
109
+ InternetArchive:
110
+ display_name: the Internet Archive
111
+ type: InternetArchive
112
+ priority: c
113
+ # disable audio results? uncomment:
114
+ #num_results_for_types:
115
+ # audio: 0
116
+ ScopusCitations:
117
+ type: Scopus
118
+ priority: c
119
+ json_api_key: yI7GR2aKR1n9ZvMd36rrd1zASdGJYJ
120
+ # partner_id: YOUR_SCOPUS_PARTNER_ID
121
+ # link_salt_key: "YOUR_SCOPUS_LINK_SALT_KEY"
122
+ # Web of Knowledge API has no api key, but your
123
+ # IP needs to be registered with them. See source docs
124
+ # for how.
125
+ IsiCitations:
126
+ type: Isi
127
+ priority: c
128
+ # Thomson JCR LAMR api has no api key, but your
129
+ # IP needs to be registered with them. Same registraiton
130
+ # as for ISI WoK generally.
131
+ Jcr:
132
+ type: Jcr
133
+ priority: c
134
+ # Priority d
135
+ HathiTrust:
136
+ type: HathiTrust
137
+ priority: d
138
+ # Uncomment to link through this 'internal' URL instead
139
+ # of following permalinks. jrochkind does this to use
140
+ # a WAYFless shibboleth login with EZProxy.
141
+ #direct_link_base: 'https://babel.hathitrust.org/shcgi/'
142
+ #
143
+ # This next says:
144
+ # Don't add HathiTrust fulltext if there's already a
145
+ # GoogleBookSearch fulltext. Still add other HT response
146
+ # types.
147
+ # preempted_by:
148
+ # self_type: fulltext
149
+ # existing_service: GoogleBookSearch
150
+ # existing_type: fulltext
151
+ EmailExport:
152
+ type: EmailExport
153
+ priority: d
154
+ TxtHoldingExport:
155
+ type: TxtHoldingExport
156
+ priority: d
157
+ # Worldcat scraper can be quite slow, move it to wave 'd' to avoid
158
+ # holding up wave 'c'
159
+ Worldcat:
160
+ display_name: OCLC Worldcat.org
161
+ type: Worldcat
162
+ priority: d
163
+ # suppress_precheck says don't actually screen-scrape to
164
+ # see if the link is good, just link blindly. Mostly works
165
+ # for WorldCat, avoids the performance hit.
166
+ suppress_precheck: true
167
+ WorldcatIdentities:
168
+ type: WorldcatIdentities
169
+ priority: d
170
+ # Turn off certain response types:
171
+ #note_types: false
172
+ #wikipedia_link: false
173
+ #openurl_widely_held: false
174
+ #require_identifier: true
175
+ # GPO is kind of experimental, it doesn't work great, but IF an
176
+ # OpenURL includes a sudoc call number or other GPO identifiers,
177
+ # will try to link to full text via GPO catalog scrape.
178
+ Gpo:
179
+ type: Gpo
180
+ disabled: true
181
+ priority: e
182
+ #preempted_by:
183
+ # - existing_type: fulltext
184
+ # - existing_type: fulltext_title_level
185
+ ####
186
+ # Link out filters: Effect what happens when a user clicks
187
+ # on an Umlaut link to a third party source. Link out filters
188
+ # can operate to change where link goes or execute side effects
189
+ # on click.
190
+ ####
191
+ # Redirect outgoing links through EZProxy
192
+ EZProxy:
193
+ type: Ezproxy
194
+ disabled: true
195
+ task: link_out_filter
196
+ proxy_server: HOSTNAME_OF_YOUR_EZPROXY
197
+ # By default, will pre-check with EZProxy api and
198
+ # only send links through EZProxy that are proxyable.
199
+ # requires proxy_password to be set.
200
+ # optionally, set precheck_with_api false, and the EZProxy
201
+ # api won't be used, ALL links go through EZProxy. You may
202
+ # have EZProxy itself set to transparently redirect non-proxyable
203
+ # URLs back to non-proxied version.
204
+ #
205
+ #precheck_with_api: false
206
+ priority: 5
207
+ proxy_password: YOUR_EZPROXY_API_PWD
208
+ # Want to exclude certain hostnames from being directed through EZProxy?
209
+ # list them in array here:
210
+ #exclude: [ host.unversity.edu, otherhost.somewhere.com]
211
+ # Use of SFX api means that SFX can no longer keep statistics on
212
+ # clickthroughs. This link out filter will attempt to fake SFX into
213
+ # thinking a direct click happened when user clicks on an SFX link
214
+ # via Umlaut. This is VERY fragile logic, required reverse engineering
215
+ # SFX and faking it out, still doesn't work all the time. But works
216
+ # much of the time.
217
+ SFX_backchannel_record:
218
+ disabled: true
219
+ type: SfxBackchannelRecord
220
+ priority: 6
221
+
222
+ NYU:
223
+ parent_institution: default
224
+ ip_addresses:
225
+ - '128.122.0.0-128.122.149.239'
226
+ - '172.26.*.*'
227
+ - '172.27.*.*'
228
+ - '172.22.88.*'
229
+ - '216.165.*.*'
230
+ - '128.238.*.*'
231
+ services:
232
+ NYU_SFX:
233
+ name: Get It @ NYU
234
+ display_name: Get It @ NYU
235
+ type: Sfx
236
+ base_url: http://sfx.library.nyu.edu/sfxlcl41
237
+ priority: 1
238
+ status: active
239
+ click_passthrough: false
240
+ sfx_requests_expire_crontab: '00 00 * * 00'
241
+ sfx_timeout: 9
242
+ extra_targets_of_interest:
243
+ ISI_RESEARCHSOFT_EXPORT_TOOL: export_citation
244
+ REFWORKS_EXPORT_TOOL: export_citation
245
+ ASK_A_LIBRARIAN_LCL: help
246
+ COMMENTS_ABOUT_BOBCAT_LCL: help
247
+
248
+ NYUAD:
249
+ display_name: NYU Abu Dhabi Library
250
+ parent_institution: NYU
251
+ resolve_layout: layouts/nyuad/resolve
252
+ search_layout: layouts/nyuad/search
253
+ view_attributes:
254
+ tabs_partial: search/nyuad/tabs
255
+ tip1_partial: search/nyuad/tip1
256
+ tip2_partial: search/nyu/tip2
257
+ sfx_base_url: http://sfx.library.nyu.edu/sfxlcl41?
258
+ ip_addresses:
259
+ - 192.168.224.0/23
260
+ - 192.168.226.0/24
261
+ - 192.168.227.0/25
262
+ - 192.168.227.128/26
263
+ - 172.25.79.0/26
264
+ - 172.26.240.0/22
265
+ - 172.30.60.0/24
266
+ - 172.27.240.0/22
267
+ - 172.29.252.0/24
268
+ - 172.29.120.0/23
269
+ - 192.168.192.0/23
270
+ - 192.168.195.0/25
271
+ - 172.25.76.0/23
272
+ - 172.26.232.0/22
273
+ - 172.30.58.0/24
274
+ - 172.27.232.0/22
275
+ - 172.29.250.0/24
276
+ - 172.29.116.0/23
277
+ - 192.168.194.0/24
278
+ - 172.25.78.0/26
279
+ - 172.26.236.0/22
280
+ - 172.30.59.0/24
281
+ - 172.27.236.0/22
282
+ - 172.29.251.0/24
283
+ - 172.29.118.0/23
284
+
285
+ CU:
286
+ display_name: The Cooper Union Library
287
+ resolve_layout: layouts/cu/resolve
288
+ search_layout: layouts/cu/search
289
+ login_attributes:
290
+ link_code: CU
291
+ view_attributes:
292
+ tabs_partial: search/cu/tabs
293
+ sfx_base_url: http://sfx.library.nyu.edu/sfxcooper?
294
+ ip_addresses:
295
+ - 199.98.16.0-199.98.31.255
296
+ services:
297
+ # CU SFX service.
298
+ CU_SFX:
299
+ name: Get It @ Cooper Union
300
+ display_name: Get It @ Cooper Union
301
+ type: Sfx
302
+ base_url: http://sfx.library.nyu.edu/sfxcooper
303
+ priority: 1
304
+ status: active
305
+ click_passthrough: false
306
+ sfx_requests_expire_crontab: '00 00 * * 00'
307
+ sfx_timeout: 9
308
+ extra_targets_of_interest:
309
+ CAPTURE_CITATION: export_citation
310
+
311
+ NS:
312
+ display_name: New School Libraries
313
+ resolve_layout: layouts/cu/resolve
314
+ search_layout: layouts/cu/search
315
+ login_attributes:
316
+ link_code: NS
317
+ view_attributes:
318
+ tabs_partial: search/ns/tabs
319
+ sfx_base_url: http://sfx4.library.newschool.edu/ns?
320
+ ip_addresses:
321
+ - 149.31.0.0-149.31.255.255
322
+ - 69.64.210.46
323
+ - 69.64.210.50
324
+ - 69.64.210.42
325
+ - 69.193.198.126
326
+ services:
327
+ NS_SFX:
328
+ name: Get It @ New School Libraries
329
+ display_name: Get It @ New School Libraries
330
+ type: Sfx
331
+ base_url: http://sfx4.library.newschool.edu/ns
332
+ priority: 1
333
+ status: active
334
+ click_passthrough: true
335
+ sfx_requests_expire_crontab: '00 00 * * 00'
336
+ sfx_timeout: 9
337
+ extra_targets_of_interest:
338
+ ISI_RESEARCHSOFT_EXPORT_TOOL: export_citation
339
+ REFWORKS_EXPORT_TOOL: export_citation
340
+ # ISI_WEB_OF_SCIENCE: export_citation
341
+ # BX_RECOMMENDER_SERVICE: help
342
+ ASK_A_LIBRARIAN_LCL: help
343
+ COMMENTS_ABOUT_BOBCAT_LCL: help
344
+
345
+ NYSID:
346
+ login_attributes:
347
+ link_code: NYSID
348
+ resolve_layout: layouts/nysid/resolve
349
+ search_layout: layouts/nysid/search
350
+ display_name: New York School of Interior Design Library
351
+ ip_addresses:
352
+ - 128.122.0.1
@@ -6,6 +6,7 @@ class InstitutionListTest < ActiveSupport::TestCase
6
6
  InstitutionList.class_variable_set(:@@institutions_yaml_path, nil)
7
7
  InstitutionList.instance.instance_variable_set(:@institutions, nil)
8
8
  @yaml_path = "#{File.dirname(__FILE__)}/../support/config/institutions.yml"
9
+ @yaml2_path = "#{File.dirname(__FILE__)}/../support/config/institutions2.yml"
9
10
  end
10
11
 
11
12
  test "yaml_path" do
@@ -50,4 +51,13 @@ class InstitutionListTest < ActiveSupport::TestCase
50
51
  assert_not_nil(InstitutionList.instance.institutions_with_ip "128.122.149.122")
51
52
  assert_equal([InstitutionList.instance.get("NYU")], InstitutionList.instance.institutions_with_ip("128.122.149.122"))
52
53
  end
54
+
55
+ test "parents" do
56
+ institution_list = YAML.load_file( @yaml2_path )
57
+ # nyu = institution_list["NYU"]
58
+ # puts "Test:#{institution_list}"
59
+ InstitutionList.yaml_path= @yaml2_path
60
+ InstitutionList.instance.institutions
61
+
62
+ end
53
63
  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.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2151878000 !ruby/object:Gem::Requirement
16
+ requirement: &2151878160 !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: *2151878000
24
+ version_requirements: *2151878160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: authlogic
27
- requirement: &2151876500 !ruby/object:Gem::Requirement
27
+ requirement: &2151876740 !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: *2151876500
35
+ version_requirements: *2151876740
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: nokogiri
38
- requirement: &2151870800 !ruby/object:Gem::Requirement
38
+ requirement: &2151870900 !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: *2151870800
46
+ version_requirements: *2151870900
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:
@@ -68,6 +68,7 @@ files:
68
68
  - test/authpds_test.rb
69
69
  - test/fixtures/users.yml
70
70
  - test/support/config/institutions.yml
71
+ - test/support/config/institutions2.yml
71
72
  - test/support/user.rb
72
73
  - test/support/user_session.rb
73
74
  - test/test_helper.rb
@@ -107,6 +108,7 @@ test_files:
107
108
  - test/authpds_test.rb
108
109
  - test/fixtures/users.yml
109
110
  - test/support/config/institutions.yml
111
+ - test/support/config/institutions2.yml
110
112
  - test/support/user.rb
111
113
  - test/support/user_session.rb
112
114
  - test/test_helper.rb