summaryrefslogtreecommitdiffstats
path: root/core/js/shareitemmodel.js
diff options
context:
space:
mode:
authorMaximilian Wende <dasisdormax@secure.mailbox.org>2018-02-15 21:10:39 +0100
committerMaximilian Wende <dasisdormax@secure.mailbox.org>2018-02-15 21:10:39 +0100
commitd4238a52b29033716e5836b426f2c6b91d11e11c (patch)
tree3f59826513bedcd2d72c2720529b262acc01aae7 /core/js/shareitemmodel.js
parent14bc9b171427c1512226d5ea402021d8b44ac690 (diff)
downloadnextcloud-server-d4238a52b29033716e5836b426f2c6b91d11e11c.tar.gz
nextcloud-server-d4238a52b29033716e5836b426f2c6b91d11e11c.zip
Add indeterminate state to 'can edit' share permission checkbox, see #8371
Signed-off-by: Maximilian Wende <dasisdormax@secure.mailbox.org>
Diffstat (limited to 'core/js/shareitemmodel.js')
-rw-r--r--core/js/shareitemmodel.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index afe86fa464b..b699513c734 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -567,12 +567,26 @@
},
/**
- * @returns {boolean}
- */
- hasEditPermission: function(shareIndex) {
- return this.hasCreatePermission(shareIndex)
- || this.hasUpdatePermission(shareIndex)
- || this.hasDeletePermission(shareIndex);
+ * @returns {string}
+ * The state that the 'can edit' permission checkbox should have.
+ * Possible values:
+ * - empty string: no permission
+ * - 'checked': all applicable permissions
+ * - 'indeterminate': some but not all permissions
+ */
+ editPermissionState: function(shareIndex) {
+ var hcp = this.hasCreatePermission(shareIndex);
+ var hup = this.hasUpdatePermission(shareIndex);
+ var hdp = this.hasDeletePermission(shareIndex);
+ if (!hcp && !hup && !hdp) {
+ return '';
+ }
+ if ( (this.createPermissionPossible() && !hcp)
+ || (this.updatePermissionPossible() && !hup)
+ || (this.deletePermissionPossible() && !hdp) ) {
+ return 'indeterminate';
+ }
+ return 'checked';
},
/**