Browse Source

make sure that we only find the shares from the correct share type if users and groups with the same ID exists

tags/v8.0.0alpha1
Bjoern Schiessle 9 years ago
parent
commit
367468ff1f
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      lib/private/share/share.php

+ 8
- 2
lib/private/share/share.php View File

@@ -288,9 +288,10 @@ class Share extends \OC\Share\Constants {
* @param string $itemType
* @param string $itemSource
* @param string $user User user to whom the item was shared
* @param int $shareType only look for a specific share type
* @return array Return list of items with file_target, permissions and expiration
*/
public static function getItemSharedWithUser($itemType, $itemSource, $user) {
public static function getItemSharedWithUser($itemType, $itemSource, $user, $shareType = null) {

$shares = array();
$fileDependend = false;
@@ -314,6 +315,11 @@ class Share extends \OC\Share\Constants {
$arguments[] = $user;
}

if ($shareType !== null) {
$where .= ' AND `share_type` = ? ';
$arguments[] = $shareType;
}

$query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $where);

$result = \OC_DB::executeAudited($query, $arguments);
@@ -697,7 +703,7 @@ class Share extends \OC\Share\Constants {
// check if it is a valid itemType
self::getBackend($itemType);

$items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith);
$items = self::getItemSharedWithUser($itemType, $itemSource, $shareWith, $shareType);

$toDelete = array();
$newParent = null;

Loading…
Cancel
Save