[ADF-2358] Always enabling copy action (#3044)

This commit is contained in:
Vito
2018-03-07 14:11:36 +00:00
committed by Eugenio Romano
parent 232404aef3
commit 6afdbcad7c
6 changed files with 35 additions and 3 deletions

View File

@@ -344,6 +344,27 @@ describe('DocumentList', () => {
});
it('should not disable the action if there is copy permission', () => {
let documentMenu = new ContentActionModel({
disableWithNoPermission: true,
permission: 'copy',
target: 'document',
title: 'FileAction'
});
documentList.actions = [
documentMenu
];
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
let actions = documentList.getNodeActions(nodeFile);
expect(actions.length).toBe(1);
expect(actions[0].title).toEqual('FileAction');
expect(actions[0].disabled).toBeFalsy();
});
it('should disable the action if there is no permission for the folder and disableWithNoPermission true', () => {
let documentMenu = new ContentActionModel({
disableWithNoPermission: true,

View File

@@ -24,7 +24,8 @@ import {
DisplayMode,
ObjectDataColumn,
PaginatedComponent,
PaginationQueryParams
PaginationQueryParams,
PermissionsEnum
} from '@alfresco/adf-core';
import { AlfrescoApiService, AppConfigService, DataColumnListComponent, UserPreferencesService } from '@alfresco/adf-core';
import {
@@ -420,7 +421,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
}
checkPermission(node: any, action: ContentActionModel): ContentActionModel {
if (action.permission) {
if (action.permission && action.permission !== PermissionsEnum.COPY) {
if (this.hasPermissions(node)) {
let permissions = node.entry.allowableOperations;
let findPermission = permissions.find(permission => permission === action.permission);