diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-07-22 10:08:05 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-03 10:16:28 +0200 |
commit | 0c6352e0955cb2b47496655f275ee06db2298a52 (patch) | |
tree | 67418d723a9a04781e1a9fc44393f7605c7e9660 /tests | |
parent | 0c7c9a3b950ce4261a6fc76cb23f97c3673a03e4 (diff) | |
download | nextcloud-server-0c6352e0955cb2b47496655f275ee06db2298a52.tar.gz nextcloud-server-0c6352e0955cb2b47496655f275ee06db2298a52.zip |
Fix RepairUnmergedShares to not skip valid repair cases
The repair step was a bit overeager to skip repairing so it missed the
case where a group share exists without subshares but with an
additional direct user share.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Repair/RepairUnmergedSharesTest.php | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/tests/lib/Repair/RepairUnmergedSharesTest.php b/tests/lib/Repair/RepairUnmergedSharesTest.php index 20dabac2e6b..fe9b3e5b96f 100644 --- a/tests/lib/Repair/RepairUnmergedSharesTest.php +++ b/tests/lib/Repair/RepairUnmergedSharesTest.php @@ -329,7 +329,28 @@ class RepairUnmergedSharesTest extends TestCase { ] ], [ - // #7 legitimate share with own group: + // #7 bogus share: + // - outsider shares with group1 and also user2 + // - no subshare at all + // - one extra share entry for direct share to user2 + // - non-matching targets + // - user share has more permissions + [ + [Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup1', '/test', 1], + [Constants::SHARE_TYPE_USER, 123, 'user2', '/test (2)', 31], + // different unrelated share + [Constants::SHARE_TYPE_GROUP, 456, 'recipientgroup1', '/test (5)', 31], + ], + [ + ['/test', 1], + // user share repaired + ['/test', 31], + // leave unrelated alone + ['/test (5)', 31], + ] + ], + [ + // #8 legitimate share with own group: // - insider shares with both groups the user is already in // - no subshares in this case [ @@ -347,7 +368,7 @@ class RepairUnmergedSharesTest extends TestCase { ] ], [ - // #7 legitimate shares: + // #9 legitimate shares: // - group share with same group // - group share with other group // - user share where recipient renamed @@ -370,6 +391,25 @@ class RepairUnmergedSharesTest extends TestCase { ['/test (4)', 31], ] ], + [ + // #10 legitimate share: + // - outsider shares with group and user directly with different permissions + // - no subshares + // - same targets + [ + [Constants::SHARE_TYPE_GROUP, 123, 'samegroup1', '/test', 1], + [Constants::SHARE_TYPE_USER, 123, 'user3', '/test', 31], + // different unrelated share + [Constants::SHARE_TYPE_GROUP, 456, 'recipientgroup1', '/test (4)', 31], + ], + [ + // leave all alone + ['/test', 1], + ['/test', 31], + // leave unrelated alone + ['/test (4)', 31], + ] + ], ]; } |