rename old hasPermission as allowableOperation and introduce the real hasPermissions (#4294)

This commit is contained in:
Eugenio Romano
2019-02-11 10:44:37 +00:00
committed by GitHub
parent 324e86aaf3
commit 3263659ac2
39 changed files with 256 additions and 178 deletions

View File

@@ -68,7 +68,7 @@ export class FileViewComponent implements OnInit {
this.nodeApiService.getNode(id).subscribe(
(node) => {
if (node && node.isFile) {
this.isCommentEnabled = !this.contentServices.hasPermission(node, PermissionsEnum.UPDATE);
this.isCommentEnabled = !this.contentServices.hasPermissions(node, PermissionsEnum.NOT_CONSUMER);
this.nodeId = id;
return;
}

View File

@@ -37,7 +37,7 @@
[acceptedFilesType]="getFileFiltering()"
[rootFolderId]="currentFolderId"
[versioning]="versioning"
[adf-node-permission]="'create'"
[adf-check-allowable-operation]="'create'"
[adf-nodes]="disableDragArea ? getCurrentDocumentListNode() : []"
(beginUpload)="onBeginUpload($event)">
<div *ngIf="errorMessage" class="adf-error-message">
@@ -105,7 +105,7 @@
<mat-icon>get_app</mat-icon>
</button>
<button mat-icon-button
adf-node-permission="delete"
adf-check-allowable-operation="delete"
[adf-nodes]="documentList.selection"
title="{{ 'DOCUMENT_LIST.TOOLBAR.DELETE' | translate }}"
(delete)="onDeleteActionSuccess($event)"
@@ -190,7 +190,7 @@
<span>{{ 'DOCUMENT_LIST.TOOLBAR.DOWNLOAD' | translate }}</span>
</button>
<button mat-menu-item
adf-node-permission="delete"
adf-check-allowable-operation="delete"
[adf-nodes]="documentList.selection"
(delete)="onDeleteActionSuccess($event)"
[adf-delete]="documentList.selection">
@@ -612,7 +612,7 @@
[maxFilesSize]="maxSizeShow ? maxFilesSize : null"
(error)="openSnackMessage($event)"
[versioning]="versioning"
[adf-node-permission]="'create'"
[adf-check-allowable-operation]="'create'"
[adf-nodes]="enableUpload ? getCurrentDocumentListNode() : []"
(permissionEvent)="handlePermissionError($event)"
(beginUpload)="onBeginUpload($event)">
@@ -629,7 +629,7 @@
[uploadFolders]="folderUpload"
[versioning]="versioning"
(error)="openSnackMessage($event)"
[adf-node-permission]="'create'"
[adf-check-allowable-operation]="'create'"
[adf-nodes]="enableUpload ? getCurrentDocumentListNode() : []"
(permissionEvent)="handlePermissionError($event)">
</adf-upload-button>

View File

@@ -263,8 +263,8 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
this.onCreateFolder = this.contentService.folderCreate.subscribe((value) => this.onFolderAction(value));
this.onEditFolder = this.contentService.folderEdit.subscribe((value) => this.onFolderAction(value));
// this.permissionsStyle.push(new PermissionStyleModel('document-list__create', PermissionsEnum.CREATE));
// this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', PermissionsEnum.NOT_CREATE, false, true));
// this.permissionsStyle.push(new PermissionStyleModel('document-list__create', AllowableOperationsEnum.CREATE));
// this.permissionsStyle.push(new PermissionStyleModel('document-list__disable', AllowableOperationsEnum.NOT_CREATE, false, true));
}
ngOnDestroy() {
@@ -399,7 +399,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
const showComments = this.showVersionComments;
const allowDownload = this.allowVersionDownload;
if (this.contentService.hasPermission(contentEntry, 'update')) {
if (this.contentService.hasAllowableOperations(contentEntry, 'update')) {
this.dialog.open(VersionManagerDialogAdapterComponent, {
data: { contentEntry: contentEntry, showComments: showComments, allowDownload: allowDownload },
panelClass: 'adf-version-manager-dialog',
@@ -414,7 +414,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
onManageMetadata(event) {
const contentEntry = event.value.entry;
if (this.contentService.hasPermission(contentEntry, 'update')) {
if (this.contentService.hasAllowableOperations(contentEntry, 'update')) {
this.dialog.open(MetadataDialogAdapterComponent, {
data: {
contentEntry: contentEntry,
@@ -444,7 +444,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
userHasPermissionToManageVersions(): boolean {
const selection: Array<MinimalNodeEntity> = this.documentList.selection;
return this.contentService.hasPermission(selection[0].entry, 'update');
return this.contentService.hasAllowableOperations(selection[0].entry, 'update');
}
getNodeNameTooltip(row: DataRow, col: DataColumn): string {
@@ -459,7 +459,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
const entry = selection[0].entry;
if (entry && entry.isFolder) {
return this.contentService.hasPermission(entry, 'update');
return this.contentService.hasAllowableOperations(entry, 'update');
}
}
return false;
@@ -467,7 +467,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
canCreateContent(parentNode: MinimalNodeEntryEntity): boolean {
if (parentNode) {
return this.contentService.hasPermission(parentNode, 'create');
return this.contentService.hasAllowableOperations(parentNode, 'create');
}
return false;
}