authpds 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,44 +0,0 @@
1
- class Institution < Struct.new(:display_name, :name, :default, :parent_institution,
2
- :ip_addresses, :login, :layouts, :views, :controllers, :models)
3
- require 'ipaddr'
4
-
5
- # Better initializer than Struct gives us, take a hash instead
6
- # of an ordered array. :services=>[] is an array of service ids,
7
- # not actual Services!
8
- def initialize(h={})
9
- members.each {|m| self.send( ("#{m}=").to_sym , (h.delete("#{m}".to_sym) || h.delete("#{m}"))) }
10
- # If the institution is named default, take that as an
11
- # indication that it's the default institution
12
- self.default= true if name == "default" or name == "DEFAULT"
13
- self.default= false unless default
14
- # Log the fact that there are left overs in the hash
15
- # Rails.logger.warn("The following institution settings were ignored: #{h.inspect}.") unless h.empty?
16
- end
17
-
18
- # Instantiates a new copy of all services included in this institution,
19
- # returns an array.
20
- def instantiate_services!
21
- services.collect {|s| }
22
- end
23
-
24
- # Check the list of IP addresses for the given IP
25
- def includes_ip?(prospective_ip_address)
26
- return false if ip_addresses.nil?
27
- ip_prospect = IPAddr.new(prospective_ip_address)
28
- ip_addresses.each do |ip_address|
29
- ip_range = (ip_address.match(/[\-\*]/)) ?
30
- (ip_address.match(/\-/)) ?
31
- (IPAddr.new(ip_address.split("-")[0])..IPAddr.new(ip_address.split("-")[1])) :
32
- (IPAddr.new(ip_address.gsub(/\*/, "0"))..IPAddr.new(ip_address.gsub(/\*/, "255"))) :
33
- IPAddr.new(ip_address).to_range
34
- return true if ip_range === ip_prospect unless ip_range.nil?
35
- end
36
- return false;
37
- end
38
-
39
- def to_h
40
- h = {}
41
- members.each {|m| h[m.to_sym] = self.send(m)}
42
- h
43
- end
44
- end
@@ -1,75 +0,0 @@
1
- class InstitutionList
2
- include Singleton # get the instance with InstitutionList.instance
3
- @@institutions_yaml_path = nil
4
-
5
- def initialize
6
- @institutions = nil
7
- end
8
-
9
- # Used for initialization and testing
10
- def self.yaml_path=(path)
11
- @@institutions_yaml_path = path
12
- self.instance.reload
13
- end
14
-
15
- def self.institutions_defined?
16
- return !@@institutions_yaml_path.nil?
17
- end
18
-
19
- # Returns an Institution
20
- def get(name)
21
- return institutions[name]
22
- end
23
-
24
- # Returns an array of Institutions
25
- def defaults
26
- return institutions.values.find_all {|institution| institution.default === true}
27
- end
28
-
29
- # Returns an array of Institutions
30
- def institutions_with_ip(ip)
31
- return institutions.values.find_all { |institution| institution.includes_ip?(ip) }
32
- end
33
-
34
- # Reload institutions from the YAML file.
35
- def reload
36
- @institutions = nil
37
- institutions
38
- true
39
- end
40
-
41
- # Load institutions from the YAML file and return as a hash.
42
- def institutions
43
- unless @institutions
44
- raise ArgumentError.new("institutions_yaml_path was not specified.") if @@institutions_yaml_path.nil?
45
- raise NameError.new(
46
- "The file #{@@institutions_yaml_path} does not exist. "+
47
- "In order to use the institution feature you must create the file."
48
- ) unless File.exists?(@@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
62
- @institutions = {}
63
- institutions_hash.each do |name, definition|
64
- @institutions[name] = Institution.new(definition)
65
- end
66
- end
67
- return @institutions
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
75
- end
@@ -1,352 +0,0 @@
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:
16
- link_code: NYU
17
- views:
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
- views:
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:
290
- link_code: CU
291
- views:
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:
316
- link_code: NS
317
- views:
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:
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