summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Hülsmann <fh@cbix.de>2012-10-26 20:53:32 +0200
committerFlorian Hülsmann <fh@cbix.de>2012-10-26 20:53:32 +0200
commitb7bf28d1c72cbd51ae53e0528f593e0d4c6bf743 (patch)
tree2856c1a67cea588505369655fd3eca0839905d98
parentda57fbc93a6df7f477bf680f1a97c1b43075f3b5 (diff)
downloadnextcloud-server-b7bf28d1c72cbd51ae53e0528f593e0d4c6bf743.tar.gz
nextcloud-server-b7bf28d1c72cbd51ae53e0528f593e0d4c6bf743.zip
Hook emission on sharing stuff
-rw-r--r--lib/public/share.php31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index d27802b52f7..7a9a087d1bd 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -28,6 +28,9 @@ namespace OCP;
/**
* This class provides the ability for apps to share their content between users.
* Apps must create a backend class that implements OCP\Share_Backend and register it with this class.
+*
+* It provides the following hooks:
+* - post_shared
*/
class Share {
@@ -937,7 +940,20 @@ class Share {
// Insert an extra row for the group share if the item or file target is unique for this user
if ($itemTarget != $groupItemTarget || (isset($fileSource) && $fileTarget != $groupFileTarget)) {
$query->execute(array($itemType, $itemSource, $itemTarget, $parent, self::$shareTypeGroupUserUnique, $uid, $uidOwner, $permissions, time(), $fileSource, $fileTarget));
- \OC_DB::insertid('*PREFIX*share');
+ $id = \OC_DB::insertid('*PREFIX*share');
+ \OC_Hook::emit('OCP\Share', 'post_shared', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'itemTarget' => $itemTarget,
+ 'parent' => $parent,
+ 'shareType' => self::$shareTypeGroupUserUnique,
+ 'shareWith' => $uid,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'fileTarget' => $fileTarget,
+ 'id' => $id
+ ));
}
}
if ($parentFolder === true) {
@@ -963,6 +979,19 @@ class Share {
}
$query->execute(array($itemType, $itemSource, $itemTarget, $parent, $shareType, $shareWith, $uidOwner, $permissions, time(), $fileSource, $fileTarget));
$id = \OC_DB::insertid('*PREFIX*share');
+ \OC_Hook::emit('OCP\Share', 'post_shared', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'itemTarget' => $itemTarget,
+ 'parent' => $parent,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith,
+ 'uidOwner' => $uidOwner,
+ 'permissions' => $permissions,
+ 'fileSource' => $fileSource,
+ 'fileTarget' => $fileTarget,
+ 'id' => $id
+ ));
if ($parentFolder === true) {
$parentFolders['id'] = $id;
// Return parent folder to preserve file target paths for potential children