Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/utils/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export async function getAclCtx(env, org, users, key, api) {
// Expose the action trace or not?
actionTrace = users.every((u) => aclTrace.includes(u.email)) ? actionTrace : undefined;

if (k === 'CONFIG') {
if (k === 'CONFIG' || api === 'versionsource') {
actionSet.add('read');
}

Expand Down
15 changes: 14 additions & 1 deletion test/utils/auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,20 @@ describe('DA auth', () => {
const users = [{email: "blah@foo.org"}];
const aclCtx = await getAclCtx(env2, 'test', users, '/', 'config');
assert(aclCtx.actionSet.has('read'));
})
});

it('test versionsource api always has read permission', async () => {
const users = [{email: "blah@foo.org"}];
const aclCtx = await getAclCtx(env2, 'test', users, '/', 'versionsource');
assert(aclCtx.actionSet.has('read'));
});

it('test versionsource api grants read permission even without explicit permissions', async () => {
const users = [{email: "unauthorized@example.com"}];
const aclCtx = await getAclCtx(env2, 'test', users, '/restricted', 'versionsource');
assert(aclCtx.actionSet.has('read'));
assert(!aclCtx.actionSet.has('write'));
});
});

describe('persmissions single sheet', () => {
Expand Down