summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2017-11-20 16:15:52 +0100
committerGitHub <noreply@github.com>2017-11-20 16:15:52 +0100
commitf347e2e4a6cab71c35d58ff21692e23d7443db60 (patch)
tree878bd5f18958fdde2666d58b49a558a98bc209e9 /apps
parentbca165805ea8b27cc127ac71f140d8d0ed7f4edb (diff)
parent3e844d3a59cc571c93b6edcd80dce2cffd89072b (diff)
downloadnextcloud-server-f347e2e4a6cab71c35d58ff21692e23d7443db60.tar.gz
nextcloud-server-f347e2e4a6cab71c35d58ff21692e23d7443db60.zip
Merge pull request #7047 from nextcloud/add-support-for-files-with-no-permissions
Add support for files with no permissions
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/Node.php3
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/NodeTest.php20
-rw-r--r--apps/files/js/fileactions.js2
-rw-r--r--apps/files/js/filelist.js9
-rw-r--r--apps/files/js/tagsplugin.js2
-rw-r--r--apps/files/tests/js/filelistSpec.js9
6 files changed, 32 insertions, 13 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index b2e4c449095..979336d86fe 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -300,6 +300,9 @@ abstract class Node implements \Sabre\DAV\INode {
if ($this->info->isMounted()) {
$p .= 'M';
}
+ if ($this->info->isReadable()) {
+ $p .= 'G';
+ }
if ($this->info->isDeletable()) {
$p .= 'D';
}
diff --git a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
index d4964557126..b46c731d3dc 100644
--- a/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/NodeTest.php
@@ -42,15 +42,17 @@ use OCP\Share\IShare;
class NodeTest extends \Test\TestCase {
public function davPermissionsProvider() {
return array(
- array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RDNVW'),
- array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RDNVCK'),
- array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRDNVW'),
- array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMDNVW'),
- array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SDNVW'),
- array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RD'),
- array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RNVW'),
- array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RDNVW'),
- array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RDNV'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', false, false, 'RGDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL, 'dir', false, false, 'RGDNVCK'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', true, false, 'SRGDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL, 'file', true, true, 'SRMGDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_SHARE, 'file', true, false, 'SGDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_UPDATE, 'file', false, false, 'RGD'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_DELETE, 'file', false, false, 'RGNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'file', false, false, 'RGDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'file', false, false, 'RDNVW'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE, 'dir', false, false, 'RGDNV'),
+ array(\OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_READ, 'dir', false, false, 'RDNVCK'),
);
}
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 0f320c8b3c7..6c031ab06d5 100644
--- a/apps/files/js/fileactions.js
+++ b/apps/files/js/fileactions.js
@@ -235,7 +235,7 @@
}
var filteredActions = {};
$.each(actions, function (name, action) {
- if (action.permissions & permissions) {
+ if ((action.permissions === OC.PERMISSION_NONE) || (action.permissions & permissions)) {
filteredActions[name] = action;
}
});
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 03e9c138efb..6996e423776 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -408,7 +408,7 @@
mime: 'all',
order: -50,
iconClass: 'icon-details',
- permissions: OC.PERMISSION_READ,
+ permissions: OC.PERMISSION_NONE,
actionHandler: function(fileName, context) {
self._updateDetailsView(fileName);
}
@@ -1161,6 +1161,11 @@
}
}
+ var permissions = fileData.permissions;
+ if (permissions === undefined || permissions === null) {
+ permissions = this.getDirectoryPermissions();
+ }
+
//containing tr
var tr = $('<tr></tr>').attr({
"data-id" : fileData.id,
@@ -1170,7 +1175,7 @@
"data-mime": mime,
"data-mtime": mtime,
"data-etag": fileData.etag,
- "data-permissions": fileData.permissions || this.getDirectoryPermissions(),
+ "data-permissions": permissions,
"data-has-preview": fileData.hasPreview !== false
});
diff --git a/apps/files/js/tagsplugin.js b/apps/files/js/tagsplugin.js
index 747a7245a56..b174aa7d766 100644
--- a/apps/files/js/tagsplugin.js
+++ b/apps/files/js/tagsplugin.js
@@ -104,7 +104,7 @@
},
mime: 'all',
order: -100,
- permissions: OC.PERMISSION_READ,
+ permissions: OC.PERMISSION_NONE,
iconClass: function(fileName, context) {
var $file = context.$file;
var isFavorite = $file.data('favorite') === true;
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index c590275e1cf..64fc6876493 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -297,6 +297,15 @@ describe('OCA.Files.FileList tests', function() {
expect($tr.find('.filesize').text()).toEqual('Pending');
expect($tr.find('.date').text()).not.toEqual('?');
});
+ it('generates file element with no permissions when permissions are explicitly none', function() {
+ var fileData = {
+ type: 'dir',
+ name: 'testFolder',
+ permissions: OC.PERMISSION_NONE
+ };
+ var $tr = fileList.add(fileData);
+ expect($tr.attr('data-permissions')).toEqual('0');
+ });
it('generates file element with zero size when size is explicitly zero', function() {
var fileData = {
type: 'dir',