diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index 2b7f6bb95..c6fe039fc 100644 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -31,8 +31,6 @@ namespace OCA\Circles\Controller; -use OCA\Circles\Tools\Traits\TDeserialize; -use OCA\Circles\Tools\Traits\TNCLogger; use Exception; use OCA\Circles\Exceptions\ContactAddressBookNotFoundException; use OCA\Circles\Exceptions\ContactFormatException; @@ -52,6 +50,8 @@ use OCA\Circles\Service\MemberService; use OCA\Circles\Service\MembershipService; use OCA\Circles\Service\SearchService; +use OCA\Circles\Tools\Traits\TDeserialize; +use OCA\Circles\Tools\Traits\TNCLogger; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\OCS\OCSException; use OCP\AppFramework\OCSController; @@ -263,6 +263,7 @@ public function memberLevel(string $emulated, string $circleId, string $memberId * @param string $emulated * @param int $limit * @param int $offset + * * @return DataResponse * @throws OCSException */ @@ -482,9 +483,6 @@ public function editSetting(string $emulated, string $circleId, string $setting, } - - - /** * @param string $emulated * @param string $circleId @@ -543,6 +541,18 @@ public function link(string $emulated, string $circleId, string $singleId): Data private function setLocalFederatedUser(string $emulated): void { $user = $this->userSession->getUser(); $this->federatedUserService->setCurrentPatron($user->getUID()); + + if (strpos($emulated, '=') > 0) { + [$type, $id] = explode('=', $emulated, 2); + switch (strtolower($type)) { + case 'singleid': + $federatedUser = $this->federatedUserService->getFederatedUser($id, Member::TYPE_SINGLE); + $this->federatedUserService->setCurrentUser($federatedUser); + break; + } + + return; + } $this->federatedUserService->setLocalCurrentUserId($emulated); } }