mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-6278] - Permissions manager should not be showed for smart folder (#3580)
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<app-comments-tab *ngIf="node && !isLoading; else loading" [node]="node"></app-comments-tab>
|
<app-comments-tab *ngIf="node && !isLoading; else loading" [node]="node"></app-comments-tab>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="{{ 'APP.INFO_DRAWER.TABS.PERMISSIONS' | translate }}">
|
<mat-tab [disabled]="!canManagePermissions" label="{{ 'APP.INFO_DRAWER.TABS.PERMISSIONS' | translate }}">
|
||||||
<ng-template matTabContent>
|
<ng-template matTabContent>
|
||||||
<adf-permission-list *ngIf="node && !isLoading; else loading" [nodeId]="node.id"></adf-permission-list>
|
<adf-permission-list *ngIf="node && !isLoading; else loading" [nodeId]="node.id"></adf-permission-list>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import { BehaviorSubject, of, Subject } from 'rxjs';
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { ContentApiService } from '@alfresco/aca-shared';
|
import { ContentApiService } from '@alfresco/aca-shared';
|
||||||
import { STORE_INITIAL_APP_DATA, SetSelectedNodesAction, NavigateToFolder } from '@alfresco/aca-shared/store';
|
import { NavigateToFolder, SetSelectedNodesAction, STORE_INITIAL_APP_DATA } from '@alfresco/aca-shared/store';
|
||||||
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
import { NodeEntry, PathElement } from '@alfresco/js-api';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
import { AuthenticationService, PageTitleService } from '@alfresco/adf-core';
|
||||||
@@ -201,4 +201,45 @@ describe('DetailsComponent', () => {
|
|||||||
fail(`An error occurred: ${error}`);
|
fail(`An error occurred: ${error}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should disable the permissions tab for smart folders based on aspects', () => {
|
||||||
|
node.entry.isFolder = true;
|
||||||
|
node.entry.aspectNames = ['smf:customConfigSmartFolder'];
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.ngOnInit();
|
||||||
|
expect(component.canManagePermissions).toBeFalse();
|
||||||
|
expect(component.activeTab).not.toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should enable the permissions tab for regular folders based on aspects', () => {
|
||||||
|
node.entry.isFolder = true;
|
||||||
|
node.entry.aspectNames = [];
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.ngOnInit();
|
||||||
|
|
||||||
|
expect(component.canManagePermissions).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should change active tab based on canManagePermissions and tabName', () => {
|
||||||
|
component.nodeId = 'someNodeId';
|
||||||
|
component.activeTab = 0;
|
||||||
|
|
||||||
|
node.entry.isFolder = true;
|
||||||
|
node.entry.aspectNames = [];
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.ngOnInit();
|
||||||
|
|
||||||
|
component.setActiveTab('permissions');
|
||||||
|
expect(component.activeTab).toBe(2);
|
||||||
|
|
||||||
|
node.entry.isFolder = true;
|
||||||
|
node.entry.aspectNames = ['smf:customConfigSmartFolder'];
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.ngOnInit();
|
||||||
|
|
||||||
|
component.setActiveTab('permissions');
|
||||||
|
expect(component.activeTab).not.toBe(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, OnInit, ViewEncapsulation, OnDestroy } from '@angular/core';
|
import { Component, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
import { ContentApiService, PageComponent, PageLayoutComponent, ToolbarComponent } from '@alfresco/aca-shared';
|
||||||
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
import { NavigateToFolder, NavigateToPreviousPage, SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||||
@@ -68,6 +68,7 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
activeTab = 1;
|
activeTab = 1;
|
||||||
aspectActions: Array<ContentActionRef> = [];
|
aspectActions: Array<ContentActionRef> = [];
|
||||||
nodeIcon: string;
|
nodeIcon: string;
|
||||||
|
canManagePermissions = true;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
|
constructor(private route: ActivatedRoute, private contentApi: ContentApiService, private contentService: ContentService) {
|
||||||
super();
|
super();
|
||||||
@@ -79,7 +80,6 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
const { route } = this;
|
const { route } = this;
|
||||||
const { data } = route.snapshot;
|
const { data } = route.snapshot;
|
||||||
this.title = data.title;
|
this.title = data.title;
|
||||||
|
|
||||||
this.route.params.subscribe((params) => {
|
this.route.params.subscribe((params) => {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.setActiveTab(params.activeTab);
|
this.setActiveTab(params.activeTab);
|
||||||
@@ -87,6 +87,8 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
this.contentApi.getNode(this.nodeId).subscribe((node) => {
|
this.contentApi.getNode(this.nodeId).subscribe((node) => {
|
||||||
this.node = node.entry;
|
this.node = node.entry;
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
|
this.canManagePermissions = !this.isSmartFolder();
|
||||||
|
this.setActiveTab(params.activeTab);
|
||||||
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
||||||
this.nodeIcon = this.contentService.getNodeIcon(this.node);
|
this.nodeIcon = this.contentService.getNodeIcon(this.node);
|
||||||
});
|
});
|
||||||
@@ -105,6 +107,10 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
this.activeTab = 1;
|
this.activeTab = 1;
|
||||||
break;
|
break;
|
||||||
case 'permissions':
|
case 'permissions':
|
||||||
|
if (!this.canManagePermissions) {
|
||||||
|
this.activeTab = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
this.activeTab = 2;
|
this.activeTab = 2;
|
||||||
break;
|
break;
|
||||||
case 'metadata':
|
case 'metadata':
|
||||||
@@ -126,4 +132,12 @@ export class DetailsComponent extends PageComponent implements OnInit, OnDestroy
|
|||||||
this.onDestroy$.next();
|
this.onDestroy$.next();
|
||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isSmartFolder(): boolean {
|
||||||
|
if (!this.node?.isFolder) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const nodeAspects = this.node.aspectNames ?? [];
|
||||||
|
return nodeAspects.includes('smf:customConfigSmartFolder') || nodeAspects.includes('smf:systemConfigSmartFolder');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user