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/Service
parentc145b5e4beb4f7ff34e5ebe230b8683ba19d6ca5 (diff)
set email address in external share
Diffstat (limited to 'lib/Service')
-rw-r--r--lib/Service/ShareService.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Service/ShareService.php b/lib/Service/ShareService.php
index 1bd9bcb8..aaddefb8 100644
--- a/lib/Service/ShareService.php
+++ b/lib/Service/ShareService.php
@@ -26,6 +26,7 @@ namespace OCA\Polls\Service;
use Exception;
use OCA\Polls\Exceptions\NotAuthorizedException;
use OCA\Polls\Exceptions\InvalidUsername;
+use OCA\Polls\Exceptions\InvalidShareType;
use OCP\Security\ISecureRandom;
@@ -132,6 +133,28 @@ class ShareService {
}
/**
+ * Set emailAddress to personal share
+ * or update an email share with the username
+ * @NoAdminRequired
+ * @param string $token
+ * @param string $emailAddress
+ * @return Share
+ * @throws NotAuthorizedException
+ */
+ public function setEmailAddress($token, $emailAddress) {
+
+ $this->share = $this->shareMapper->findByToken($token);
+ if ($this->share->getType() === 'external') {
+ // TODO: Simple validate email address
+ $this->share->setUserEmail($emailAddress);
+ // TODO: Send confirmation
+ return $this->shareMapper->update($this->share);
+ } else {
+ throw new InvalidShareType('Email address can only be set in external shares.');
+ }
+ }
+
+ /**
* Create a personal share from a public share
* or update an email share with the username
* @NoAdminRequired