| @@ 370-385 (lines=16) @@ | ||
| 367 | * @param IUser $user |
|
| 368 | * @return array |
|
| 369 | */ |
|
| 370 | protected function userToPrincipal($user) { |
|
| 371 | $userId = $user->getUID(); |
|
| 372 | $displayName = $user->getDisplayName(); |
|
| 373 | $principal = [ |
|
| 374 | 'uri' => $this->principalPrefix . '/' . $userId, |
|
| 375 | '{DAV:}displayname' => is_null($displayName) ? $userId : $displayName, |
|
| 376 | '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL', |
|
| 377 | ]; |
|
| 378 | ||
| 379 | $email = $user->getEMailAddress(); |
|
| 380 | if (!empty($email)) { |
|
| 381 | $principal['{http://sabredav.org/ns}email-address'] = $email; |
|
| 382 | } |
|
| 383 | ||
| 384 | return $principal; |
|
| 385 | } |
|
| 386 | ||
| 387 | public function getPrincipalPrefix() { |
|
| 388 | return $this->principalPrefix; |
|
| @@ 308-324 (lines=17) @@ | ||
| 305 | * @param IUser $user |
|
| 306 | * @return array |
|
| 307 | */ |
|
| 308 | protected function userToPrincipal($user) { |
|
| 309 | $userId = $user->getUID(); |
|
| 310 | $displayName = $user->getDisplayName(); |
|
| 311 | ||
| 312 | $principal = [ |
|
| 313 | 'uri' => 'principals/users/' . $userId, |
|
| 314 | '{DAV:}displayname' => is_null($displayName) ? $userId : $displayName, |
|
| 315 | '{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL', |
|
| 316 | ]; |
|
| 317 | ||
| 318 | $email = $user->getEMailAddress(); |
|
| 319 | if (!empty($email)) { |
|
| 320 | $principal['{http://sabredav.org/ns}email-address'] = $email; |
|
| 321 | } |
|
| 322 | ||
| 323 | return $principal; |
|
| 324 | } |
|
| 325 | } |
|
| 326 | ||