summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-07-24 15:34:45 +0200
committerGitHub <noreply@github.com>2018-07-24 15:34:45 +0200
commitd67e18b28e35ce395fafa5f37f19f50965fc7dd5 (patch)
tree64790fafb2d10443443e08cbdcc7438b834bdd66
parent0280245fdddc0881d58cd9ec0ecb406e9ff94396 (diff)
parentb7474ed482689686b334b4c628279b7484caf78f (diff)
downloadnextcloud-server-d67e18b28e35ce395fafa5f37f19f50965fc7dd5.tar.gz
nextcloud-server-d67e18b28e35ce395fafa5f37f19f50965fc7dd5.zip
Merge pull request #10348 from nextcloud/fix-transfering-ownership-of-a-share-to-user-with-same-id-as-receiver
Fix transfering ownership of a share to user with same id as receiver
-rw-r--r--apps/files/lib/Command/TransferOwnership.php3
-rw-r--r--build/integration/features/transfer-ownership.feature13
2 files changed, 15 insertions, 1 deletions
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index d175f66d171..6113f6df54c 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -263,7 +263,8 @@ class TransferOwnership extends Command {
foreach($this->shares as $share) {
try {
- if ($share->getSharedWith() === $this->destinationUser) {
+ if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER &&
+ $share->getSharedWith() === $this->destinationUser) {
// Unmount the shares before deleting, so we don't try to get the storage later on.
$shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget());
if ($shareMountPoint) {
diff --git a/build/integration/features/transfer-ownership.feature b/build/integration/features/transfer-ownership.feature
index 7990eac3280..3f10fa75a83 100644
--- a/build/integration/features/transfer-ownership.feature
+++ b/build/integration/features/transfer-ownership.feature
@@ -72,6 +72,19 @@ Feature: transfer-ownership
And As an "user2"
Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is"
+ Scenario: transfering ownership of file shares to user with the same id as the group
+ Given user "user0" exists
+ And user "test" exists
+ And user "user2" exists
+ And group "test" exists
+ And user "user2" belongs to group "test"
+ And User "user0" uploads file "data/textfile.txt" to "/somefile.txt"
+ And file "/somefile.txt" of user "user0" is shared with group "test"
+ When transfering ownership from "user0" to "test"
+ And the command was successful
+ And As an "user2"
+ Then Downloaded content when downloading file "/somefile.txt" with range "bytes=0-6" should be "This is"
+
Scenario: transfering ownership does not transfer received shares
Given user "user0" exists
And user "user1" exists