]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(federation): Return the used userID to allow the inviting server to react to... 47195/head
authorJoas Schilling <coding@schilljs.com>
Tue, 13 Aug 2024 11:19:52 +0000 (13:19 +0200)
committerJoas Schilling <coding@schilljs.com>
Tue, 13 Aug 2024 12:30:16 +0000 (14:30 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
apps/cloud_federation_api/lib/ResponseDefinitions.php
apps/cloud_federation_api/openapi.json

index 02b8725afe205b44a9fdf0b7276c7bab990f4b3c..21c557354ff647f3bdd27d046335c7c8c157cfd5 100644 (file)
@@ -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);
        }
 
        /**
index d9a55e13e0758145d2e9fa16c3345478c04dbeb6..80195c541373b0f98ae81ebbf4595c6bb0a95635 100644 (file)
@@ -12,6 +12,7 @@ namespace OCA\CloudFederationAPI;
 /**
  * @psalm-type CloudFederationAPIAddShare = array{
  *     recipientDisplayName: string,
+ *     recipientUserId?: string,
  * }
  *
  * @psalm-type CloudFederationAPIError = array{
index a6e529d4f89ce5e4dfffcd3710d572c1e6f853ea..d15c7cef8130b755d56d629b1bf9f0d3be6ed5d5 100644 (file)
@@ -28,6 +28,9 @@
                 "properties": {
                     "recipientDisplayName": {
                         "type": "string"
+                    },
+                    "recipientUserId": {
+                        "type": "string"
                     }
                 }
             },