[ACS-6278] - disable manage rules for smart folders (#3518)

This commit is contained in:
DominikIwanek
2023-11-14 12:08:07 +01:00
committed by GitHub
parent c9e0f7abe6
commit 57ac20a8c5
4 changed files with 14 additions and 13 deletions

View File

@@ -23,7 +23,8 @@
*/
import { AcaRuleContext } from '@alfresco/aca-shared/rules';
import { isFolderRulesEnabled, canManageFolderRules } from './folder-rules.rules';
import { canManageFolderRules, isFolderRulesEnabled } from './folder-rules.rules';
import { NodeEntry } from '@alfresco/js-api';
describe('Folder Rules Visibility Rules', () => {
describe('isFolderRulesEnabled', () => {
@@ -81,5 +82,12 @@ describe('Folder Rules Visibility Rules', () => {
const result = canManageFolderRules(context);
expect(result).toEqual(false);
});
it('should not allow creating a rule if the selected node is a smart folder', () => {
context.selection.first = { entry: { aspectNames: ['smf:customConfigSmartFolder'], isFolder: true } } as NodeEntry;
const result = canManageFolderRules(context);
expect(result).toBe(false);
});
});
});

View File

@@ -22,10 +22,10 @@
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
*/
import { AcaRuleContext, hasFolderSelected, canEditFolder, isNotFavorites } from '@alfresco/aca-shared/rules';
import { AcaRuleContext, canEditFolder, hasFolderSelected, isNotFavorites, isSmartFolder } from '@alfresco/aca-shared/rules';
export const isFolderRulesEnabled = (context: AcaRuleContext) => context.appConfig.get<boolean>('plugins.folderRules', false);
export const isFolderRulesAllowed = (context: AcaRuleContext) =>
isFolderRulesEnabled(context) && canEditFolder(context) && hasFolderSelected(context) && isNotFavorites(context);
isFolderRulesEnabled(context) && canEditFolder(context) && hasFolderSelected(context) && isNotFavorites(context) && !isSmartFolder(context);
export const canManageFolderRules = (context: AcaRuleContext): boolean => isFolderRulesAllowed(context);