mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
* [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
4.5 KiB
4.5 KiB
Title
Title |
---|
Legacy Rules for ACA |
Legacy rules
Below is a list of all unused rules that were removed with ACA 5.1.1. You may use them as a reference in case your application/extension is still dependent on them, however we do advise that you revisit those implementations and substitute them with a different approach, since these rules will no longer be supported.
/**
* app.selection.file.canLock
* Checks if user can lock selected file.
*/
export const canLockFile = (context: RuleContext): boolean => !isWriteLocked(context) && canUpdateSelectedNode(context);
/**
* app.selection.file.canUnlock
* Checks if user can unlock selected file.
*/
export function canUnlockFile(context: RuleContext): boolean {
const { file } = context.selection;
return isWriteLocked(context) && (context.permissions.check(file?.entry, ['delete']) || isUserWriteLockOwner(context));
}
/**
* app.selection.file.isLockOwner
* Checks if the selected file has **write** or **read-only** locks specified,
* and that current user is the owner of the lock.
*/
export const isUserWriteLockOwner = (context: RuleContext): boolean =>
isWriteLocked(context) &&
context.selection.file?.entry.properties['cm:lockOwner'] &&
context.selection.file?.entry.properties['cm:lockOwner'].id === context.profile.id;
/**
* app.selection.file.canShare
* Checks if user can share selected file.
*/
export const canShareFile = (context: RuleContext): boolean =>
[context.selection.file, navigation.isNotTrashcan(context), repository.hasQuickShareEnabled(context), !isShared(context)].every(Boolean);
/**
* app.selection.canUnshare
* Checks if user can un-share selected nodes.
*/
export function canUnshareNodes(context: RuleContext): boolean {
if (hasSelection(context)) {
return context.permissions.check(context.selection.nodes, ['delete'], {
target: 'allowableOperationsOnTarget'
});
}
return false;
}
/**
* app.selection.file.isShared
* Checks if the selected file is already shared.
*/
export function isShared(context: RuleContext): boolean {
if (navigation.isSharedFiles(context) && context.selection.file) {
return true;
}
if (navigation.isNotTrashcan(context) && hasSelection(context) && context.selection.file) {
return !!context.selection.file.entry?.properties?.['qshare:sharedId'];
}
return false;
}
/**
* app.selection.isPrivateLibrary
* Checks if user has selected a **private** library (site)
*/
export function isPrivateLibrary(context: RuleContext): boolean {
return context.selection.library?.entry?.visibility === 'PRIVATE';
}
/**
* app.selection.hasNoLibraryRole
* Checks if the selected library has no **role** property defined.
*/
export const hasNoLibraryRole = (context: RuleContext): boolean => !hasLibraryRole(context);
/**
* app.navigation.isLibraryFiles
* Checks if a **Library Files** route is activated.
*/
export function isLibraryFiles(context: RuleContext): boolean {
const { url } = context.navigation;
return url?.startsWith('/libraries');
}
/**
* app.navigation.isPersonalFiles
* Checks if a **Personal Files** route is activated.
*/
export function isPersonalFiles(context: RuleContext): boolean {
const { url } = context.navigation;
return url?.startsWith('/personal-files');
}
/**
* app.navigation.isSharedPreview
* Checks if a **Shared Preview** route is activated.
*/
export function isSharedPreview(context: RuleContext): boolean {
const { url } = context.navigation;
return url?.startsWith('/shared/preview/') || (url?.startsWith('/shared') && url?.includes('viewer:view'));
}
/**
* app.navigation.isFavoritesPreview
* Checks if a **Favorites Preview** route is activated.
*/
export function isFavoritesPreview(context: RuleContext): boolean {
const { url } = context.navigation;
return url?.startsWith('/favorites/preview/') || (url?.startsWith('/favorites') && url?.includes('viewer:view'));
}
/**
* app.navigation.isSharedFileViewer
* Checks if a **Shared File Preview** route is activated.
*/
export function isSharedFileViewer(context: RuleContext): boolean {
const { url } = context.navigation;
return url?.startsWith('/preview/s/');
}
/**
* repository.isQuickShareEnabled
* Checks if the quick share repository option is enabled or not.
*/
export const hasQuickShareEnabled = (context: RuleContext): boolean => context.repository.status.isQuickShareEnabled;
/**
* user.isAdmin
* Checks if user is admin.
*/
export const isAdmin = (context: RuleContext): boolean => context.profile.isAdmin;