class UCB::LDAP::Affiliation

UCB::LDAP::Affiliation

This class models a persons affiliate entries in the UCB LDAP directory.

affiliations = Affiliation.find_by_uid("1234")  #=> [#<UCB::LDAP::Affiliation: ...>, ...]

Affiliation are usually loaded through a Person instance:

p = Person.find_by_uid("1234")    #=> #<UCB::LDAP::Person: ...>
affs = p.affiliations        #=> [#<UCB::LDAP::Affiliation: ...>, ...]

Note on Binds

You must have a privileged bind and pass your credentials to UCB::LDAP.authenticate() before performing your Affiliation search.

Public Class Methods

find_by_uid(uid) click to toggle source

Returns an Array of Affiliation for uid. Returns an empty Array ([]) if nothing is found.

# File lib/ucb_ldap/affiliation.rb, line 77
def find_by_uid(uid)
  base = "uid=#{uid},ou=people,dc=berkeley,dc=edu"
  filter = Net::LDAP::Filter.eq("objectclass", 'berkeleyEduPersonAffiliate')
  search(:base => base, :filter => filter)
end

Public Instance Methods

affiliate_id() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 37
def affiliate_id
  berkeleyEduAffID.first
end
affiliate_type() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 41
def affiliate_type
  berkeleyEduAffType
end
create_datetime() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 23
def create_datetime
  warn "DEPRECATED: create_datetime is no longer supported"
  []
end
dept_code() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 65
def dept_code
  departmentNumber.first
end
dept_name() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 69
def dept_name
  warn "DEPRECATED: dept_name is no longer supported"
end
expiration_date() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 32
def expiration_date
  warn "DEPRECATED: expiration_date is no longer supported"
  []
end
expired_by() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 28
def expired_by
  berkeleyEduAffExpBy
end
first_name() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 45
def first_name
  givenName.first
end
last_name() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 53
def last_name
  sn.first
end
middle_name() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 49
def middle_name
  berkeleyEduMiddleName
end
modified_by() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 57
def modified_by
  berkeleyEduModifiedBy
end
source() click to toggle source
# File lib/ucb_ldap/affiliation.rb, line 61
def source
  berkeleyEduPersonAffiliateSource
end