From 89546bf90c5d567ed8b63c949f07ba312afa73a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B6rn=20Schie=C3=9Fle?= Date: Fri, 24 May 2013 13:26:03 +0200 Subject: [PATCH] add post hooks to share API, needed by the encryption app --- lib/public/share.php | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/public/share.php b/lib/public/share.php index 7cebf654639..d98b2678d64 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -1203,8 +1203,18 @@ class Share { .' `file_target`, `token`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)'); // Share with a group if ($shareType == self::SHARE_TYPE_GROUP) { - $groupItemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], - $uidOwner, $suggestedItemTarget); + $groupItemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith['group'], $uidOwner, $suggestedItemTarget); + \OC_Hook::emit('OCP\Share', 'pre_shared', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'itemTarget' => $groupItemTarget, + 'shareType' => $shareType, + 'shareWith' => $shareWith['group'], + 'uidOwner' => $uidOwner, + 'permissions' => $permissions, + 'fileSource' => $fileSource, + 'token' => $token + )); if (isset($fileSource)) { if ($parentFolder) { if ($parentFolder === true) { @@ -1265,7 +1275,7 @@ class Share { 'itemTarget' => $groupItemTarget, 'parent' => $parent, 'shareType' => $shareType, - 'shareWith' => $uid, + 'shareWith' => $shareWith['group'], 'uidOwner' => $uidOwner, 'permissions' => $permissions, 'fileSource' => $fileSource, @@ -1278,8 +1288,18 @@ class Share { return $parentFolders; } } else { - $itemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, - $suggestedItemTarget); + $itemTarget = self::generateTarget($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $suggestedItemTarget); + \OC_Hook::emit('OCP\Share', 'pre_shared', array( + 'itemType' => $itemType, + 'itemSource' => $itemSource, + 'itemTarget' => $itemTarget, + 'shareType' => $shareType, + 'shareWith' => $shareWith, + 'uidOwner' => $uidOwner, + 'permissions' => $permissions, + 'fileSource' => $fileSource, + 'token' => $token + )); if (isset($fileSource)) { if ($parentFolder) { if ($parentFolder === true) { -- 2.39.5