Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2018-05-09 18:06:35 +0300
committerBjoern Schiessle <bjoern@schiessle.org>2018-07-02 12:29:27 +0300
commitdb428ea5471a5be5517911b3bf2f3a6d3f86e297 (patch)
tree3921525a302150e75d968a47dff14be79f9ffa3b /apps/cloud_federation_api
parenta3948e8a126d6f84629841c8886fe0819ab04ad5 (diff)
send accept share notification (WIP)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/cloud_federation_api')
-rw-r--r--apps/cloud_federation_api/lib/Controller/RequestHandlerController.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
index 4f16c369a2f..319380ec3c3 100644
--- a/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
+++ b/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php
@@ -27,6 +27,7 @@ use OCA\CloudFederationAPI\Config;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
+use OCP\Federation\Exceptions\ActionNotSupportedException;
use OCP\Federation\Exceptions\ProviderCouldNotAddShareException;
use OCP\Federation\Exceptions\ShareNotFoundException;
use OCP\Federation\ICloudFederationFactory;
@@ -190,13 +191,12 @@ class RequestHandlerController extends Controller {
/**
* receive notification about existing share
*
- * @param $resourceType ('file', 'calendar',...)
- * @param string $name resource name (e.g "file", "calendar",...)
- * @param string $id unique id of the corresponding item on the receiving site
- * @param array $notification contain the actual notification, content is defined by cloud federation provider
+ * @param string $notificationType (notification type, e.g. SHARE_ACCEPTED)
+ * @param string $resourceType (calendar, file, contact,...)
+ * @param array $message contain the actual notification, content is defined by cloud federation provider
* @return JSONResponse
*/
- public function receiveNotification($resourceType, $name, $id, $notification) {
+ public function receiveNotification($notificationType, $resourceType, $message) {
if (!$this->config->incomingRequestsEnabled()) {
return new JSONResponse(
['message' => 'This server doesn\'t support outgoing federated shares'],
@@ -205,9 +205,9 @@ class RequestHandlerController extends Controller {
}
// check if all required parameters are set
- if ($name === null ||
- $id === null ||
- !is_array($notification)
+ if ($notificationType === null ||
+ $resourceType === null ||
+ !is_array($message)
) {
return new JSONResponse(
['message' => 'Missing arguments'],
@@ -217,7 +217,7 @@ class RequestHandlerController extends Controller {
try {
$provider = $this->cloudFederationProviderManager->getCloudFederationProvider($resourceType);
- $provider->notificationReceived($id, $notification);
+ $provider->notificationReceived($notificationType, $message);
} catch (ProviderDoesNotExistsException $e) {
return new JSONResponse(
['message' => $e->getMessage()],
@@ -228,6 +228,11 @@ class RequestHandlerController extends Controller {
['message' => $e->getMessage()],
Http::STATUS_BAD_REQUEST
);
+ } catch (ActionNotSupportedException $e) {
+ return new JSONResponse(
+ ['message' => $e->getMessage()],
+ Http::STATUS_NOT_IMPLEMENTED
+ );
} catch (\Exception $e) {
return new JSONResponse(
['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],