Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-06-02 12:31:21 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-08-03 14:24:19 +0300
commit189b7b16247e18169ff755ee4a775e4976b70c26 (patch)
tree904c04ec3436fdde0768d1aaa40984c1008b9689 /core
parent0c468ede91256324c3eff1eecf16b55d5ee8bb84 (diff)
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.js17
-rw-r--r--core/src/files/fileinfo.js16
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) {