diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-07-29 15:38:31 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-11-01 19:51:11 +0100 |
commit | a17c6a485d91bdc1c322a454c66d9d017a5f8ca5 (patch) | |
tree | 96b90220f17bfd7143b10051ab38c4f6e071d56d /lib/private/Share20/Manager.php | |
parent | 0a6f02801f333c17ca6455906bc816020883477d (diff) | |
download | nextcloud-server-a17c6a485d91bdc1c322a454c66d9d017a5f8ca5.tar.gz nextcloud-server-a17c6a485d91bdc1c322a454c66d9d017a5f8ca5.zip |
add share by mail share provider
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r-- | lib/private/Share20/Manager.php | 14 |
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 |