mirror of
https://github.com/nextcloud/server.git
synced 2024-07-30 20:16:04 +02:00
make sure that we only delete shares for the current user
This commit is contained in:
parent
eec1c4398a
commit
3459f99dd6
@ -718,6 +718,8 @@ class Share extends \OC\Share\Constants {
|
|||||||
*/
|
*/
|
||||||
public static function unshareFromSelf($itemType, $itemTarget) {
|
public static function unshareFromSelf($itemType, $itemTarget) {
|
||||||
|
|
||||||
|
$uid = \OCP\User::getUser();
|
||||||
|
|
||||||
if ($itemType === 'file' || $itemType === 'folder') {
|
if ($itemType === 'file' || $itemType === 'folder') {
|
||||||
$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_target` = ?';
|
$statement = 'SELECT * FROM `*PREFIX*share` WHERE `item_type` = ? and `file_target` = ?';
|
||||||
} else {
|
} else {
|
||||||
@ -732,13 +734,16 @@ class Share extends \OC\Share\Constants {
|
|||||||
$itemUnshared = false;
|
$itemUnshared = false;
|
||||||
foreach ($shares as $share) {
|
foreach ($shares as $share) {
|
||||||
if ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_USER &&
|
if ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_USER &&
|
||||||
$share['share_with'] === \OCP\User::getUser()) {
|
$share['share_with'] === $uid) {
|
||||||
Helper::delete($share['id']);
|
Helper::delete($share['id']);
|
||||||
$itemUnshared = true;
|
$itemUnshared = true;
|
||||||
break;
|
break;
|
||||||
} elseif ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
|
} elseif ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) {
|
||||||
$groupShare = $share;
|
if (\OC_Group::inGroup($uid, $share['share_with'])) {
|
||||||
} elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique) {
|
$groupShare = $share;
|
||||||
|
}
|
||||||
|
} elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique &&
|
||||||
|
$share['share_with'] === $uid) {
|
||||||
$uniqueGroupShare = $share;
|
$uniqueGroupShare = $share;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user