[ACS-6445] Address #PT20471_7 Missing Access Control (#3627)

This commit is contained in:
Mykyta Maliarchuk
2024-02-05 14:59:07 +01:00
committed by GitHub
parent 4393f337c5
commit bcb7e634d9
4 changed files with 45 additions and 8 deletions

View File

@@ -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', () => {