diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/files/client.js | 17 | ||||
-rw-r--r-- | core/src/files/fileinfo.js | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/core/src/files/client.js b/core/src/files/client.js index 630e9fb98ad..2c71fbe46e1 100644 --- a/core/src/files/client.js +++ b/core/src/files/client.js @@ -104,6 +104,7 @@ import escapeHTML from 'escape-html' Client.PROPERTY_GETCONTENTLENGTH = '{' + Client.NS_DAV + '}getcontentlength' Client.PROPERTY_ISENCRYPTED = '{' + Client.NS_DAV + '}is-encrypted' Client.PROPERTY_SHARE_PERMISSIONS = '{' + Client.NS_OCS + '}share-permissions' + Client.PROPERTY_SHARE_ATTRIBUTES = '{' + Client.NS_NEXTCLOUD + '}share-attributes' Client.PROPERTY_QUOTA_AVAILABLE_BYTES = '{' + Client.NS_DAV + '}quota-available-bytes' Client.PROTOCOL_HTTP = 'http' @@ -160,6 +161,10 @@ import escapeHTML from 'escape-html' * Share permissions */ [Client.NS_OCS, 'share-permissions'], + /** + * Share attributes + */ + [Client.NS_NEXTCLOUD, 'share-attributes'], ] /** @@ -416,6 +421,18 @@ import escapeHTML from 'escape-html' data.sharePermissions = parseInt(sharePermissionsProp) } + const shareAttributesProp = props[Client.PROPERTY_SHARE_ATTRIBUTES] + if (!_.isUndefined(shareAttributesProp)) { + try { + data.shareAttributes = JSON.parse(shareAttributesProp) + } catch (e) { + console.warn('Could not parse share attributes returned by server: "' + shareAttributesProp + '"') + data.shareAttributes = []; + } + } else { + data.shareAttributes = []; + } + const mounTypeProp = props['{' + Client.NS_NEXTCLOUD + '}mount-type'] if (!_.isUndefined(mounTypeProp)) { data.mountType = mounTypeProp diff --git a/core/src/files/fileinfo.js b/core/src/files/fileinfo.js index ea49e8c1447..3fe90f82ac9 100644 --- a/core/src/files/fileinfo.js +++ b/core/src/files/fileinfo.js @@ -155,7 +155,23 @@ */ sharePermissions: null, + /** + * @type Array + */ + shareAttributes: [], + quotaAvailableBytes: -1, + + canDownload: function() { + for (const i in this.shareAttributes) { + const attr = this.shareAttributes[i] + if (attr.scope === 'permissions' && attr.key === 'download') { + return attr.enabled + } + } + + return true + }, } if (!OC.Files) { |