• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / bibdata / 2ee2c4fc-5ef0-4806-b86e-01bf70aa67a0

24 Dec 2024 04:55PM UTC coverage: 91.859% (-0.04%) from 91.902%
2ee2c4fc-5ef0-4806-b86e-01bf70aa67a0

Pull #2569

circleci

christinach
Generate new .rubocop_todo.yml
rubocop fix
Pull Request #2569: Rubocop gems

335 of 378 new or added lines in 57 files covered. (88.62%)

2 existing lines in 2 files now uncovered.

3385 of 3685 relevant lines covered (91.86%)

377.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/app/models/ldap.rb
1
require 'net/ldap'
1✔
2

3
class Ldap
1✔
4
  class << self
1✔
5
    def find_by_netid(net_id, ldap_connection: default_connection)
1✔
6
      filter = Net::LDAP::Filter.eq('uid', net_id)
2✔
7
      result = ldap_connection.search(filter:).first
2✔
8
      return {} if result.blank?
2✔
9

10
      attributes(result)
1✔
11
    end
12

13
    private
1✔
14

15
      def attributes(result)
1✔
16
        {
17
          netid: result[:uid]&.first,
1✔
18
          department: result[:purescollege]&.first || result[:ou]&.first,
19
          address: result[:puinterofficeaddress]&.first,
20
          telephone: result[:telephonenumber]&.first,
21
          givenname: result[:givenname]&.first,
22
          surname: result[:sn]&.first,
23
          email: result[:mail]&.first,
24
          status: result[:edupersonprimaryaffiliation]&.first,
25
          pustatus: result[:pustatus]&.first,
26
          universityid: result[:universityid]&.first,
27
          title: result[:title]&.first
28
        }
29
      end
30

31
      def default_connection
1✔
NEW
32
        @default_connection ||= Net::LDAP.new host: 'ldap.princeton.edu', base: 'o=Princeton University,c=US', port: 636,
×
33
                                              encryption: {
34
                                                method: :simple_tls,
35
                                                tls_options: OpenSSL::SSL::SSLContext::DEFAULT_PARAMS
36
                                              }
37
      end
38
  end
39
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc