[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
This commit is contained in:
davidcanonieto 2018-06-20 00:14:18 +01:00 committed by Eugenio Romano
parent cc73484a76
commit 0fae46b50b
4 changed files with 9 additions and 7 deletions

View File

@ -99,7 +99,7 @@ describe('UploadService', () => {
service.uploadFilesInTheQueue(emitter); service.uploadFilesInTheQueue(emitter);
let request = jasmine.Ajax.requests.mostRecent(); 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'); expect(request.method).toBe('POST');
jasmine.Ajax.requests.mostRecent().respondWith({ jasmine.Ajax.requests.mostRecent().respondWith({
@ -124,7 +124,7 @@ describe('UploadService', () => {
service.addToQueue(fileFake); service.addToQueue(fileFake);
service.uploadFilesInTheQueue(emitter); service.uploadFilesInTheQueue(emitter);
expect(jasmine.Ajax.requests.mostRecent().url) 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({ jasmine.Ajax.requests.mostRecent().respondWith({
'status': 404, 'status': 404,
@ -177,6 +177,7 @@ describe('UploadService', () => {
size: 10 size: 10
}, undefined, undefined, null, { }, undefined, undefined, null, {
renditions: 'doclib', renditions: 'doclib',
include: [ 'allowableOperations' ],
overwrite: true, overwrite: true,
majorVersion: undefined, majorVersion: undefined,
comment: undefined, comment: undefined,
@ -200,7 +201,7 @@ describe('UploadService', () => {
service.uploadFilesInTheQueue(emitter); service.uploadFilesInTheQueue(emitter);
let request = jasmine.Ajax.requests.mostRecent(); 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'); expect(request.method).toBe('POST');
jasmine.Ajax.requests.mostRecent().respondWith({ jasmine.Ajax.requests.mostRecent().respondWith({

View File

@ -157,7 +157,8 @@ export class UploadService {
*/ */
getUploadPromise(file: FileModel) { getUploadPromise(file: FileModel) {
let opts: any = { let opts: any = {
renditions: 'doclib' renditions: 'doclib',
include: ['allowableOperations']
}; };
if (file.options.newVersion === true) { if (file.options.newVersion === true) {

View File

@ -175,14 +175,14 @@ describe('ViewerComponent', () => {
component.ngOnChanges({}); component.ngOnChanges({});
tick(); tick();
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1'); expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id1', {include: [ 'allowableOperations' ]});
expect(component.displayName).toBe('file1'); expect(component.displayName).toBe('file1');
component.fileNodeId = 'id2'; component.fileNodeId = 'id2';
component.ngOnChanges({}); component.ngOnChanges({});
tick(); tick();
expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2'); expect(alfrescoApiService.nodesApi.getNodeInfo).toHaveBeenCalledWith('id2', {include: [ 'allowableOperations' ]});
expect(component.displayName).toBe('file2'); expect(component.displayName).toBe('file2');
})); }));

View File

@ -285,7 +285,7 @@ export class ViewerComponent implements OnChanges, OnInit, OnDestroy {
this.setUpUrlFile(); this.setUpUrlFile();
this.isLoading = false; this.isLoading = false;
} else if (this.nodeId) { } else if (this.nodeId) {
this.apiService.nodesApi.getNodeInfo(this.nodeId).then( this.apiService.nodesApi.getNodeInfo(this.nodeId, { include: ['allowableOperations'] }).then(
(data: MinimalNodeEntryEntity) => { (data: MinimalNodeEntryEntity) => {
this.setUpNodeFile(data).then(() => { this.setUpNodeFile(data).then(() => {
this.isLoading = false; this.isLoading = false;