Module: ASF
- Defined in:
- lib/whimsy/asf/svn.rb,
lib/whimsy/asf/auth.rb,
lib/whimsy/asf/icla.rb,
lib/whimsy/asf/ldap.rb,
lib/whimsy/asf/mail.rb,
lib/whimsy/asf/rack.rb,
lib/whimsy/asf/site.rb,
lib/whimsy/asf/watch.rb,
lib/whimsy/asf/agenda.rb,
lib/whimsy/asf/config.rb,
lib/whimsy/asf/member.rb,
lib/whimsy/asf/nominees.rb,
lib/whimsy/asf/podlings.rb,
lib/whimsy/asf/committee.rb
Defined Under Namespace
Modules: Auth, Board Classes: Authorization, Base, Committee, Config, Group, HTTPS_workarounds, ICLA, LazyHash, Mail, Member, Person, Podlings, SVN, Service, Site
Class Method Summary collapse
- .committers ⇒ Object
-
.init_ldap ⇒ Object
determine whether or not the LDAP API can be used.
- .members ⇒ Object
- .pmc_chairs ⇒ Object
-
.search_archive_by_id(value) ⇒ Object
Search archive for historical records of people who were committers but never submitted an ICLA (some of which are still ASF members or members of a PMC).
-
.search_one(base, filter, attrs = nil) ⇒ Object
search with a scope of one.
Class Method Details
.committers ⇒ Object
50 51 52 |
# File 'lib/whimsy/asf/ldap.rb', line 50 def self.committers @committers ||= Group.find('committers').members end |
.init_ldap ⇒ Object
determine whether or not the LDAP API can be used
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/whimsy/asf/ldap.rb', line 8 def self.init_ldap @ldap = nil begin conf = '/etc/ldap/ldap.conf' host = File.read(conf).scan(/^uri\s+ldaps:\/\/(\S+?):(\d+)/i).first if host Wunderbar.info "Connecting to LDAP server: [ldaps://#{host[0]}:#{host[1]}]" end rescue Errno::ENOENT host = nil Wunderbar.error "No LDAP server defined, there must be a LDAP ldaps:// URI in /etc/ldap/ldap.conf" end begin @ldap = LDAP::SSLConn.new(host.first, host.last.to_i) if host rescue LDAP::ResultError=>re Wunderbar.error "Error binding to LDAP server: message: ["+ re. + "]" end end |
.members ⇒ Object
54 55 56 |
# File 'lib/whimsy/asf/ldap.rb', line 54 def self.members @members ||= Group.find('member').members end |
.pmc_chairs ⇒ Object
46 47 48 |
# File 'lib/whimsy/asf/ldap.rb', line 46 def self.pmc_chairs @pmc_chairs ||= Service.find('pmc-chairs').members end |
.search_archive_by_id(value) ⇒ Object
Search archive for historical records of people who were committers but never submitted an ICLA (some of which are still ASF members or members of a PMC).
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/whimsy/asf/icla.rb', line 53 def self.search_archive_by_id(value) require 'net/http' require 'nokogiri' historical_committers = 'http://people.apache.org/~rubys/committers.html' doc = Nokogiri::HTML(Net::HTTP.get(URI.parse(historical_committers))) doc.search('tr').each do |tr| tds = tr.search('td') next unless tds.length == 3 return tds[1].text if tds[0].text == value end nil rescue nil end |
.search_one(base, filter, attrs = nil) ⇒ Object
search with a scope of one
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/whimsy/asf/ldap.rb', line 28 def self.search_one(base, filter, attrs=nil) init_ldap unless defined? @ldap return [] unless @ldap Wunderbar.info "ldapsearch -x -LLL -b #{base} -s one #{filter} " + "#{[attrs].flatten.join(' ')}" begin result = @ldap.search2(base, LDAP::LDAP_SCOPE_ONELEVEL, filter, attrs) rescue result = [] end result.map! {|hash| hash[attrs]} if String === attrs result end |