[ADF-2540] Lock node feature (#3138)

* add adf-node-lock directive

* add lock-node service + button in context menu

* unit tests

* docs

* unit tests fix

* Remove unnecessary imports

* PR changes

* Remove fit from tests

* Update specific node from list on lock/ulock
This commit is contained in:
Alex Bolboșenco
2018-04-06 08:59:28 +03:00
committed by Denys Vuika
parent 7b7e39d989
commit 7d1b4bf14a
26 changed files with 643 additions and 29 deletions

View File

@@ -51,6 +51,18 @@
"TITLE": "Adding files to zip, this could take a few minutes"
}
},
"FILE_DIALOG": {
"FILE_LOCK": "Lock file",
"ALLOW_OTHERS_CHECKBOX": "Allow the owner to modify this file",
"FILE_LOCK_CHECKBOX": "Lock file",
"TIME_LOCK_CHECKBOX": "Time lock",
"SAVE_BUTTON": {
"LABEL": "Save"
},
"CANCEL_BUTTON": {
"LABEL": "Cancel"
}
},
"FOLDER_DIALOG": {
"CREATE_FOLDER_TITLE": "Create new folder",
"EDIT_FOLDER_TITLE": "Edit folder",

View File

@@ -20,6 +20,7 @@ export class PermissionsEnum extends String {
static UPDATE: string = 'update';
static CREATE: string = 'create';
static COPY: string = 'copy';
static LOCK: string = 'lock';
static UPDATEPERMISSIONS: string = 'updatePermissions';
static NOT_DELETE: string = '!delete';
static NOT_UPDATE: string = '!update';

View File

@@ -202,9 +202,9 @@ export class ContentService {
if (this.hasAllowableOperations(node)) {
if (permission && permission.startsWith('!')) {
hasPermission = node.allowableOperations.find(currentPermission => currentPermission === permission.replace('!', '')) ? false : true;
hasPermission = !~node.allowableOperations.indexOf(permission.replace('!', ''));
} else {
hasPermission = node.allowableOperations.find(currentPermission => currentPermission === permission) ? true : false;
hasPermission = !!~node.allowableOperations.indexOf(permission);
}
} else {
@@ -217,6 +217,14 @@ export class ContentService {
hasPermission = true;
}
if (permission === PermissionsEnum.LOCK) {
hasPermission = node.isFile;
if (node.isLocked && this.hasAllowableOperations(node)) {
hasPermission = !!~node.allowableOperations.indexOf('updatePermissions');
}
}
return hasPermission;
}