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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-08-02 11:24:14 +0300
committerdartcafe <github@dartcafe.de>2020-08-02 11:24:14 +0300
commitdb579c72b6315944e6e6b2170acc17f973f8e7f8 (patch)
treef234818502cd8a1983189be2f5fa239bd1ffccd5 /lib/Controller
parentc145b5e4beb4f7ff34e5ebe230b8683ba19d6ca5 (diff)
set email address in external share
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ShareController.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Controller/ShareController.php b/lib/Controller/ShareController.php
index 4810ed23..9cd5f554 100644
--- a/lib/Controller/ShareController.php
+++ b/lib/Controller/ShareController.php
@@ -27,6 +27,7 @@ use Exception;
use OCP\AppFramework\Db\DoesNotExistException;
use OCA\Polls\Exceptions\NotAuthorizedException;
use OCA\Polls\Exceptions\InvalidUsername;
+use OCA\Polls\Exceptions\InvalidShareType;
use OCP\IRequest;
@@ -84,6 +85,28 @@ class ShareController extends Controller {
}
/**
+ * Add share
+ * @NoAdminRequired
+ * @param int $pollId
+ * @param int $pollId
+ * @param string $type
+ * @param string $userId
+ * @param string $userEmail
+ * @return DataResponse
+ */
+ public function setEmailAddress($token, $userEmail) {
+ try {
+ return new DataResponse(['share' => $this->shareService->setEmailAddress($token, $userEmail)], Http::STATUS_OK);
+ } catch (NotAuthorizedException $e) {
+ return new DataResponse(['error' => $e->getMessage()], $e->getStatus());
+ } catch (InvalidShareType $e) {
+ return new DataResponse(['error' => $e->getMessage()], $e->getStatus());
+ } catch (\Exception $e) {
+ return new DataResponse($e, Http::STATUS_CONFLICT);
+ }
+ }
+
+ /**
* Create a personal share from a public share
* or update an email share with the username
* @NoAdminRequired