Browse Source
Fix transfering ownership of a share to user with same id as receiver
When the ownership of a user share is transfered to the receiver the
share is removed, as the receiver now owns the original file. However,
due to a missing condition, any share with a group, link or remote with
the same id as the user was removed, not only the user shares.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
pull/10348/head
Daniel Calviño Sánchez
8 years ago
committed by
Morris Jobke
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
2 changed files with
15 additions and
1 deletions
apps/files/lib/Command/TransferOwnership.php
build/integration/features/transfer-ownership.feature
@ -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 ) {
@ -72,6 +72,19 @@ Feature: transfer-ownership
And A s a n " u s e r 2 "
Then D o w n l o a d e d c o n t e n t w h e n d o w n l o a d i n g f i l e " / t e s t / s o m e f i l e . t x t " w i t h r a n g e " b y t e s = 0 - 6 " s h o u l d b e " T h i s i s "
Scenario : transfering ownership of file shares to user with the same id as the group
Given u s e r " u s e r 0 " e x i s t s
And u s e r " t e s t " e x i s t s
And u s e r " u s e r 2 " e x i s t s
And g r o u p " t e s t " e x i s t s
And u s e r " u s e r 2 " b e l o n g s t o g r o u p " t e s t "
And U s e r " u s e r 0 " u p l o a d s f i l e " d a t a / t e x t f i l e . t x t " t o " / s o m e f i l e . t x t "
And f i l e " / s o m e f i l e . t x t " o f u s e r " u s e r 0 " i s s h a r e d w i t h g r o u p " t e s t "
When t r a n s f e r i n g o w n e r s h i p f r o m " u s e r 0 " t o " t e s t "
And t h e c o m m a n d w a s s u c c e s s f u l
And A s a n " u s e r 2 "
Then D o w n l o a d e d c o n t e n t w h e n d o w n l o a d i n g f i l e " / s o m e f i l e . t x t " w i t h r a n g e " b y t e s = 0 - 6 " s h o u l d b e " T h i s i s "
Scenario : transfering ownership does not transfer received shares
Given u s e r " u s e r 0 " e x i s t s
And u s e r " u s e r 1 " e x i s t s