mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-3427] Remove About tab when it's not useful (#1491)
* [ACA-3427] Remove About tab when it's not useful * Add unit tests for isLibraryManager rule * Fix e2e tests * Fix e2e tests and add rule to docs * Fix e2e tests
This commit is contained in:
@@ -475,4 +475,34 @@ describe('app.evaluators', () => {
|
||||
expect(app.canShowLogout(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isLibraryManager', () => {
|
||||
it('should return true when role is SiteManager', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
library: {
|
||||
entry: {
|
||||
role: 'SiteManager'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isLibraryManager(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when role is different than SiteManager', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
library: {
|
||||
entry: {
|
||||
role: 'SiteCollaborator'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
expect(app.isLibraryManager(context)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -546,3 +546,16 @@ export function canShowLanguagePicker(context: AcaRuleContext): boolean {
|
||||
export function canShowLogout(context: AcaRuleContext): boolean {
|
||||
return !context.withCredentials;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user is library manager
|
||||
* JSON ref: `isLibraryManager`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function isLibraryManager(context: RuleContext): boolean {
|
||||
return (
|
||||
hasLibrarySelected(context) &&
|
||||
context.selection.library.entry &&
|
||||
context.selection.library.entry.role === 'SiteManager'
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user