[ADF-2995] Permissions - Consumer should be able to upload a new version for his file on a private site (#3326)

* check node permission instead of parent

* tests
This commit is contained in:
Cilibiu Bogdan
2018-05-16 11:40:49 +03:00
committed by Eugenio Romano
parent 35ee120d5c
commit 374c5a3fed
3 changed files with 132 additions and 5 deletions

View File

@@ -15,7 +15,8 @@
* limitations under the License.
*/
import { Component, forwardRef, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core';
import { PermissionsEnum } from '@alfresco/adf-core';
import { Component, forwardRef, Input, OnChanges, SimpleChanges, ViewEncapsulation, OnInit } from '@angular/core';
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
import { UploadButtonComponent } from './upload-button.component';
import { FileModel, EXTENDIBLE_COMPONENT } from '@alfresco/adf-core';
@@ -29,7 +30,7 @@ import { FileModel, EXTENDIBLE_COMPONENT } from '@alfresco/adf-core';
],
encapsulation: ViewEncapsulation.None
})
export class UploadVersionButtonComponent extends UploadButtonComponent implements OnChanges {
export class UploadVersionButtonComponent extends UploadButtonComponent implements OnChanges, OnInit {
/** (**Required**) The node to be versioned. */
@Input()
@@ -57,4 +58,13 @@ export class UploadVersionButtonComponent extends UploadButtonComponent implemen
return fileModel;
}
ngOnInit() {
super.ngOnInit();
this.checkPermission();
}
checkPermission() {
this.permissionValue.next(this.nodeHasPermission(this.node, PermissionsEnum.UPDATE));
}
}