Hid AOS if record (#1272)

* check if record
* prepare aos release
This commit is contained in:
Martin Muller
2019-12-02 14:24:07 +01:00
committed by GitHub
parent 961d3896e2
commit c7b8511d5b
4 changed files with 63 additions and 2 deletions

View File

@@ -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",

View File

@@ -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"],

View File

@@ -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: {

View File

@@ -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']);
}