module UCB::LDAP::AffiliationMethods

Public Instance Methods

affiliate?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 217
def affiliate?
  has_affiliation_of_type?(:affiliate) && !affiliate_expired?
end
affiliate_academic_case_tracking?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 173
def affiliate_academic_case_tracking?
  has_affiliation? 'AFFILIATE-TYPE-ACADEMIC CASE TRACKING'
end
affiliate_advcon_alumnus?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 193
def affiliate_advcon_alumnus?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-ALUMNUS'
end
affiliate_advcon_attendee?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 209
def affiliate_advcon_attendee?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-ATTENDEE'
end
affiliate_advcon_caa_member?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 197
def affiliate_advcon_caa_member?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-CAA-MEMBER'
end
affiliate_advcon_friend?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 189
def affiliate_advcon_friend?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-FRIEND'
end
affiliate_advcon_i_house_resident?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 201
def affiliate_advcon_i_house_resident?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-I-HOUSE-RESIDENT'
end
affiliate_advcon_student?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 205
def affiliate_advcon_student?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-STUDENT'
end
affiliate_advcon_trustee?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 185
def affiliate_advcon_trustee?
  has_affiliation? 'AFFILIATE-TYPE-ADVCON-TRUSTEE'
end
affiliate_aws_only?() click to toggle source

Determine if the persone is an AFFILIATE #

# File lib/ucb_ldap/person/affiliation_methods.rb, line 101
def affiliate_aws_only?
  has_affiliation? 'AFFILIATE-TYPE-AWS ONLY'
end
affiliate_billing_only?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 181
def affiliate_billing_only?
  has_affiliation? 'AFFILIATE-TYPE-BILLING ONLY'
end
affiliate_committee_member?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 137
def affiliate_committee_member?
  has_affiliation? 'AFFILIATE-TYPE-COMMITTEE MEMBER'
end
affiliate_concurrent_enrollment?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 153
def affiliate_concurrent_enrollment?
  has_affiliation? 'AFFILIATE-TYPE-CONCURR ENROLL'
end
affiliate_consultant?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 141
def affiliate_consultant?
  has_affiliation? 'AFFILIATE-TYPE-CONSULTANT'
end
affiliate_contractor?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 125
def affiliate_contractor?
  has_affiliation? 'AFFILIATE-TYPE-CONTRACTOR'
end
affiliate_departmental?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 161
def affiliate_departmental?
  has_affiliation? 'AFFILIATE-TYPE-DEPARTMENTAL'
end
affiliate_directory_only?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 113
def affiliate_directory_only?
  has_affiliation? 'AFFILIATE-TYPE-DIRECTORY ONLY'
end
affiliate_emeritus?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 109
def affiliate_emeritus?
  has_affiliation? 'AFFILIATE-TYPE-EMERITUS'
end
affiliate_expiration_date() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 221
def affiliate_expiration_date
  warn "DEPRECATED: affiliate_expiration_date is no longer supported"
  nil
end
affiliate_expired?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 213
def affiliate_expired?
  has_affiliation? 'AFFILIATE-STATUS-EXPIRED'
end
affiliate_hhmi_researcher?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 149
def affiliate_hhmi_researcher?
  has_affiliation? 'AFFILIATE-TYPE-HHMI RESEARCHER'
end
affiliate_lbl_doe_postdoc?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 129
def affiliate_lbl_doe_postdoc?
  has_affiliation? 'AFFILIATE-TYPE-LBL/DOE POSTDOC'
end
affiliate_lbl_op_staff?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 133
def affiliate_lbl_op_staff?
  has_affiliation? 'AFFILIATE-TYPE-LBLOP STAFF'
end
affiliate_maintenance?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 177
def affiliate_maintenance?
  has_affiliation? 'AFFILIATE-TYPE-MAINTENANCE'
end
affiliate_staff_affiliate?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 169
def affiliate_staff_affiliate?
  has_affiliation? 'AFFILIATE-TYPE-STAFF-AFFILIATE'
end
affiliate_staff_retiree?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 105
def affiliate_staff_retiree?
  has_affiliation? 'AFFILIATE-TYPE-STAFF RETIREE'
end
affiliate_temp_agency?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 157
def affiliate_temp_agency?
  has_affiliation? 'AFFILIATE-TYPE-TEMP AGENCY'
end
affiliate_test?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 165
def affiliate_test?
  has_affiliation? 'AFFILIATE-TYPE-TEST'
end
affiliate_visiting?() click to toggle source

Note: there are actually 2 types of visting affiliaties, visiting student and visiting scholars. But for now we will generalize.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 121
def affiliate_visiting?
  has_affiliation? 'AFFILIATE-TYPE-VISITING'
end
affiliate_volunteer?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 145
def affiliate_volunteer?
  has_affiliation? 'AFFILIATE-TYPE-VOLUNTEER'
end
affiliations() click to toggle source

Returns an Array of Person's affiliations.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 8
def affiliations
  @affiliations ||= berkeleyEduAffiliations.map { |a| a.upcase }
end
employee?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 59
def employee?
  has_affiliation_of_type?(:employee) && !employee_expired?
end
employee_academic?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 46
def employee_academic?
  has_affiliation? 'EMPLOYEE-TYPE-ACADEMIC'
end
employee_expiration_date() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 54
def employee_expiration_date
  warn "DEPRECATED: employee_expiration_date is no longer supported"
  nil
end
employee_expired?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 50
def employee_expired?
  has_affiliation? 'EMPLOYEE-STATUS-EXPIRED'
end
employee_staff?() click to toggle source

Returns true if entry has the “staff” affiliation.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 42
def employee_staff?
  has_affiliation? 'EMPLOYEE-TYPE-STAFF'
end
has_affiliation?(affiliation) click to toggle source

Returns true if entry's affiliations contain affiliation.

Case-insensitive.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 17
def has_affiliation?(affiliation)
  affiliations.include?(affiliation.upcase)
end
has_affiliation_of_type?(affiliation_type) click to toggle source

Returns true if Person's affiliations contain at least one affiliation of a particular type.

p = Person.find_by_uid ...
p.affiliations                         #=> ['EMPLOYEE-TYPE-STAFF']
p.has_affiliation_of_type?(:employee)  #=> true
p.has_affiliation_of_type?(:student)   #=> false
# File lib/ucb_ldap/person/affiliation_methods.rb, line 29
def has_affiliation_of_type?(affiliation_type)
  aff_type_string = affiliation_type.to_s.upcase
  affiliations.find { |a| a =~ /^#{aff_type_string}-TYPE-/ } ? true : false
end
student?() click to toggle source

Returns true if entry has a studend affiliation and is not expired.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 92
def student?
  has_affiliation_of_type?(:student) && !student_expired?
end
student_expiration_date() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 75
def student_expiration_date
  warn "DEPRECATED: student_expiration_date is no longer supported"
  nil
end
student_expired?() click to toggle source

Returns true if is an expired student.

# File lib/ucb_ldap/person/affiliation_methods.rb, line 71
def student_expired?
  has_affiliation? 'STUDENT-STATUS-EXPIRED'
end
student_not_registered?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 84
def student_not_registered?
  has_affiliation? 'STUDENT-TYPE-NOT REGISTERED'
end
student_registered?() click to toggle source
# File lib/ucb_ldap/person/affiliation_methods.rb, line 80
def student_registered?
  has_affiliation? 'STUDENT-TYPE-REGISTERED'
end