diff options
author | Joas Schilling <coding@schilljs.com> | 2024-08-13 13:19:52 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-08-13 14:30:16 +0200 |
commit | 15a530008fd8b2d980f2c459019d0e439629669d (patch) | |
tree | b6d80fc9126c8ee0e69aa56104ed8c8679f59649 | |
parent | cee227ae993f02cf0c72ebcb103db4223b1b07a8 (diff) | |
download | nextcloud-server-15a530008fd8b2d980f2c459019d0e439629669d.tar.gz nextcloud-server-15a530008fd8b2d980f2c459019d0e439629669d.zip |
fix(federation): Return the used userID to allow the inviting server to react to the famous `mapUid` result
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | apps/cloud_federation_api/lib/Controller/RequestHandlerController.php | 17 | ||||
-rw-r--r-- | apps/cloud_federation_api/lib/ResponseDefinitions.php | 1 | ||||
-rw-r--r-- | apps/cloud_federation_api/openapi.json | 3 |
3 files changed, 14 insertions, 7 deletions
diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php index 02b8725afe2..21c557354ff 100644 --- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php +++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php @@ -173,15 +173,18 @@ class RequestHandlerController extends Controller { ); } - $user = $this->userManager->get($shareWith); - $recipientDisplayName = ''; - if ($user) { - $recipientDisplayName = $user->getDisplayName(); + $responseData = ['recipientDisplayName' => '']; + if ($shareType === 'user') { + $user = $this->userManager->get($shareWith); + if ($user) { + $responseData = [ + 'recipientDisplayName' => $user->getDisplayName(), + 'recipientUserId' => $user->getUID(), + ]; + } } - return new JSONResponse( - ['recipientDisplayName' => $recipientDisplayName], - Http::STATUS_CREATED); + return new JSONResponse($responseData, Http::STATUS_CREATED); } /** diff --git a/apps/cloud_federation_api/lib/ResponseDefinitions.php b/apps/cloud_federation_api/lib/ResponseDefinitions.php index d9a55e13e07..80195c54137 100644 --- a/apps/cloud_federation_api/lib/ResponseDefinitions.php +++ b/apps/cloud_federation_api/lib/ResponseDefinitions.php @@ -12,6 +12,7 @@ namespace OCA\CloudFederationAPI; /** * @psalm-type CloudFederationAPIAddShare = array{ * recipientDisplayName: string, + * recipientUserId?: string, * } * * @psalm-type CloudFederationAPIError = array{ diff --git a/apps/cloud_federation_api/openapi.json b/apps/cloud_federation_api/openapi.json index a6e529d4f89..d15c7cef813 100644 --- a/apps/cloud_federation_api/openapi.json +++ b/apps/cloud_federation_api/openapi.json @@ -28,6 +28,9 @@ "properties": { "recipientDisplayName": { "type": "string" + }, + "recipientUserId": { + "type": "string" } } }, |