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
215 216 217 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 215 def affiliate? has_affiliation_of_type?(:affiliate) && !affiliate_expired? end |
#affiliate_academic_case_tracking? ⇒ Boolean
171 172 173 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 171 def affiliate_academic_case_tracking? has_affiliation? 'AFFILIATE-TYPE-ACADEMIC CASE TRACKING' end |
#affiliate_advcon_alumnus? ⇒ Boolean
191 192 193 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 191 def affiliate_advcon_alumnus? has_affiliation? 'AFFILIATE-TYPE-ADVCON-ALUMNUS' end |
#affiliate_advcon_attendee? ⇒ Boolean
207 208 209 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 207 def affiliate_advcon_attendee? has_affiliation? 'AFFILIATE-TYPE-ADVCON-ATTENDEE' end |
#affiliate_advcon_caa_member? ⇒ Boolean
195 196 197 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 195 def affiliate_advcon_caa_member? has_affiliation? 'AFFILIATE-TYPE-ADVCON-CAA-MEMBER' end |
#affiliate_advcon_friend? ⇒ Boolean
187 188 189 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 187 def affiliate_advcon_friend? has_affiliation? 'AFFILIATE-TYPE-ADVCON-FRIEND' end |
#affiliate_advcon_i_house_resident? ⇒ Boolean
199 200 201 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 199 def affiliate_advcon_i_house_resident? has_affiliation? 'AFFILIATE-TYPE-ADVCON-I-HOUSE-RESIDENT' end |
#affiliate_advcon_student? ⇒ Boolean
203 204 205 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 203 def affiliate_advcon_student? has_affiliation? 'AFFILIATE-TYPE-ADVCON-STUDENT' end |
#affiliate_advcon_trustee? ⇒ Boolean
183 184 185 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 183 def affiliate_advcon_trustee? has_affiliation? 'AFFILIATE-TYPE-ADVCON-TRUSTEE' end |
#affiliate_aws_only? ⇒ Boolean
Determine if the persone is an AFFILIATE #
99 100 101 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 99 def affiliate_aws_only? has_affiliation? 'AFFILIATE-TYPE-AWS ONLY' end |
#affiliate_billing_only? ⇒ Boolean
179 180 181 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 179 def affiliate_billing_only? has_affiliation? 'AFFILIATE-TYPE-BILLING ONLY' end |
#affiliate_committee_member? ⇒ Boolean
135 136 137 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 135 def affiliate_committee_member? has_affiliation? 'AFFILIATE-TYPE-COMMITTEE MEMBER' end |
#affiliate_concurrent_enrollment? ⇒ Boolean
151 152 153 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 151 def affiliate_concurrent_enrollment? has_affiliation? 'AFFILIATE-TYPE-CONCURR ENROLL' end |
#affiliate_consultant? ⇒ Boolean
139 140 141 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 139 def affiliate_consultant? has_affiliation? 'AFFILIATE-TYPE-CONSULTANT' end |
#affiliate_contractor? ⇒ Boolean
123 124 125 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 123 def affiliate_contractor? has_affiliation? 'AFFILIATE-TYPE-CONTRACTOR' end |
#affiliate_departmental? ⇒ Boolean
159 160 161 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 159 def affiliate_departmental? has_affiliation? 'AFFILIATE-TYPE-DEPARTMENTAL' end |
#affiliate_directory_only? ⇒ Boolean
111 112 113 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 111 def affiliate_directory_only? has_affiliation? 'AFFILIATE-TYPE-DIRECTORY ONLY' end |
#affiliate_emeritus? ⇒ Boolean
107 108 109 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 107 def affiliate_emeritus? has_affiliation? 'AFFILIATE-TYPE-EMERITUS' end |
#affiliate_expiration_date ⇒ Object
219 220 221 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 219 def affiliate_expiration_date Date.parse(berkeleyEduAffExpDate.to_s) end |
#affiliate_expired? ⇒ Boolean
211 212 213 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 211 def affiliate_expired? has_affiliation? 'AFFILIATE-STATUS-EXPIRED' end |
#affiliate_hhmi_researcher? ⇒ Boolean
147 148 149 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 147 def affiliate_hhmi_researcher? has_affiliation? 'AFFILIATE-TYPE-HHMI RESEARCHER' end |
#affiliate_lbl_doe_postdoc? ⇒ Boolean
127 128 129 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 127 def affiliate_lbl_doe_postdoc? has_affiliation? 'AFFILIATE-TYPE-LBL/DOE POSTDOC' end |
#affiliate_lbl_op_staff? ⇒ Boolean
131 132 133 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 131 def affiliate_lbl_op_staff? has_affiliation? 'AFFILIATE-TYPE-LBLOP STAFF' end |
#affiliate_maintenance? ⇒ Boolean
175 176 177 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 175 def affiliate_maintenance? has_affiliation? 'AFFILIATE-TYPE-MAINTENANCE' end |
#affiliate_staff_affiliate? ⇒ Boolean
167 168 169 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 167 def affiliate_staff_affiliate? has_affiliation? 'AFFILIATE-TYPE-STAFF-AFFILIATE' end |
#affiliate_staff_retiree? ⇒ Boolean
103 104 105 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 103 def affiliate_staff_retiree? has_affiliation? 'AFFILIATE-TYPE-STAFF RETIREE' end |
#affiliate_temp_agency? ⇒ Boolean
155 156 157 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 155 def affiliate_temp_agency? has_affiliation? 'AFFILIATE-TYPE-TEMP AGENCY' end |
#affiliate_test? ⇒ Boolean
163 164 165 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 163 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.
119 120 121 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 119 def affiliate_visiting? has_affiliation? 'AFFILIATE-TYPE-VISITING' end |
#affiliate_volunteer? ⇒ Boolean
143 144 145 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 143 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
58 59 60 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 58 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 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 54 def employee_expiration_date Date.parse(berkeleyEduEmpExpDate.to_s) 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.
90 91 92 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 90 def student? has_affiliation_of_type?(:student) && !student_expired? end |
#student_expiration_date ⇒ Object
74 75 76 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 74 def student_expiration_date Date.parse(berkeleyEduStuExpDate.to_s) end |
#student_expired? ⇒ Boolean
Returns true
if is an expired student.
70 71 72 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 70 def student_expired? has_affiliation? 'STUDENT-STATUS-EXPIRED' end |
#student_not_registered? ⇒ Boolean
82 83 84 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 82 def student_not_registered? has_affiliation? 'STUDENT-TYPE-NOT REGISTERED' end |
#student_registered? ⇒ Boolean
78 79 80 |
# File 'lib/ucb_ldap/person/affiliation_methods.rb', line 78 def student_registered? has_affiliation? 'STUDENT-TYPE-REGISTERED' end |