mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-07 18:25:09 +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 [title]="'APP.INFO_DRAWER.TITLE' | translate">
|
||||||
|
|
||||||
<adf-info-drawer-tab [label]="'APP.INFO_DRAWER.COMMENTS' | 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>
|
||||||
|
|
||||||
<adf-info-drawer-tab [label]="'APP.INFO_DRAWER.PROPERTIES' | translate">
|
<adf-info-drawer-tab [label]="'APP.INFO_DRAWER.PROPERTIES' | translate">
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
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';
|
import { MatSnackBar } from '@angular/material';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -52,20 +52,23 @@ export class FileViewComponent implements OnInit {
|
|||||||
showLeftSidebar = null;
|
showLeftSidebar = null;
|
||||||
showRightSidebar = false;
|
showRightSidebar = false;
|
||||||
customToolbar = false;
|
customToolbar = false;
|
||||||
|
isCommentEnabled = true;
|
||||||
|
|
||||||
constructor(private router: Router,
|
constructor(private router: Router,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private snackBar: MatSnackBar,
|
private snackBar: MatSnackBar,
|
||||||
private apiService: AlfrescoApiService) {
|
private nodeApiService: NodesApiService,
|
||||||
|
private contentServices: ContentService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
const id = params.nodeId;
|
const id = params.nodeId;
|
||||||
if (id) {
|
if (id) {
|
||||||
this.apiService.getInstance().nodes.getNodeInfo(id).then(
|
this.nodeApiService.getNode(id).subscribe(
|
||||||
(node) => {
|
(node) => {
|
||||||
if (node && node.isFile) {
|
if (node && node.isFile) {
|
||||||
|
this.isCommentEnabled = !this.contentServices.hasPermission(node, PermissionsEnum.UPDATE);
|
||||||
this.nodeId = id;
|
this.nodeId = id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user