summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-11 18:28:55 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-11 18:28:55 +0200
commit75a53b3c4956724b7e242ad58b487bccb9be2279 (patch)
tree18ed2716dc7a421582ec6b4a73a4afed3402d77c /apps/files_sharing/tests
parent2facfe9984230b70cf24467ca439e9192388e30a (diff)
parenta9786070118f67881750d40458e88f6795363e55 (diff)
downloadnextcloud-server-75a53b3c4956724b7e242ad58b487bccb9be2279.tar.gz
nextcloud-server-75a53b3c4956724b7e242ad58b487bccb9be2279.zip
Merge pull request #8901 from owncloud/permissions-update-cache
Save the permissions in the filecache if it's not saved yet
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/permissions.php50
1 files changed, 42 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/permissions.php b/apps/files_sharing/tests/permissions.php
index 0a222b08512..2cbc412d261 100644
--- a/apps/files_sharing/tests/permissions.php
+++ b/apps/files_sharing/tests/permissions.php
@@ -19,13 +19,49 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
+use OC\Files\Cache\Cache;
+use OC\Files\Storage\Storage;
+use OC\Files\View;
+
require_once __DIR__ . '/base.php';
class Test_Files_Sharing_Permissions extends Test_Files_Sharing_Base {
+ /**
+ * @var Storage
+ */
private $sharedStorageRestrictedShare;
+
+ /**
+ * @var Storage
+ */
private $sharedCacheRestrictedShare;
+ /**
+ * @var View
+ */
+ private $secondView;
+
+ /**
+ * @var Storage
+ */
+ private $ownerStorage;
+
+ /**
+ * @var Storage
+ */
+ private $sharedStorage;
+
+ /**
+ * @var Cache
+ */
+ private $sharedCache;
+
+ /**
+ * @var Cache
+ */
+ private $ownerCache;
+
function setUp() {
parent::setUp();
@@ -105,16 +141,14 @@ class Test_Files_Sharing_Permissions extends Test_Files_Sharing_Base {
$this->assertEquals('subdir', $contents[0]['name']);
$this->assertEquals(31, $contents[0]['permissions']);
$this->assertEquals('textfile.txt', $contents[1]['name']);
- $this->assertEquals(31, $contents[1]['permissions']);
+ // 27 is correct because create is reserved to folders only - requires more unit tests overall to ensure this
+ $this->assertEquals(27, $contents[1]['permissions']);
$contents = $this->secondView->getDirectoryContent('files/shareddirrestricted');
$this->assertEquals('subdir', $contents[0]['name']);
- $this->assertEquals(7, $contents[0]['permissions']);
+ $this->assertEquals(7 | \OCP\PERMISSION_DELETE, $contents[0]['permissions']);
$this->assertEquals('textfile1.txt', $contents[1]['name']);
- $this->assertEquals(7, $contents[1]['permissions']);
-
- // the share mount point should always have delete permissions to allow the user
- // to unmount it
- $restrictedShare = $this->secondView->getFileInfo('files/shareddirrestricted');
- $this->assertEquals(7 | \OCP\PERMISSION_DELETE, $restrictedShare['permissions']);
+ // 3 is correct because create is reserved to folders only
+ // delete permissions are added since mount points can always be deleted
+ $this->assertEquals(3 | \OCP\PERMISSION_DELETE, $contents[1]['permissions']);
}
}