diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-17 17:43:15 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-17 17:43:15 -0400 |
commit | 5b8658ca10168e37ca0161586b208d9b54681e7a (patch) | |
tree | d8836fb1e594fc3ce494fa998464ad44aa9ae67b /apps/files_sharing/lib_share.php | |
parent | 1c13b2681a7ba9a7f3db3e11e6e728411ade12ee (diff) | |
download | nextcloud-server-5b8658ca10168e37ca0161586b208d9b54681e7a.tar.gz nextcloud-server-5b8658ca10168e37ca0161586b208d9b54681e7a.zip |
New system of unsharing files from self, and a small bug fix when all files inside a shared folder are unshared from self
Diffstat (limited to 'apps/files_sharing/lib_share.php')
-rw-r--r-- | apps/files_sharing/lib_share.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index a4223a137d1..761a4da4394 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -199,7 +199,7 @@ class OC_Share { $folder .= "/"; } $length = strlen($folder); - $query = OC_DB::prepare("SELECT uid_owner, source, target FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? OR SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups()); + $query = OC_DB::prepare("SELECT uid_owner, source, target, permissions FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? OR SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups()); return $query->execute(array($length, $folder, $length, $folder))->fetchAll(); } @@ -362,10 +362,15 @@ class OC_Share { * * @param $target The target location of the item */ - public static function unshareFromMySelf($target) { + public static function unshareFromMySelf($target, $delete = true) { $target = self::cleanPath($target); - $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups()); - $query->execute(array(strlen($target), $target)); + if ($delete) { + $query = OC_DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups()); + $query->execute(array(strlen($target), $target)); + } else { + $query = OC_DB::prepare("UPDATE *PREFIX*sharing SET permissions = ? WHERE SUBSTR(target, 1, ?) = ? AND uid_shared_with ".self::getUsersAndGroups()); + $query->execute(array(-1, strlen($target), $target)); + } } /** |