From 0fae46b50baa0c24c65d5d700e4aed14cf859518 Mon Sep 17 00:00:00 2001 From: davidcanonieto Date: Wed, 20 Jun 2018 00:14:18 +0100 Subject: [PATCH] [ADF-3212] Fixed permission issues when updating version (#3503) * [ADF-3213] Fixed permission issues when updating version * [ADF-3212] fixed test for PR * allowableOperations include viewer get node --- lib/core/services/upload.service.spec.ts | 7 ++++--- lib/core/services/upload.service.ts | 3 ++- lib/core/viewer/components/viewer.component.spec.ts | 4 ++-- lib/core/viewer/components/viewer.component.ts | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/core/services/upload.service.spec.ts b/lib/core/services/upload.service.spec.ts index a8178f7780..606dfa5019 100644 --- a/lib/core/services/upload.service.spec.ts +++ b/lib/core/services/upload.service.spec.ts @@ -99,7 +99,7 @@ describe('UploadService', () => { service.uploadFilesInTheQueue(emitter); let request = jasmine.Ajax.requests.mostRecent(); - expect(request.url).toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true'); + expect(request.url).toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true&include=allowableOperations'); expect(request.method).toBe('POST'); jasmine.Ajax.requests.mostRecent().respondWith({ @@ -124,7 +124,7 @@ describe('UploadService', () => { service.addToQueue(fileFake); service.uploadFilesInTheQueue(emitter); expect(jasmine.Ajax.requests.mostRecent().url) - .toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true'); + .toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true&include=allowableOperations'); jasmine.Ajax.requests.mostRecent().respondWith({ 'status': 404, @@ -177,6 +177,7 @@ describe('UploadService', () => { size: 10 }, undefined, undefined, null, { renditions: 'doclib', + include: [ 'allowableOperations' ], overwrite: true, majorVersion: undefined, comment: undefined, @@ -200,7 +201,7 @@ describe('UploadService', () => { service.uploadFilesInTheQueue(emitter); let request = jasmine.Ajax.requests.mostRecent(); - expect(request.url).toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true'); + expect(request.url).toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true&include=allowableOperations'); expect(request.method).toBe('POST'); jasmine.Ajax.requests.mostRecent().respondWith({ diff --git a/lib/core/services/upload.service.ts b/lib/core/services/upload.service.ts index 1be7fa6d71..d08bdfac79 100644 --- a/lib/core/services/upload.service.ts +++ b/lib/core/services/upload.service.ts @@ -157,7 +157,8 @@ export class UploadService { */ getUploadPromise(file: FileModel) { let opts: any = { - renditions: 'doclib' + renditions: 'doclib', + include: ['allowableOperations'] }; if (file.options.newVersion === true) { diff --git a/lib/core/viewer/components/viewer.component.spec.ts b/lib/core/viewer/components/viewer.component.spec.ts index 0d2c503a2d..ad230bbdf2 100644 --- a/lib/core/viewer/components/viewer.component.spec.ts +++ b/lib/core/viewer/components/viewer.component.spec.ts @@ -175,14 +175,14 @@ describe('ViewerComponent', () => { component.ngOnChanges({}); tick(); - expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1'); + expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1', {include: [ 'allowableOperations' ]}); expect(component.displayName).toBe('file1'); component.fileNodeId = 'id2'; component.ngOnChanges({}); tick(); - expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2'); + expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2', {include: [ 'allowableOperations' ]}); expect(component.displayName).toBe('file2'); })); diff --git a/lib/core/viewer/components/viewer.component.ts b/lib/core/viewer/components/viewer.component.ts index 9101f1c1ed..d1d29fc910 100644 --- a/lib/core/viewer/components/viewer.component.ts +++ b/lib/core/viewer/components/viewer.component.ts @@ -285,7 +285,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy { this.setUpUrlFile(); this.isLoading = false; } else if (this.nodeId) { - this.apiService.nodesApi.getNodeInfo(this.nodeId).then( + this.apiService.nodesApi.getNodeInfo(this.nodeId, { include: ['allowableOperations'] }).then( (data: MinimalNodeEntryEntity) => { this.setUpNodeFile(data).then(() => { this.isLoading = false;