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

Ensure only change approvers can change doc level attachments

Does not affect section level attachments
This commit is contained in:
HarveyKandola 2019-08-27 16:17:38 +01:00
parent d14e8a3ff6
commit 5b72da037c

View file

@ -23,8 +23,14 @@ export default Component.extend(Modals, Notifier, {
appMeta: service(),
session: service(),
hasAttachments: notEmpty('files'),
canEdit: computed('permissions.documentEdit', 'document.protection', function() {
return this.get('document.protection') !== this.get('constants').ProtectionType.Lock && this.get('permissions.documentEdit');
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('permissions.documentEdit')) 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;
}),
showDialog: false,
downloadQuery: '',