* @return Returns true on success or false on failure
*/
public static function unshare($itemType, $itemSource, $shareType, $shareWith) {
- $item = self::getItems($itemType,
- $itemSource,
- $shareType,
- $shareWith,
- \OC_User::getUser(),
- self::FORMAT_NONE,
- null,
- 1);
- if ($item) {
+ if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith, \OC_User::getUser(), self::FORMAT_NONE, null, 1)) {
+ // Pass all the vars we have for now, they may be useful
+ \OC_Hook::emit('OCP\Share', 'pre_unshare', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shareType' => $shareType,
+ 'shareWith' => $shareWith,
- ));
++ ));
self::delete($item['id']);
return true;
}
* @return Returns true on success or false on failure
*/
public static function unshareAll($itemType, $itemSource) {
- $shares = self::getItemShared($itemType, $itemSource);
- if ($shares) {
+ if ($shares = self::getItemShared($itemType, $itemSource)) {
+ // Pass all the vars we have for now, they may be useful
+ \OC_Hook::emit('OCP\Share', 'pre_unshareAll', array(
+ 'itemType' => $itemType,
+ 'itemSource' => $itemSource,
+ 'shares' => $shares
- ));
++ ));
foreach ($shares as $share) {
self::delete($share['id']);
}
continue;
}
}
- if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {\r
- $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);\r
+
+ // Add display names to result
+ if ( isset($row['share_with']) && $row['share_with'] != '') {
+ $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']);
+ }
++ if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
++ $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']);
+ }
+
$items[$row['id']] = $row;
}
if (!empty($items)) {