Skip to content

Commit

Permalink
Merge pull request #10348 from nextcloud/fix-transfering-ownership-of…
Browse files Browse the repository at this point in the history
…-a-share-to-user-with-same-id-as-receiver

Fix transfering ownership of a share to user with same id as receiver
  • Loading branch information
MorrisJobke committed Jul 24, 2018
2 parents 0280245 + b7474ed commit d67e18b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/files/lib/Command/TransferOwnership.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ private function restoreShares(OutputInterface $output) {

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) {
Expand Down
13 changes: 13 additions & 0 deletions build/integration/features/transfer-ownership.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d67e18b

Please sign in to comment.