mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-8694] Cleanup of visibility rules for extensions in ACA (#4140)
* [ACS-8694] Updated occurrences of visible in extensions.json to use arrays instead of single strings. Cleaned up rules in aca-content.module.ts * [ACS-8694] Removed extra commas * [ACS-8694] Broke down canDelete rule into seperate entities * [ACS-8694] Fixed typo for notEmpty rule * [ACS-8694] Fixed rule for edit offline * [ACS-8694] Updated extension.schema.json * [ACS-8694] Updated extension.schema.json * [ACS-8694] Fixed rule for manage versions context menu item * [ACS-8694] Fixed rule for manage versions and manage permissions * [ACS-8694] Added rules.canManageFolderRules * [ACS-8694] Fixed typo * [ACS-8694] Updated visibility rules for folder rules and AOS plugin * [ACS-8694] Updated extension.schema.json * [ACS-8694] Updated existing rules to use !isTrashcan() instead of isNotTrashcan() * [ACS-8694] folder-rules.plugin.json now uses arrays for controlling visibility * [ACS-8694] Updated app.extensions.schema * [ACS-8694] Removed unused rules * [ACS-8694] Added unit tests for canToggleFileLock * [ACS-8694] Added rules-list.md * [ACS-8694] Revert unneeded project.json change * [ACS-8694] Fixed toggleEditOffline rule * [ACS-8694] Added migration guide (#4139) * [ACS-8694] Added migration guide * [ACS-8694] Fixed typo * [ACS-8694] Added missing rule migration. Fixed incorrect rule migration. Fixed typos * [ACS-8694] Code review finding - Replaced instance of any * [ACS-8694] Code review finding - Updated rules.md. Removed duplication of rules list from rules-list.md. Added pointer to rules-list.md under tips section * [ACS-8694] Fixed build issue * [ACS-8694] Removed unneeded isNotDetails rule
This commit is contained in:
@@ -77,7 +77,7 @@ export class AcaFolderRulesModule {
|
||||
translation.addTranslationFolder('folder-rules', 'assets/folder-rules');
|
||||
|
||||
extensions.setEvaluators({
|
||||
'rules.canManageFolderRules': rules.canManageFolderRules
|
||||
'rules.isFolderRulesEnabled': rules.isFolderRulesEnabled
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,7 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AcaRuleContext } from '@alfresco/aca-shared/rules';
|
||||
import { canManageFolderRules, isFolderRulesEnabled } from './folder-rules.rules';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
import { isFolderRulesEnabled } from './folder-rules.rules';
|
||||
|
||||
describe('Folder Rules Visibility Rules', () => {
|
||||
describe('isFolderRulesEnabled', () => {
|
||||
@@ -50,44 +48,4 @@ describe('Folder Rules Visibility Rules', () => {
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canManageFolderRules', () => {
|
||||
let context: AcaRuleContext;
|
||||
|
||||
beforeEach(() => {
|
||||
context = {
|
||||
appConfig: {
|
||||
get: () => true
|
||||
},
|
||||
selection: {
|
||||
folder: {} as any
|
||||
},
|
||||
navigation: {
|
||||
url: '/personal-files'
|
||||
},
|
||||
permissions: {
|
||||
check: () => true
|
||||
}
|
||||
} as any;
|
||||
});
|
||||
|
||||
it('should allow creating a rule for the selected folder', () => {
|
||||
const result = canManageFolderRules(context);
|
||||
expect(result).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not allow creating a rule if no folder selected', () => {
|
||||
context.selection.folder = null;
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -22,10 +22,6 @@
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { AcaRuleContext, canEditFolder, hasFolderSelected, isNotFavorites, isSmartFolder } from '@alfresco/aca-shared/rules';
|
||||
import { AcaRuleContext } 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) && !isSmartFolder(context);
|
||||
|
||||
export const canManageFolderRules = (context: AcaRuleContext): boolean => isFolderRulesAllowed(context);
|
||||
|
Reference in New Issue
Block a user