Module: UCB::LDAP::AffiliationMethods
- Included in:
- Person
- Defined in:
- lib/ucb_ldap/person/affiliation_methods.rb
Instance Method Summary collapse
- #affiliate? ⇒ Boolean
- #affiliate_academic_case_tracking? ⇒ Boolean
- #affiliate_advcon_alumnus? ⇒ Boolean
- #affiliate_advcon_attendee? ⇒ Boolean
- #affiliate_advcon_caa_member? ⇒ Boolean
- #affiliate_advcon_friend? ⇒ Boolean
- #affiliate_advcon_i_house_resident? ⇒ Boolean
- #affiliate_advcon_student? ⇒ Boolean
- #affiliate_advcon_trustee? ⇒ Boolean
-
#affiliate_aws_only? ⇒ Boolean
Determine if the persone is an AFFILIATE #.
- #affiliate_billing_only? ⇒ Boolean
- #affiliate_committee_member? ⇒ Boolean
- #affiliate_concurrent_enrollment? ⇒ Boolean
- #affiliate_consultant? ⇒ Boolean
- #affiliate_contractor? ⇒ Boolean
- #affiliate_departmental? ⇒ Boolean
- #affiliate_directory_only? ⇒ Boolean
- #affiliate_emeritus? ⇒ Boolean
- #affiliate_expiration_date ⇒ Object
- #affiliate_expired? ⇒ Boolean
- #affiliate_hhmi_researcher? ⇒ Boolean
- #affiliate_lbl_doe_postdoc? ⇒ Boolean
- #affiliate_lbl_op_staff? ⇒ Boolean
- #affiliate_maintenance? ⇒ Boolean
- #affiliate_staff_affiliate? ⇒ Boolean
- #affiliate_staff_retiree? ⇒ Boolean
- #affiliate_temp_agency? ⇒ Boolean
- #affiliate_test? ⇒ Boolean
-
#affiliate_visiting? ⇒ Boolean
Note: there are actually 2 types of visting affiliaties, visiting student and visiting scholars.
- #affiliate_volunteer? ⇒ Boolean
-
#affiliations ⇒ Object
Returns an
Array
of Person’s affiliations. - #employee? ⇒ Boolean
- #employee_academic? ⇒ Boolean
- #employee_expiration_date ⇒ Object
- #employee_expired? ⇒ Boolean
-
#employee_staff? ⇒ Boolean
Returns
true
if entry has the “staff” affiliation. -
#has_affiliation?(affiliation) ⇒ Boolean
Returns
true
if entry’s affiliations contain affiliation. -
#has_affiliation_of_type?(affiliation_type) ⇒ Boolean
Returns
true
if Person’s affiliations contain at least one affiliation of a particular type. -
#student? ⇒ Boolean
Returns
true
if entry has a studend affiliation and is not expired. - #student_expiration_date ⇒ Object
-
#student_expired? ⇒ Boolean
Returns
true
if is an expired student. - #student_not_registered? ⇒ Boolean
- #student_registered? ⇒ Boolean
Instance Method Details
#affiliate? ⇒ Boolean
217 218 219 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 217 def affiliate? has_affiliation_of_type?(:affiliate) && !affiliate_expired? end |
#affiliate_academic_case_tracking? ⇒ Boolean
173 174 175 |
# 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? ⇒ Boolean
193 194 195 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 193 def affiliate_advcon_alumnus? has_affiliation? 'AFFILIATE-TYPE-ADVCON-ALUMNUS' end |
#affiliate_advcon_attendee? ⇒ Boolean
209 210 211 |
# 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? ⇒ Boolean
197 198 199 |
# 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? ⇒ Boolean
189 190 191 |
# 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? ⇒ Boolean
201 202 203 |
# 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? ⇒ Boolean
205 206 207 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 205 def affiliate_advcon_student? has_affiliation? 'AFFILIATE-TYPE-ADVCON-STUDENT' end |
#affiliate_advcon_trustee? ⇒ Boolean
185 186 187 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 185 def affiliate_advcon_trustee? has_affiliation? 'AFFILIATE-TYPE-ADVCON-TRUSTEE' end |
#affiliate_aws_only? ⇒ Boolean
Determine if the persone is an AFFILIATE #
101 102 103 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 101 def affiliate_aws_only? has_affiliation? 'AFFILIATE-TYPE-AWS ONLY' end |
#affiliate_billing_only? ⇒ Boolean
181 182 183 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 181 def affiliate_billing_only? has_affiliation? 'AFFILIATE-TYPE-BILLING ONLY' end |
#affiliate_committee_member? ⇒ Boolean
137 138 139 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 137 def affiliate_committee_member? has_affiliation? 'AFFILIATE-TYPE-COMMITTEE MEMBER' end |
#affiliate_concurrent_enrollment? ⇒ Boolean
153 154 155 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 153 def affiliate_concurrent_enrollment? has_affiliation? 'AFFILIATE-TYPE-CONCURR ENROLL' end |
#affiliate_consultant? ⇒ Boolean
141 142 143 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 141 def affiliate_consultant? has_affiliation? 'AFFILIATE-TYPE-CONSULTANT' end |
#affiliate_contractor? ⇒ Boolean
125 126 127 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 125 def affiliate_contractor? has_affiliation? 'AFFILIATE-TYPE-CONTRACTOR' end |
#affiliate_departmental? ⇒ Boolean
161 162 163 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 161 def affiliate_departmental? has_affiliation? 'AFFILIATE-TYPE-DEPARTMENTAL' end |
#affiliate_directory_only? ⇒ Boolean
113 114 115 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 113 def affiliate_directory_only? has_affiliation? 'AFFILIATE-TYPE-DIRECTORY ONLY' end |
#affiliate_emeritus? ⇒ Boolean
109 110 111 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 109 def affiliate_emeritus? has_affiliation? 'AFFILIATE-TYPE-EMERITUS' end |
#affiliate_expiration_date ⇒ Object
221 222 223 224 |
# 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? ⇒ Boolean
213 214 215 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 213 def affiliate_expired? has_affiliation? 'AFFILIATE-STATUS-EXPIRED' end |
#affiliate_hhmi_researcher? ⇒ Boolean
149 150 151 |
# 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? ⇒ Boolean
129 130 131 |
# 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? ⇒ Boolean
133 134 135 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 133 def affiliate_lbl_op_staff? has_affiliation? 'AFFILIATE-TYPE-LBLOP STAFF' end |
#affiliate_maintenance? ⇒ Boolean
177 178 179 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 177 def affiliate_maintenance? has_affiliation? 'AFFILIATE-TYPE-MAINTENANCE' end |
#affiliate_staff_affiliate? ⇒ Boolean
169 170 171 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 169 def affiliate_staff_affiliate? has_affiliation? 'AFFILIATE-TYPE-STAFF-AFFILIATE' end |
#affiliate_staff_retiree? ⇒ Boolean
105 106 107 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 105 def affiliate_staff_retiree? has_affiliation? 'AFFILIATE-TYPE-STAFF RETIREE' end |
#affiliate_temp_agency? ⇒ Boolean
157 158 159 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 157 def affiliate_temp_agency? has_affiliation? 'AFFILIATE-TYPE-TEMP AGENCY' end |
#affiliate_test? ⇒ Boolean
165 166 167 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 165 def affiliate_test? has_affiliation? 'AFFILIATE-TYPE-TEST' end |
#affiliate_visiting? ⇒ Boolean
Note: there are actually 2 types of visting affiliaties, visiting student and visiting scholars. But for now we will generalize.
121 122 123 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 121 def affiliate_visiting? has_affiliation? 'AFFILIATE-TYPE-VISITING' end |
#affiliate_volunteer? ⇒ Boolean
145 146 147 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 145 def affiliate_volunteer? has_affiliation? 'AFFILIATE-TYPE-VOLUNTEER' end |
#affiliations ⇒ Object
Returns an Array
of Person’s affiliations.
8 9 10 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 8 def affiliations @affiliations ||= berkeleyEduAffiliations.map { |a| a.upcase } end |
#employee? ⇒ Boolean
59 60 61 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 59 def employee? has_affiliation_of_type?(:employee) && !employee_expired? end |
#employee_academic? ⇒ Boolean
46 47 48 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 46 def employee_academic? has_affiliation? 'EMPLOYEE-TYPE-ACADEMIC' end |
#employee_expiration_date ⇒ Object
54 55 56 57 |
# 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? ⇒ Boolean
50 51 52 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 50 def employee_expired? has_affiliation? 'EMPLOYEE-STATUS-EXPIRED' end |
#employee_staff? ⇒ Boolean
Returns true
if entry has the “staff” affiliation.
42 43 44 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 42 def employee_staff? has_affiliation? 'EMPLOYEE-TYPE-STAFF' end |
#has_affiliation?(affiliation) ⇒ Boolean
Returns true
if entry’s affiliations contain affiliation.
Case-insensitive.
17 18 19 |
# 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) ⇒ Boolean
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
29 30 31 32 |
# 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? ⇒ Boolean
Returns true
if entry has a studend affiliation and is not expired.
92 93 94 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 92 def student? has_affiliation_of_type?(:student) && !student_expired? end |
#student_expiration_date ⇒ Object
75 76 77 78 |
# 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? ⇒ Boolean
Returns true
if is an expired student.
71 72 73 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 71 def student_expired? has_affiliation? 'STUDENT-STATUS-EXPIRED' end |
#student_not_registered? ⇒ Boolean
84 85 86 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 84 def student_not_registered? has_affiliation? 'STUDENT-TYPE-NOT REGISTERED' end |
#student_registered? ⇒ Boolean
80 81 82 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 80 def student_registered? has_affiliation? 'STUDENT-TYPE-REGISTERED' end |