authpds-nyu 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,29 +1,33 @@
|
|
1
1
|
module AuthpdsNyu
|
2
2
|
module Session
|
3
3
|
module Aleph
|
4
|
+
require 'exlibris-aleph'
|
4
5
|
def aleph_bor_auth_permissions(bor_id=nil, verification=nil, adm=nil, sublibrary=nil)
|
5
6
|
bor_auth = aleph_bor_auth(bor_id, verification, adm, sublibrary)
|
6
7
|
return (bor_auth.nil? or bor_auth.error) ? {} : bor_auth.permissions
|
7
8
|
end
|
8
9
|
|
9
10
|
def aleph_bor_auth(bor_id=nil, verification=nil, adm=nil, sublibrary=nil)
|
10
|
-
|
11
|
+
if bor_id.nil? and pds_user
|
12
|
+
bor_id = pds_user.id
|
13
|
+
verification = pds_user.verification
|
14
|
+
end
|
11
15
|
raise ArgumentError.new("Argument Error in #{self.class}. bor_id not specified.") if bor_id.nil?;
|
12
|
-
verification = pds_user.verification if verification.nil? unless pds_user.nil?
|
13
16
|
raise ArgumentError.new("Argument Error in #{self.class}. verification not specified.") if verification.nil?;
|
14
17
|
adm = aleph_default_adm if adm.nil?
|
15
18
|
sublibrary = aleph_default_sublibrary if sublibrary.nil?
|
16
19
|
# Call X-Service
|
17
|
-
bor_auth =
|
18
|
-
|
19
|
-
new(aleph_url, adm, sublibrary, "N", bor_id, verification)
|
20
|
-
controller.logger.error(
|
21
|
-
"Error in #{self.class}. "+
|
22
|
-
"No permissions returned from Aleph bor-auth for user with bor_id #{bor_id}."+
|
23
|
-
"Error: #{(bor_auth.nil?) ? "bor_auth is nil." : bor_auth.error.inspect}"
|
24
|
-
) and return nil if bor_auth.nil? or bor_auth.error
|
20
|
+
bor_auth = Exlibris::Aleph::BorAuth.new(aleph_url, adm, sublibrary, "N", bor_id, verification)
|
21
|
+
log_error(bor_id, bor_auth) and return nil if bor_auth.nil? or bor_auth.error
|
25
22
|
return bor_auth
|
26
23
|
end
|
24
|
+
|
25
|
+
def log_error bor_id, bor_auth
|
26
|
+
controller.logger.error "Error in #{self.class}. "+
|
27
|
+
"No permissions returned from Aleph bor-auth for user with bor_id #{bor_id}."+
|
28
|
+
"Error: #{(bor_auth.nil?) ? "bor_auth is nil." : bor_auth.error.inspect}"
|
29
|
+
end
|
30
|
+
private :log_error
|
27
31
|
end
|
28
32
|
end
|
29
33
|
end
|
data/lib/authpds-nyu/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authpds-nyu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
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
|
+
date: 2012-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: require_all
|
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
172
|
version: '0'
|
173
173
|
segments:
|
174
174
|
- 0
|
175
|
-
hash:
|
175
|
+
hash: -1766004451307924140
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
177
|
none: false
|
178
178
|
requirements:
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
segments:
|
183
183
|
- 0
|
184
|
-
hash:
|
184
|
+
hash: -1766004451307924140
|
185
185
|
requirements: []
|
186
186
|
rubyforge_project:
|
187
187
|
rubygems_version: 1.8.24
|