summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 21:48:53 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 21:56:04 +0100
commit4cc2230c58f0b607c1de51d34925450e3e7d25f2 (patch)
tree5c10fa863f3d0931dec99fe38056d08a87ce241c /lib
parentd0a690fde46d1bba886e0a94a5e59c40f1e5c3b0 (diff)
downloadnextcloud-server-4cc2230c58f0b607c1de51d34925450e3e7d25f2.tar.gz
nextcloud-server-4cc2230c58f0b607c1de51d34925450e3e7d25f2.zip
[Share 2.0] Fix pre_share and post_share hooks
Diffstat (limited to 'lib')
-rw-r--r--lib/private/share20/manager.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 0c6f9cb59db..035026b47ea 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -452,6 +452,16 @@ class Manager {
$target = \OC\Files\Filesystem::normalizePath($target);
$share->setTarget($target);
+ //Get sharewith for hooks
+ $sharedWith = null;
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
+ $sharedWith = $share->getSharedWith()->getUID();
+ } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
+ $sharedWith = $share->getSharedWith()->getGID();
+ } else {
+ $sharedWith = $share->getSharedWith();
+ }
+
// Pre share hook
$run = true;
$error = '';
@@ -464,8 +474,10 @@ class Manager {
'fileSource' => $share->getPath()->getId(),
'expiration' => $share->getExpirationDate(),
'token' => $share->getToken(),
+ 'itemTarget' => $share->getTarget(),
+ 'shareWith' => $sharedWith,
'run' => &$run,
- 'error' => &$error
+ 'error' => &$error,
];
\OC_Hook::emit('OCP\Share', 'pre_shared', $preHookData);
@@ -488,7 +500,11 @@ class Manager {
'expiration' => $share->getExpirationDate(),
'token' => $share->getToken(),
'id' => $share->getId(),
+ 'shareWith' => $sharedWith,
+ 'itemTarget' => $share->getTarget(),
+ 'fileTarget' => $share->getTarget(),
];
+
\OC_Hook::emit('OCP\Share', 'post_shared', $postHookData);
return $share;