1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 13:19:43 +02:00

Improve canEdit permissions for attachments

This commit is contained in:
McMatts 2019-10-21 10:34:34 +01:00
parent 8c2bed283f
commit 30d3e6f82e

View file

@ -25,9 +25,9 @@ export default Component.extend(Modals, Notifier, {
hasAttachments: notEmpty('files'),
canEdit: computed('permissions.{documentApprove,documentEdit}', 'document.protection', function() {
// Check to see if specific scenarios prevent us from changing doc level attachments.
if (this.get('document.protection') == this.get('constants').ProtectionType.Lock) return false;
if (this.get('document.protection') === this.get('constants').ProtectionType.Lock) return false;
if (!this.get('permissions.documentEdit')) return false;
if (this.get('document.protection') == this.get('constants').ProtectionType.Review && !this.get('permissions.documentApprove')) return false;
if (this.get('document.protection') === this.get('constants').ProtectionType.Review && !this.get('permissions.documentApprove')) return false;
// By default, we can edit/upload attachments that sit at the document level.
return true;