diff --git a/projects/aca-content/src/lib/aca-content.module.ts b/projects/aca-content/src/lib/aca-content.module.ts
index 1f5c53167..a986bf072 100644
--- a/projects/aca-content/src/lib/aca-content.module.ts
+++ b/projects/aca-content/src/lib/aca-content.module.ts
@@ -33,7 +33,12 @@ import {
LibraryStatusColumnComponent,
TrashcanNameColumnComponent
} from '@alfresco/adf-content-services';
-import { DocumentBasePageService, ExtensionsDataLoaderGuard, provideContentAppExtensions } from '@alfresco/aca-shared';
+import {
+ DocumentBasePageService,
+ ExtensionsDataLoaderGuard,
+ EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE,
+ provideContentAppExtensions
+} from '@alfresco/aca-shared';
import * as rules from '@alfresco/aca-shared/rules';
import { AppStoreModule } from './store/app-store.module';
import { provideAppExtensions, provideExtensions } from '@alfresco/adf-extensions';
@@ -66,6 +71,7 @@ import { SHELL_NAVBAR_MIN_WIDTH, ShellLayoutComponent } from '@alfresco/adf-core
import { UserMenuComponent } from './components/sidenav/user-menu/user-menu.component';
import { MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
import { SearchResultsRowComponent } from './components/search/search-results-row/search-results-row.component';
+import { AcaNodePermissionCommentsService } from './services/aca-node-permission-comments.service';
import { BulkActionsDropdownComponent } from './components/bulk-actions-dropdown/bulk-actions-dropdown.component';
import { AgentsButtonComponent } from './components/knowledge-retrieval/search-ai/agents-button/agents-button.component';
import { SaveSearchSidenavComponent } from './components/search/search-save/sidenav/save-search-sidenav.component';
@@ -86,6 +92,11 @@ import { IsFeatureSupportedInCurrentAcsPipe } from './pipes/is-feature-supported
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: { closeOnNavigation: true, hasBackdrop: true, autoFocus: true }
},
+ {
+ provide: EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE,
+ useClass: AcaNodePermissionCommentsService,
+ multi: true
+ },
provideExtensions({
authGuards: {
'app.auth': AuthGuardEcm,
diff --git a/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.spec.ts b/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.spec.ts
index 9d8b08630..9ac1e6bcf 100644
--- a/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.spec.ts
+++ b/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.spec.ts
@@ -24,11 +24,10 @@
import { CommentsTabComponent } from './comments-tab.component';
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { NodePermissionService } from '@alfresco/aca-shared';
+import { EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE, NodePermissionService } from '@alfresco/aca-shared';
import { Node } from '@alfresco/js-api';
import { of } from 'rxjs';
import { AuthenticationService, NoopTranslateModule } from '@alfresco/adf-core';
-import { ExternalNodePermissionCommentsTabService } from '@alfresco/aca-content';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
describe('CommentsTabComponent', () => {
@@ -43,7 +42,7 @@ describe('CommentsTabComponent', () => {
imports: [NoopTranslateModule, CommentsTabComponent],
providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
- { provide: ExternalNodePermissionCommentsTabService, useValue: { canAddComments: () => canAddComment } },
+ { provide: EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE, useValue: [{ canAddComments: () => canAddComment }] },
{ provide: AuthenticationService, useValue: { onLogout: of({}) } }
]
});
diff --git a/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.ts b/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.ts
index 78efd870b..7d5542dfa 100644
--- a/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.ts
+++ b/projects/aca-content/src/lib/components/info-drawer/comments-tab/comments-tab.component.ts
@@ -22,12 +22,16 @@
* from Hyland Software. If not, see .
*/
-import { Component, Input, OnInit, Optional, ViewEncapsulation } from '@angular/core';
+import { Component, Inject, Input, OnInit, ViewEncapsulation } from '@angular/core';
import { Node } from '@alfresco/js-api';
-import { isLocked, NodePermissionService } from '@alfresco/aca-shared';
+import {
+ EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE,
+ ExternalNodePermissionCommentsTabService,
+ isLocked,
+ NodePermissionService
+} from '@alfresco/aca-shared';
import { MatCardModule } from '@angular/material/card';
import { NodeCommentsComponent } from '@alfresco/adf-content-services';
-import { ExternalNodePermissionCommentsTabService } from './external-node-permission-comments-tab.service';
@Component({
imports: [MatCardModule, NodeCommentsComponent],
@@ -47,7 +51,8 @@ export class CommentsTabComponent implements OnInit {
constructor(
private readonly permission: NodePermissionService,
- @Optional() private readonly externalPermissionNodeService: ExternalNodePermissionCommentsTabService
+ @Inject(EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE)
+ private readonly externalPermissionNodeService: ExternalNodePermissionCommentsTabService[]
) {}
ngOnInit(): void {
@@ -56,8 +61,8 @@ export class CommentsTabComponent implements OnInit {
}
if (this.node.isFolder || (this.node.isFile && !isLocked({ entry: this.node }))) {
this.canUpdateNode = this.permission.check(this.node, ['update']);
- if (this.externalPermissionNodeService) {
- this.canUpdateNode &&= this.externalPermissionNodeService.canAddComments(this.node);
+ if (this.externalPermissionNodeService?.length) {
+ this.canUpdateNode &&= this.externalPermissionNodeService.every((service) => service.canAddComments(this.node));
}
}
}
diff --git a/projects/aca-content/src/lib/services/aca-node-permission-comments.service.spec.ts b/projects/aca-content/src/lib/services/aca-node-permission-comments.service.spec.ts
new file mode 100644
index 000000000..5014b0da4
--- /dev/null
+++ b/projects/aca-content/src/lib/services/aca-node-permission-comments.service.spec.ts
@@ -0,0 +1,64 @@
+/*!
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { Node } from '@alfresco/js-api';
+import { AcaNodePermissionCommentsService } from './aca-node-permission-comments.service';
+
+describe('AcaNodePermissionCommentsService', () => {
+ let service: AcaNodePermissionCommentsService;
+
+ beforeEach(() => {
+ service = new AcaNodePermissionCommentsService();
+ });
+
+ it('should return false when node type is blacklisted', () => {
+ const node = { nodeType: 'rma:hold', aspectNames: [] } as Node;
+
+ expect(service.canAddComments(node)).toBeFalse();
+ });
+
+ it('should return false when node has a blacklisted aspect', () => {
+ const node = { nodeType: 'cm:content', aspectNames: ['rma:frozen'] } as Node;
+
+ expect(service.canAddComments(node)).toBeFalse();
+ });
+
+ it('should return false when node has both blacklisted type and aspect', () => {
+ const node = { nodeType: 'rma:hold', aspectNames: ['rma:frozen'] } as Node;
+
+ expect(service.canAddComments(node)).toBeFalse();
+ });
+
+ it('should return true when node type and aspects are not blacklisted', () => {
+ const node = { nodeType: 'cm:content', aspectNames: ['cm:titled'] } as Node;
+
+ expect(service.canAddComments(node)).toBeTrue();
+ });
+
+ it('should return true when aspectNames is missing and node type is allowed', () => {
+ const node = { nodeType: 'cm:content' } as Node;
+
+ expect(service.canAddComments(node)).toBeTrue();
+ });
+});
diff --git a/projects/aca-content/src/lib/services/aca-node-permission-comments.service.ts b/projects/aca-content/src/lib/services/aca-node-permission-comments.service.ts
new file mode 100644
index 000000000..766d62d35
--- /dev/null
+++ b/projects/aca-content/src/lib/services/aca-node-permission-comments.service.ts
@@ -0,0 +1,47 @@
+/*!
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { Node } from '@alfresco/js-api';
+import { ExternalNodePermissionCommentsTabService } from '@alfresco/aca-shared';
+
+type DenyRule = (node: Node) => boolean;
+
+export class AcaNodePermissionCommentsService implements ExternalNodePermissionCommentsTabService {
+ private readonly blacklistedTypes = new Set(['rma:hold']);
+ private readonly blacklistedAspects = new Set(['rma:frozen']);
+
+ private readonly denyRules: ReadonlyArray = [(node) => this.hasBlacklistedAspect(node), (node) => this.hasBlacklistedType(node)];
+
+ canAddComments(node: Node): boolean {
+ return this.denyRules.every((rule) => !rule(node));
+ }
+
+ private hasBlacklistedAspect(node: Node): boolean {
+ return (node.aspectNames ?? []).some((aspect) => this.blacklistedAspects.has(aspect));
+ }
+
+ private hasBlacklistedType(node: Node): boolean {
+ return this.blacklistedTypes.has(node.nodeType ?? '');
+ }
+}
diff --git a/projects/aca-shared/src/lib/models/external-nodes-permission-comments.interface.ts b/projects/aca-shared/src/lib/models/external-nodes-permission-comments.interface.ts
new file mode 100644
index 000000000..84d44d04b
--- /dev/null
+++ b/projects/aca-shared/src/lib/models/external-nodes-permission-comments.interface.ts
@@ -0,0 +1,29 @@
+/*!
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { Node } from '@alfresco/js-api';
+
+export interface ExternalNodePermissionCommentsTabService {
+ canAddComments(node: Node): boolean;
+}
diff --git a/projects/aca-shared/src/lib/utils/external-node-comments-permissions.token.ts b/projects/aca-shared/src/lib/utils/external-node-comments-permissions.token.ts
new file mode 100644
index 000000000..8e4ffcd46
--- /dev/null
+++ b/projects/aca-shared/src/lib/utils/external-node-comments-permissions.token.ts
@@ -0,0 +1,30 @@
+/*!
+ * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
+ *
+ * Alfresco Example Content Application
+ *
+ * This file is part of the Alfresco Example Content Application.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * from Hyland Software. If not, see .
+ */
+
+import { InjectionToken } from '@angular/core';
+import { ExternalNodePermissionCommentsTabService } from '../models/external-nodes-permission-comments.interface';
+
+export const EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE = new InjectionToken(
+ 'ExternalNodePermissionCommentsTabService'
+);
diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts
index 9ee7a54eb..f53c0154b 100644
--- a/projects/aca-shared/src/public-api.ts
+++ b/projects/aca-shared/src/public-api.ts
@@ -46,6 +46,7 @@ export * from './lib/directives/pagination.directive';
export * from './lib/models/types';
export * from './lib/models/viewer.rules';
+export * from './lib/models/external-nodes-permission-comments.interface';
export * from './lib/routing/shared.guard';
export * from './lib/routing/plugin-enabled.guard';
@@ -64,6 +65,7 @@ export * from './lib/services/navigation-history.service';
export * from './lib/testing/lib-testing-module';
export * from './lib/utils/node.utils';
+export * from './lib/utils/external-node-comments-permissions.token';
export * from './lib/validators/no-whitespace.validator';
export * from './lib/validators/no-leading-trailing-operators.validator';