class ASF::Committer

Manage committers: list, add, and remove people not only from the list of people, but from the list of committers.

Public Class Methods

add(attrs) click to toggle source

add a new committer to LDAP. Attrs must include uid, cn, and mail

# File lib/whimsy/asf/ldap.rb, line 539
def self.add(attrs)
  # add person to LDAP
  person = ASF::Person.add(attrs)

  # add person to 'new' committers list
  ASF::LDAP.modify("cn=committers,#@base", 
    [ASF::Base.mod_add('member', [person.dn])])

  # add person to 'legacy' committers list
  ASF::Group['committers'].add(person)

  # return new person
  person
end
list() click to toggle source

get a list of committers

# File lib/whimsy/asf/ldap.rb, line 533
def self.list()
  ASF.search_one(base, 'cn=committers', 'member').flatten.
    map {|uid| Person.find uid[/uid=(.*?),/,1]}
end
remove(person) click to toggle source

remove a committer from LDAP

# File lib/whimsy/asf/ldap.rb, line 555
def self.remove(person)
  # if person is a string, find the person object
  person = ASF::Person.find(person) if person.instance_of? String

  # remove person from 'legacy' committers list, ignoring exceptions
  ASF::Group['committers'].remove(person) rescue nil

  # remove person from 'new' committers list, ignoring exceptions
  ASF::LDAP.modify("cn=committers,#@base", 
    [ASF::Base.mod_delete('member', [person.dn])]) rescue nil

  # remove person from LDAP
  ASF::Person.remove(person.id)
end