summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-07 18:14:53 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-07 18:14:53 +0100
commitbfb6e350d54329bcf9ca91c0b44506a6eef13887 (patch)
treeb0966a4fa905fc29866332ab549c33df7242a348 /apps
parent10505bdb0db4d14ce86815b57d2bca2ef880a581 (diff)
parente9e7ee67d373e138b4a9749f9e9a7847a7d3875d (diff)
downloadnextcloud-server-bfb6e350d54329bcf9ca91c0b44506a6eef13887.tar.gz
nextcloud-server-bfb6e350d54329bcf9ca91c0b44506a6eef13887.zip
Merge pull request #13016 from owncloud/sharing_fixes
don't delete share table entries for the unique name if re-share permission was removed
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/share.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/share.php b/apps/files_sharing/tests/share.php
index 83ef17f49d1..b8c8b70bd1f 100644
--- a/apps/files_sharing/tests/share.php
+++ b/apps/files_sharing/tests/share.php
@@ -246,6 +246,38 @@ class Test_Files_Sharing extends OCA\Files_sharing\Tests\TestCase {
\OC::$server->getConfig()->deleteSystemValue('share_folder');
}
+ function testShareWithGroupUniqueName() {
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ \OC\Files\Filesystem::file_put_contents('test.txt', 'test');
+
+ $fileInfo = \OC\Files\Filesystem::getFileInfo('test.txt');
+
+ $this->assertTrue(
+ \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1, 23)
+ );
+
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ $items = \OCP\Share::getItemsSharedWith('file');
+ $this->assertSame('/test.txt' ,$items[0]['file_target']);
+ $this->assertSame(23, $items[0]['permissions']);
+
+ \OC\Files\Filesystem::rename('test.txt', 'new test.txt');
+
+ $items = \OCP\Share::getItemsSharedWith('file');
+ $this->assertSame('/new test.txt' ,$items[0]['file_target']);
+ $this->assertSame(23, $items[0]['permissions']);
+
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ \OCP\Share::setPermissions('file', $items[0]['item_source'], $items[0]['share_type'], $items[0]['share_with'], 3);
+
+ $this->loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $items = \OCP\Share::getItemsSharedWith('file');
+
+ $this->assertSame('/new test.txt' ,$items[0]['file_target']);
+ $this->assertSame(3, $items[0]['permissions']);
+ }
+
/**
* shared files should never have delete permissions
* @dataProvider DataProviderTestFileSharePermissions