mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
edit node permission (#261)
This commit is contained in:
committed by
suzanadirla
parent
56ddeb8c40
commit
ded29aee4d
@@ -181,7 +181,12 @@
|
|||||||
|
|
||||||
<adf-info-drawer title="Details">
|
<adf-info-drawer title="Details">
|
||||||
<adf-info-drawer-tab label="Properties">
|
<adf-info-drawer-tab label="Properties">
|
||||||
|
<div *ngIf="infoInstance.loading">
|
||||||
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
<adf-content-metadata-card
|
<adf-content-metadata-card
|
||||||
|
[readOnly]="!canUpdate(documentList.selection)"
|
||||||
[displayEmpty]="true"
|
[displayEmpty]="true"
|
||||||
[preset]="'custom'"
|
[preset]="'custom'"
|
||||||
[node]="infoInstance.node">
|
[node]="infoInstance.node">
|
||||||
|
@@ -188,7 +188,12 @@
|
|||||||
|
|
||||||
<adf-info-drawer title="Details">
|
<adf-info-drawer title="Details">
|
||||||
<adf-info-drawer-tab label="Properties">
|
<adf-info-drawer-tab label="Properties">
|
||||||
|
<div *ngIf="infoInstance.loading">
|
||||||
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
<adf-content-metadata-card
|
<adf-content-metadata-card
|
||||||
|
[readOnly]="!canUpdate(documentList.selection)"
|
||||||
[displayEmpty]="true"
|
[displayEmpty]="true"
|
||||||
[preset]="'custom'"
|
[preset]="'custom'"
|
||||||
[node]="infoInstance.node">
|
[node]="infoInstance.node">
|
||||||
|
@@ -346,4 +346,40 @@ describe('PageComponent', () => {
|
|||||||
expect(component.canMoveShared(selection)).toBe(false);
|
expect(component.canMoveShared(selection)).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('canUpdate()', () => {
|
||||||
|
it('should return true if node can be edited', () => {
|
||||||
|
const selection = [ { entry: {
|
||||||
|
allowableOperations: ['update']
|
||||||
|
} } ];
|
||||||
|
|
||||||
|
expect(component.canUpdate(selection)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should return false if node cannot be edited`, () => {
|
||||||
|
const selection = [ { entry: {
|
||||||
|
allowableOperations: ['other-permission']
|
||||||
|
} } ];
|
||||||
|
|
||||||
|
expect(component.canUpdate(selection)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('canUpdateShared()', () => {
|
||||||
|
it('should return true if shared node can be edited', () => {
|
||||||
|
const selection = [ { entry: {
|
||||||
|
allowableOperationsOnTarget: ['update']
|
||||||
|
} } ];
|
||||||
|
|
||||||
|
expect(component.canUpdateShared(selection)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should return false if shared node cannot be edited`, () => {
|
||||||
|
const selection = [ { entry: {
|
||||||
|
allowableOperationsOnTarget: ['other-permission']
|
||||||
|
} } ];
|
||||||
|
|
||||||
|
expect(component.canUpdateShared(selection)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -124,6 +124,14 @@ export abstract class PageComponent {
|
|||||||
return selection.every(node => node.entry && this.nodeSharedHasPermission(node.entry, 'delete'));
|
return selection.every(node => node.entry && this.nodeSharedHasPermission(node.entry, 'delete'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
canUpdate(selection: Array<MinimalNodeEntity> = []): boolean {
|
||||||
|
return selection.every(node => node.entry && this.nodeHasPermission(node.entry, 'update'));
|
||||||
|
}
|
||||||
|
|
||||||
|
canUpdateShared(selection: Array<MinimalNodeEntity> = []): boolean {
|
||||||
|
return selection.every(node => node.entry && this.nodeSharedHasPermission(node.entry, 'update'));
|
||||||
|
}
|
||||||
|
|
||||||
canPreviewFile(selection: Array<MinimalNodeEntity>): boolean {
|
canPreviewFile(selection: Array<MinimalNodeEntity>): boolean {
|
||||||
return this.isFileSelected(selection);
|
return this.isFileSelected(selection);
|
||||||
}
|
}
|
||||||
|
@@ -170,7 +170,12 @@
|
|||||||
|
|
||||||
<adf-info-drawer title="Details">
|
<adf-info-drawer title="Details">
|
||||||
<adf-info-drawer-tab label="Properties">
|
<adf-info-drawer-tab label="Properties">
|
||||||
|
<div *ngIf="infoInstance.loading">
|
||||||
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
<adf-content-metadata-card
|
<adf-content-metadata-card
|
||||||
|
[readOnly]="!canUpdate(documentList.selection)"
|
||||||
[displayEmpty]="true"
|
[displayEmpty]="true"
|
||||||
[preset]="'custom'"
|
[preset]="'custom'"
|
||||||
[node]="infoInstance.node">
|
[node]="infoInstance.node">
|
||||||
|
@@ -187,7 +187,12 @@
|
|||||||
|
|
||||||
<adf-info-drawer title="Details">
|
<adf-info-drawer title="Details">
|
||||||
<adf-info-drawer-tab label="Properties">
|
<adf-info-drawer-tab label="Properties">
|
||||||
|
<div *ngIf="infoInstance.loading">
|
||||||
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
|
</div>
|
||||||
|
|
||||||
<adf-content-metadata-card
|
<adf-content-metadata-card
|
||||||
|
[readOnly]="!canUpdateShared(documentList.selection)"
|
||||||
[displayEmpty]="true"
|
[displayEmpty]="true"
|
||||||
[preset]="'custom'"
|
[preset]="'custom'"
|
||||||
[node]="infoInstance.node">
|
[node]="infoInstance.node">
|
||||||
|
Reference in New Issue
Block a user