[ACS-6278] - stop showing 'edit aspects' and 'manage rules' when node is a smart folder (#3512)

* [ACS-6278] - stop showing 'edit aspects' and 'manage rules' when node is a smart folder
This commit is contained in:
DominikIwanek
2023-11-09 09:30:21 +01:00
committed by GitHub
parent b54016bdfd
commit b5d561dc5e
2 changed files with 106 additions and 3 deletions

View File

@@ -495,7 +495,8 @@ export const canEditAspects = (context: RuleContext): boolean =>
canUpdateSelectedNode(context),
!isWriteLocked(context),
navigation.isNotTrashcan(context),
repository.isMajorVersionAvailable(context, '7')
repository.isMajorVersionAvailable(context, '7'),
!isSmartFolder(context)
].every(Boolean);
/**
@@ -505,7 +506,7 @@ export const canEditAspects = (context: RuleContext): boolean =>
* @param context Rule execution context
*/
export const canManagePermissions = (context: RuleContext): boolean =>
[canUpdateSelectedNode(context), navigation.isNotTrashcan(context)].every(Boolean);
[canUpdateSelectedNode(context), navigation.isNotTrashcan(context), !isSmartFolder(context)].every(Boolean);
/**
* Checks if user can toggle **Edit Offline** mode for selected node.
@@ -624,3 +625,15 @@ export function canOpenWithOffice(context: AcaRuleContext): boolean {
return context.permissions.check(file, ['update']);
}
function isSmartFolder(context: RuleContext): boolean {
if (!context.selection?.isEmpty) {
const node = context.selection.first;
if (!node?.entry.isFolder) {
return false;
}
const nodeAspects = node.entry?.aspectNames ?? [];
return nodeAspects.includes('smf:customConfigSmartFolder') || nodeAspects.includes('smf:systemConfigSmartFolder');
}
return false;
}