summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 838650ada15..19d6151a037 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -185,6 +185,10 @@ class Manager implements IManager {
if ($share->getSharedWith() === null) {
throw new \InvalidArgumentException('SharedWith should not be empty');
}
+ } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ if ($share->getSharedWith() === null) {
+ throw new \InvalidArgumentException('SharedWith should not be empty');
+ }
} else {
// We can't handle other types yet
throw new \InvalidArgumentException('unkown share type');
@@ -580,6 +584,16 @@ class Manager implements IManager {
if ($share->getPassword() !== null) {
$share->setPassword($this->hasher->hash($share->getPassword()));
}
+ } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ $this->linkCreateChecks($share);
+ $share->setToken(
+ $this->secureRandom->generate(
+ \OC\Share\Constants::TOKEN_LENGTH,
+ \OCP\Security\ISecureRandom::CHAR_LOWER.
+ \OCP\Security\ISecureRandom::CHAR_UPPER.
+ \OCP\Security\ISecureRandom::CHAR_DIGITS
+ )
+ );
}
// Cannot share with the owner