Module: AuthpdsNyu::Session::InstanceMethods

Defined in:
lib/authpds-nyu/session.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/authpds-nyu/session.rb', line 54

def self.included(klass)
  klass.class_eval do
    pds_attributes :id => "id", :uid => "uid", 
      :opensso => "opensso", :name => "name", :firstname => "givenname", 
      :lastname => "sn", :commonname => "cn", :email => "email",
      :nyuidn => "nyuidn", :verification => "verification", :institute => "institute",
      :bor_status => "bor-status", :bor_type => "bor-type",
      :college_code => "college_code", :college_name => "college_name",
      :dept_name => "dept_name", :dept_code => "dept_code",
      :major_code => "major_code", :major => "major", :ill_permission => "ill-permission", 
      :newschool_ldap => "newschool_ldap"
    remember_me true
    remember_me_for 300
    httponly true
    secure true
     "http://library.nyu.edu/errors/login-library-nyu-edu/"
  end
end

Instance Method Details

#aleph_bor_auth(bor_id = nil, verification = nil, adm = nil, sublibrary = nil) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/authpds-nyu/session.rb', line 78

def aleph_bor_auth(bor_id=nil, verification=nil, adm=nil, sublibrary=nil)
  bor_id = pds_user.id if bor_id.nil?
  verification = pds_user.verification if verification.nil?
  aleph_url = self.class.aleph_url
  adm = self.class.aleph_default_adm if adm.nil?
  sublibrary = self.class.aleph_default_sublibrary if sublibrary.nil?
  # Call X-Service
  bor_auth = 
    AuthPdsNyu::Exlibris::Aleph::BorAuth.
      new(aleph_url, adm, sublibrary, "N", bor_id, bor_verification)
  controller.logger.error(
      "Error in #{self.class}. "+
      "No permissions returned from Aleph bor-auth for user with bor_id #{bor_id}."+
      "Error: #{(bor_auth.nil?) ? "bor_auth is nil." : bor_auth.error.inspect}"
    ) and return nil if bor_auth.nil? or bor_auth.error
  return bor_auth
end

#aleph_bor_auth_permissions(bor_id = nil, verification = nil, adm = nil, sublibrary = nil) ⇒ Object



73
74
75
76
# File 'lib/authpds-nyu/session.rb', line 73

def aleph_bor_auth_permissions(bor_id=nil, verification=nil, adm=nil, sublibrary=nil)
  bor_auth = aleph_bor_auth(bor_id, verification, adm, sublibrary)
  return (bor_auth.nil? or bor_auth.error) ? {} : bor_auth.permissions
end