X Tutup
Skip to content

Commit a68d373

Browse files
authored
Merge pull request #39302 from /issues/35684
Hide the 'Remove Password' button on public links
2 parents 0c189e1 + 356ffae commit a68d373

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

changelog/unreleased/39302

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Enhancement: Hide the "Remove Password" button on public links
2+
3+
This change hides the "Remove Password" button when editing a
4+
public link if a password in mandatory.
5+
6+
https://github.com/owncloud/core/pull/39302
7+
https://github.com/owncloud/core/issues/35684

core/js/sharedialoglinkshareview.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@
366366
})
367367
}
368368

369-
if (this.model.get('encryptedPassword')) {
369+
if (this.model.get('encryptedPassword') && !this.linkPasswordRequired()) {
370370
buttons.push({
371371
classes: 'removePassword',
372372
text: t('core', 'Remove password'),
@@ -391,6 +391,24 @@
391391
self.$dialog.html(self.$el);
392392
self.$el.find('input:first').focus();
393393
});
394+
},
395+
396+
linkPasswordRequired: function() {
397+
if (this.model.get('permissions') === OC.PERMISSION_CREATE) {
398+
return oc_appconfig.core.enforceLinkPasswordWriteOnly;
399+
}
400+
401+
if (this.model.get('permissions') === OC.PERMISSION_READ) {
402+
return oc_appconfig.core.enforceLinkPasswordReadOnly;
403+
}
404+
405+
if (this.model.get('permissions') === (OC.PERMISSION_READ | OC.PERMISSION_CREATE)) {
406+
return oc_appconfig.core.enforceLinkPasswordReadWrite;
407+
}
408+
409+
if (this.model.get('permissions') >= (OC.PERMISSION_READ | OC.PERMISSION_UPDATE | OC.PERMISSION_CREATE | OC.PERMISSION_DELETE)) {
410+
return oc_appconfig.core.enforceLinkPasswordReadWriteDelete;
411+
}
394412
}
395413

396414
});

0 commit comments

Comments
 (0)
X Tutup