|
31 | 31 |
|
32 | 32 | namespace OCA\Circles\Controller; |
33 | 33 |
|
34 | | -use OCA\Circles\Tools\Traits\TDeserialize; |
35 | | -use OCA\Circles\Tools\Traits\TNCLogger; |
36 | 34 | use Exception; |
37 | 35 | use OCA\Circles\Exceptions\ContactAddressBookNotFoundException; |
38 | 36 | use OCA\Circles\Exceptions\ContactFormatException; |
|
52 | 50 | use OCA\Circles\Service\MemberService; |
53 | 51 | use OCA\Circles\Service\MembershipService; |
54 | 52 | use OCA\Circles\Service\SearchService; |
| 53 | +use OCA\Circles\Tools\Traits\TDeserialize; |
| 54 | +use OCA\Circles\Tools\Traits\TNCLogger; |
55 | 55 | use OCP\AppFramework\Http\DataResponse; |
56 | 56 | use OCP\AppFramework\OCS\OCSException; |
57 | 57 | use OCP\AppFramework\OCSController; |
@@ -263,6 +263,7 @@ public function memberLevel(string $emulated, string $circleId, string $memberId |
263 | 263 | * @param string $emulated |
264 | 264 | * @param int $limit |
265 | 265 | * @param int $offset |
| 266 | + * |
266 | 267 | * @return DataResponse |
267 | 268 | * @throws OCSException |
268 | 269 | */ |
@@ -482,9 +483,6 @@ public function editSetting(string $emulated, string $circleId, string $setting, |
482 | 483 | } |
483 | 484 |
|
484 | 485 |
|
485 | | - |
486 | | - |
487 | | - |
488 | 486 | /** |
489 | 487 | * @param string $emulated |
490 | 488 | * @param string $circleId |
@@ -543,6 +541,18 @@ public function link(string $emulated, string $circleId, string $singleId): Data |
543 | 541 | private function setLocalFederatedUser(string $emulated): void { |
544 | 542 | $user = $this->userSession->getUser(); |
545 | 543 | $this->federatedUserService->setCurrentPatron($user->getUID()); |
| 544 | + |
| 545 | + if (strpos($emulated, '=') > 0) { |
| 546 | + [$type, $id] = explode('=', $emulated, 2); |
| 547 | + switch (strtolower($type)) { |
| 548 | + case 'singleid': |
| 549 | + $federatedUser = $this->federatedUserService->getFederatedUser($id, Member::TYPE_SINGLE); |
| 550 | + $this->federatedUserService->setCurrentUser($federatedUser); |
| 551 | + break; |
| 552 | + } |
| 553 | + |
| 554 | + return; |
| 555 | + } |
546 | 556 | $this->federatedUserService->setLocalCurrentUserId($emulated); |
547 | 557 | } |
548 | 558 | } |
0 commit comments