mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACS-6445] Address #PT20471_7 Missing Access Control (#3627)
This commit is contained in:
committed by
GitHub
parent
4393f337c5
commit
bcb7e634d9
@@ -556,7 +556,7 @@ describe('app.evaluators', () => {
|
||||
expect(app.isLibraryManager(context)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when role is different than SiteManager', () => {
|
||||
it('should return false when role is different than SiteManager and user is not an admin', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
library: {
|
||||
@@ -564,11 +564,27 @@ describe('app.evaluators', () => {
|
||||
role: 'SiteCollaborator'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
profile: { isAdmin: false }
|
||||
};
|
||||
|
||||
expect(app.isLibraryManager(context)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true if user is an admin no matter what the role is', () => {
|
||||
const context: any = {
|
||||
selection: {
|
||||
library: {
|
||||
entry: {
|
||||
role: null
|
||||
}
|
||||
}
|
||||
},
|
||||
profile: { isAdmin: true }
|
||||
};
|
||||
|
||||
expect(app.isLibraryManager(context)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('canOpenWithOffice', () => {
|
||||
|
@@ -554,7 +554,7 @@ export const canShowLogout = (context: AcaRuleContext): boolean => !context.with
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export const isLibraryManager = (context: RuleContext): boolean =>
|
||||
hasLibrarySelected(context) && context.selection.library?.entry.role === 'SiteManager';
|
||||
hasLibrarySelected(context) && (context.selection.library?.entry.role === 'SiteManager' || isAdmin(context));
|
||||
|
||||
/**
|
||||
* Checks if the preview button for search results can be showed
|
||||
|
Reference in New Issue
Block a user