[ADF-3228] Added lock check for context actions (#4163)

* [ADF-3228] Added lock check in content service

* [ADF-3228] added unit test for lock check

* [ADF-3228] fixed wrong line on rebase

* [ADF-3228] fixed e2e related to new lock behaviour

* [ADF-3228] externalised lock service and added more unit tests

* [ADF-3228] added lock service to disable context actions

* [ADF-3228] fixed e2e rebased to the latest
This commit is contained in:
Vito
2019-03-27 11:42:09 +00:00
committed by Eugenio Romano
parent e75335a06d
commit 070bf020a7
6 changed files with 356 additions and 56 deletions

View File

@@ -42,7 +42,8 @@ import {
CustomEmptyContentTemplateDirective,
RequestPaginationModel,
AlfrescoApiService,
UserPreferenceValues
UserPreferenceValues,
LockService
} from '@alfresco/adf-core';
import { Node, NodeEntry, NodePaging, Pagination } from '@alfresco/js-api';
@@ -325,7 +326,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
private customResourcesService: CustomResourcesService,
private contentService: ContentService,
private thumbnailService: ThumbnailService,
private alfrescoApiService: AlfrescoApiService) {
private alfrescoApiService: AlfrescoApiService,
private lockService: LockService) {
this.userPreferencesService.select(UserPreferenceValues.PaginationSize).subscribe((pagSize) => {
this.maxItems = this._pagination.maxItems = pagSize;
@@ -532,11 +534,14 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
return action.disabled(node);
}
if (action.permission && action.disableWithNoPermission && !this.contentService.hasAllowableOperations(node.entry, action.permission)) {
if ((action.permission &&
action.disableWithNoPermission &&
!this.contentService.hasAllowableOperations(node.entry, action.permission)) ||
this.lockService.isLocked(node.entry)) {
return true;
} else {
return action.disabled;
}
return action.disabled;
}
@HostListener('contextmenu', ['$event'])