blob: 0d1c54137de1ef0abf737ea5ad6d1f686cfcd8f3 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Adldap\Models\Concerns;
4
5trait HasUserProperties
6{
7 /**
8 * Returns the users country.
9 *
10 * @return string|null
11 */
12 public function getCountry()
13 {
14 return $this->getFirstAttribute($this->schema->country());
15 }
16
17 /**
18 * Sets the users country.
19 *
20 * @param string $country
21 *
22 * @return $this
23 */
24 public function setCountry($country)
25 {
26 return $this->setFirstAttribute($this->schema->country(), $country);
27 }
28
29 /**
30 * Returns the users department.
31 *
32 * @link https://msdn.microsoft.com/en-us/library/ms675490(v=vs.85).aspx
33 *
34 * @return string|null
35 */
36 public function getDepartment()
37 {
38 return $this->getFirstAttribute($this->schema->department());
39 }
40
41 /**
42 * Sets the users department.
43 *
44 * @param string $department
45 *
46 * @return $this
47 */
48 public function setDepartment($department)
49 {
50 return $this->setFirstAttribute($this->schema->department(), $department);
51 }
52
53 /**
54 * Returns the users email address.
55 *
56 * @link https://msdn.microsoft.com/en-us/library/ms676855(v=vs.85).aspx
57 *
58 * @return string|null
59 */
60 public function getEmail()
61 {
62 return $this->getFirstAttribute($this->schema->email());
63 }
64
65 /**
66 * Sets the users email.
67 *
68 * Keep in mind this will remove all other
69 * email addresses the user currently has.
70 *
71 * @param string $email
72 *
73 * @return $this
74 */
75 public function setEmail($email)
76 {
77 return $this->setFirstAttribute($this->schema->email(), $email);
78 }
79
80 /**
81 * Returns the users facsimile number.
82 *
83 * @link https://msdn.microsoft.com/en-us/library/ms675675(v=vs.85).aspx
84 *
85 * @return string|null
86 */
87 public function getFacsimileNumber()
88 {
89 return $this->getFirstAttribute($this->schema->facsimile());
90 }
91
92 /**
93 * Sets the users facsimile number.
94 *
95 * @param string $number
96 *
97 * @return $this
98 */
99 public function setFacsimileNumber($number)
100 {
101 return $this->setFirstAttribute($this->schema->facsimile(), $number);
102 }
103
104 /**
105 * Returns the users first name.
106 *
107 * @link https://msdn.microsoft.com/en-us/library/ms675719(v=vs.85).aspx
108 *
109 * @return string|null
110 */
111 public function getFirstName()
112 {
113 return $this->getFirstAttribute($this->schema->firstName());
114 }
115
116 /**
117 * Sets the users first name.
118 *
119 * @param string $firstName
120 *
121 * @return $this
122 */
123 public function setFirstName($firstName)
124 {
125 return $this->setFirstAttribute($this->schema->firstName(), $firstName);
126 }
127
128 /**
129 * Returns the users initials.
130 *
131 * @return string|null
132 */
133 public function getInitials()
134 {
135 return $this->getFirstAttribute($this->schema->initials());
136 }
137
138 /**
139 * Sets the users initials.
140 *
141 * @param string $initials
142 *
143 * @return $this
144 */
145 public function setInitials($initials)
146 {
147 return $this->setFirstAttribute($this->schema->initials(), $initials);
148 }
149
150 /**
151 * Returns the users IP Phone.
152 *
153 * @return string|null
154 */
155 public function getIpPhone()
156 {
157 return $this->getFirstAttribute($this->schema->ipPhone());
158 }
159
160 /**
161 * Sets the users IP phone.
162 *
163 * @param string $ip
164 *
165 * @return $this
166 */
167 public function setIpPhone($ip)
168 {
169 return $this->setFirstAttribute($this->schema->ipPhone(), $ip);
170 }
171
172 /**
173 * Returns the users last name.
174 *
175 * @link https://msdn.microsoft.com/en-us/library/ms679872(v=vs.85).aspx
176 *
177 * @return string|null
178 */
179 public function getLastName()
180 {
181 return $this->getFirstAttribute($this->schema->lastName());
182 }
183
184 /**
185 * Sets the users last name.
186 *
187 * @param string $lastName
188 *
189 * @return $this
190 */
191 public function setLastName($lastName)
192 {
193 return $this->setFirstAttribute($this->schema->lastName(), $lastName);
194 }
195
196 /**
197 * Returns the users postal code.
198 *
199 * @return string|null
200 */
201 public function getPostalCode()
202 {
203 return $this->getFirstAttribute($this->schema->postalCode());
204 }
205
206 /**
207 * Sets the users postal code.
208 *
209 * @param string $postalCode
210 *
211 * @return $this
212 */
213 public function setPostalCode($postalCode)
214 {
215 return $this->setFirstAttribute($this->schema->postalCode(), $postalCode);
216 }
217
218 /**
219 * Get the users post office box.
220 *
221 * @return string|null
222 */
223 public function getPostOfficeBox()
224 {
225 return $this->getFirstAttribute($this->schema->postOfficeBox());
226 }
227
228 /**
229 * Sets the users post office box.
230 *
231 * @param string|int $box
232 *
233 * @return $this
234 */
235 public function setPostOfficeBox($box)
236 {
237 return $this->setFirstAttribute($this->schema->postOfficeBox(), $box);
238 }
239
240 /**
241 * Sets the users proxy addresses.
242 *
243 * This will remove all proxy addresses on the user and insert the specified addresses.
244 *
245 * @link https://msdn.microsoft.com/en-us/library/ms679424(v=vs.85).aspx
246 *
247 * @param array $addresses
248 *
249 * @return $this
250 */
251 public function setProxyAddresses(array $addresses = [])
252 {
253 return $this->setAttribute($this->schema->proxyAddresses(), $addresses);
254 }
255
256 /**
257 * Add's a single proxy address to the user.
258 *
259 * @param string $address
260 *
261 * @return $this
262 */
263 public function addProxyAddress($address)
264 {
265 $addresses = $this->getProxyAddresses();
266
267 $addresses[] = $address;
268
269 return $this->setAttribute($this->schema->proxyAddresses(), $addresses);
270 }
271
272 /**
273 * Returns the users proxy addresses.
274 *
275 * @link https://msdn.microsoft.com/en-us/library/ms679424(v=vs.85).aspx
276 *
277 * @return array
278 */
279 public function getProxyAddresses()
280 {
281 return $this->getAttribute($this->schema->proxyAddresses()) ?? [];
282 }
283
284 /**
285 * Returns the users street address.
286 *
287 * @return string|null
288 */
289 public function getStreetAddress()
290 {
291 return $this->getFirstAttribute($this->schema->streetAddress());
292 }
293
294 /**
295 * Sets the users street address.
296 *
297 * @param string $address
298 *
299 * @return $this
300 */
301 public function setStreetAddress($address)
302 {
303 return $this->setFirstAttribute($this->schema->streetAddress(), $address);
304 }
305
306 /**
307 * Returns the users title.
308 *
309 * @link https://msdn.microsoft.com/en-us/library/ms680037(v=vs.85).aspx
310 *
311 * @return string|null
312 */
313 public function getTitle()
314 {
315 return $this->getFirstAttribute($this->schema->title());
316 }
317
318 /**
319 * Sets the users title.
320 *
321 * @param string $title
322 *
323 * @return $this
324 */
325 public function setTitle($title)
326 {
327 return $this->setFirstAttribute($this->schema->title(), $title);
328 }
329
330 /**
331 * Returns the users telephone number.
332 *
333 * @link https://msdn.microsoft.com/en-us/library/ms680027(v=vs.85).aspx
334 *
335 * @return string|null
336 */
337 public function getTelephoneNumber()
338 {
339 return $this->getFirstAttribute($this->schema->telephone());
340 }
341
342 /**
343 * Sets the users telephone number.
344 *
345 * @param string $number
346 *
347 * @return $this
348 */
349 public function setTelephoneNumber($number)
350 {
351 return $this->setFirstAttribute($this->schema->telephone(), $number);
352 }
353
354 /**
355 * Returns the users primary mobile phone number.
356 *
357 * @return string|null
358 */
359 public function getMobileNumber()
360 {
361 return $this->getFirstAttribute($this->schema->mobile());
362 }
363
364 /**
365 * Sets the users primary mobile phone number.
366 *
367 * @param string $number
368 *
369 * @return $this
370 */
371 public function setMobileNumber($number)
372 {
373 return $this->setFirstAttribute($this->schema->mobile(), $number);
374 }
375
376 /**
377 * Returns the users secondary (other) mobile phone number.
378 *
379 * @return string|null
380 */
381 public function getOtherMobileNumber()
382 {
383 return $this->getFirstAttribute($this->schema->otherMobile());
384 }
385
386 /**
387 * Sets the users secondary (other) mobile phone number.
388 *
389 * @param string $number
390 *
391 * @return $this
392 */
393 public function setOtherMobileNumber($number)
394 {
395 return $this->setFirstAttribute($this->schema->otherMobile(), $number);
396 }
397
398 /**
399 * Returns the users other mailbox attribute.
400 *
401 * @link https://msdn.microsoft.com/en-us/library/ms679091(v=vs.85).aspx
402 *
403 * @return array
404 */
405 public function getOtherMailbox()
406 {
407 return $this->getAttribute($this->schema->otherMailbox());
408 }
409
410 /**
411 * Sets the users other mailboxes.
412 *
413 * @param array $otherMailbox
414 *
415 * @return $this
416 */
417 public function setOtherMailbox($otherMailbox = [])
418 {
419 return $this->setAttribute($this->schema->otherMailbox(), $otherMailbox);
420 }
421
422 /**
423 * Returns the distinguished name of the user who is the user's manager.
424 *
425 * @return string|null
426 */
427 public function getManager()
428 {
429 return $this->getFirstAttribute($this->schema->manager());
430 }
431
432 /**
433 * Sets the distinguished name of the user who is the user's manager.
434 *
435 * @param string $managerDn
436 *
437 * @return $this
438 */
439 public function setManager($managerDn)
440 {
441 return $this->setFirstAttribute($this->schema->manager(), $managerDn);
442 }
443
444 /**
445 * Returns the users mail nickname.
446 *
447 * @return string|null
448 */
449 public function getMailNickname()
450 {
451 return $this->getFirstAttribute($this->schema->emailNickname());
452 }
453}