diff --git a/projects/adf-office-services-ext/assets/aos.plugin.json b/projects/adf-office-services-ext/assets/aos.plugin.json index 487666617..4a6b2f053 100644 --- a/projects/adf-office-services-ext/assets/aos.plugin.json +++ b/projects/adf-office-services-ext/assets/aos.plugin.json @@ -1,7 +1,7 @@ { "$schema": "../../../extension.schema.json", "$id": "9a635542-d87a-4558-ae64-ffa199d1a364", - "$version": "0.0.8", + "$version": "0.0.9", "$name": "keensoft.aos.plugin", "$description": "Extension that provides Office Edit Online Action", "$vendor": "Keensoft", diff --git a/projects/adf-office-services-ext/package.json b/projects/adf-office-services-ext/package.json index 96c2dca87..a428a7fa8 100644 --- a/projects/adf-office-services-ext/package.json +++ b/projects/adf-office-services-ext/package.json @@ -1,6 +1,6 @@ { "name": "@alfresco/adf-office-services-ext", - "version": "0.0.8", + "version": "0.0.9", "license": "Apache-2.0", "homepage": "https://github.com/Alfresco/alfresco-content-app", "keywords": ["Alfresco", "ADF", "ACA", "Content Application"], diff --git a/projects/adf-office-services-ext/src/lib/evaluators.spec.ts b/projects/adf-office-services-ext/src/lib/evaluators.spec.ts index 90225129c..1bca7a5db 100644 --- a/projects/adf-office-services-ext/src/lib/evaluators.spec.ts +++ b/projects/adf-office-services-ext/src/lib/evaluators.spec.ts @@ -83,6 +83,58 @@ describe('evaluators', () => { expect(canOpenWithOffice(context)).toBeFalsy(); }); + it('should return [false] if selected file is a record with containing aspect rma:declaredRecord', () => { + const context: any = { + selection: { + file: { + entry: { + name: 'document.docx', + isLocked: false, + properties: {}, + aspectNames: ['rma:declaredRecord'] + } + } + }, + permissions: { + check: () => true + } + }; + expect(canOpenWithOffice(context)).toBeFalsy(); + }); + + it('should return [false] if selected file is a record with containing aspect rma:record', () => { + const context: any = { + selection: { + file: { + entry: { + name: 'document.docx', + isLocked: false, + properties: {}, + aspectNames: ['rma:record'] + } + } + }, + permissions: { + check: () => true + } + }; + expect(canOpenWithOffice(context)).toBeFalsy(); + }); + + it('should return [false] if selected file is a record 1', () => { + const context: any = { + selection: { + file: { + entry: { + aspectName: ['rma:declaredRecord'] + } + } + } + }; + + expect(canOpenWithOffice(context)).toBeFalsy(); + }); + it('should return [false] if selected file is locked', () => { const context: any = { selection: { diff --git a/projects/adf-office-services-ext/src/lib/evaluators.ts b/projects/adf-office-services-ext/src/lib/evaluators.ts index 21da040f8..0ff610367 100644 --- a/projects/adf-office-services-ext/src/lib/evaluators.ts +++ b/projects/adf-office-services-ext/src/lib/evaluators.ts @@ -98,5 +98,14 @@ export function canOpenWithOffice( return false; } + // check if record + if ( + file.entry.aspectNames && + (file.entry.aspectNames.includes('rma:declaredRecord') || + file.entry.aspectNames.includes('rma:record')) + ) { + return false; + } + return context.permissions.check(file, ['update']); }