user options extension and rules

This commit is contained in:
pionnegru
2020-01-07 20:31:50 +02:00
parent 5396b3591c
commit 427ae8aeff
3 changed files with 53 additions and 2 deletions

View File

@@ -27,6 +27,11 @@ import { RuleContext } from '@alfresco/adf-extensions';
import * as navigation from './navigation.rules';
import * as repository from './repository.rules';
export interface AcaRuleContext extends RuleContext {
languagePicker: boolean;
withCredentials: boolean;
}
/**
* Checks if user can copy selected node.
* JSON ref: `app.canCopyNode`
@@ -526,3 +531,21 @@ export function canToggleFavorite(context: RuleContext): boolean {
].some(Boolean)
].every(Boolean);
}
/**
* Checks if application should render language picker menu.
* JSON ref: `canShowLanguagePicker`
* @param context Rule execution context
*/
export function canShowLanguagePicker(context: AcaRuleContext): boolean {
return context.languagePicker;
}
/**
* Checks if application should render logout option.
* JSON ref: `canShowLogout`
* @param context Rule execution context
*/
export function canShowLogout(context: AcaRuleContext): boolean {
return !context.withCredentials;
}