mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-06-30 18:15:11 +00:00
[ADF-2661] disabling comments when user doesn't have permissions (#4031)
This commit is contained in:
parent
f128bfbdc5
commit
5bea17fa6c
@ -4,7 +4,7 @@
|
||||
<adf-info-drawer [title]="'APP.INFO_DRAWER.TITLE' | translate">
|
||||
|
||||
<adf-info-drawer-tab [label]="'APP.INFO_DRAWER.COMMENTS' | translate">
|
||||
<adf-comments [nodeId]="nodeId"></adf-comments>
|
||||
<adf-comments [nodeId]="nodeId" [readOnly]="isCommentEnabled"></adf-comments>
|
||||
</adf-info-drawer-tab>
|
||||
|
||||
<adf-info-drawer-tab [label]="'APP.INFO_DRAWER.PROPERTIES' | translate">
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ContentService, PermissionsEnum, NodesApiService } from '@alfresco/adf-core';
|
||||
import { MatSnackBar } from '@angular/material';
|
||||
|
||||
@Component({
|
||||
@ -52,20 +52,23 @@ export class FileViewComponent implements OnInit {
|
||||
showLeftSidebar = null;
|
||||
showRightSidebar = false;
|
||||
customToolbar = false;
|
||||
isCommentEnabled = true;
|
||||
|
||||
constructor(private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private snackBar: MatSnackBar,
|
||||
private apiService: AlfrescoApiService) {
|
||||
private nodeApiService: NodesApiService,
|
||||
private contentServices: ContentService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe(params => {
|
||||
const id = params.nodeId;
|
||||
if (id) {
|
||||
this.apiService.getInstance().nodes.getNodeInfo(id).then(
|
||||
this.nodeApiService.getNode(id).subscribe(
|
||||
(node) => {
|
||||
if (node && node.isFile) {
|
||||
this.isCommentEnabled = !this.contentServices.hasPermission(node, PermissionsEnum.UPDATE);
|
||||
this.nodeId = id;
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user