aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2024-08-13 15:15:47 +0200
committerGitHub <noreply@github.com>2024-08-13 15:15:47 +0200
commitc319325f827d55dbc0d99ad67810999ec1fd5c7d (patch)
treeae527ad24d44cd2789c38d0f56409bad514a91d6 /apps
parentc525ea0a8098e98e4b4871900918421ae1085688 (diff)
parent15a530008fd8b2d980f2c459019d0e439629669d (diff)
downloadnextcloud-server-c319325f827d55dbc0d99ad67810999ec1fd5c7d.tar.gz
nextcloud-server-c319325f827d55dbc0d99ad67810999ec1fd5c7d.zip
Merge pull request #47195 from nextcloud/bugfix/noid/return-correct-userid-on-fed-invites
fix(federation): Return the used userID to allow the inviting server …
Diffstat (limited to 'apps')
-rw-r--r--apps/cloud_federation_api/lib/Controller/RequestHandlerController.php17
-rw-r--r--apps/cloud_federation_api/lib/ResponseDefinitions.php1
-rw-r--r--apps/cloud_federation_api/openapi.json3
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"
}
}
},