diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-13 21:48:53 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-01-13 21:56:04 +0100 |
commit | 4cc2230c58f0b607c1de51d34925450e3e7d25f2 (patch) | |
tree | 5c10fa863f3d0931dec99fe38056d08a87ce241c /lib | |
parent | d0a690fde46d1bba886e0a94a5e59c40f1e5c3b0 (diff) | |
download | nextcloud-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.php | 18 |
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; |