diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-06-02 11:31:21 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-07-28 16:53:23 +0200 |
commit | a11c6e7cc3eec18cba62ebd32e0b8653d97ed929 (patch) | |
tree | bafafff8804d17ec7a0fa41f908bea6a761aa962 /core | |
parent | 92e60e38589f47bdd71114b2c54217ba6fdc7dd2 (diff) | |
download | nextcloud-server-a11c6e7cc3eec18cba62ebd32e0b8653d97ed929.tar.gz nextcloud-server-a11c6e7cc3eec18cba62ebd32e0b8653d97ed929.zip |
Add share attrs + download permission support in frontend
Added download permission checkbox in frontend
Added share attributes parsing and setting in frontend.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
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) { |