mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
* `GRIST_ANON_PLAYGROUND`: When set to 'false' deny anonymous users access to the home page * `GRIST_FORCE_LOGIN`: Much like `GRIST_ANON_PLAYGROUND` but don't support anonymous access at all (features like sharing docs publicly requires authentication) --------- Co-authored-by: Florent FAYOLLE <florent.fayolle@beta.gouv.fr>
This commit is contained in:
@@ -120,6 +120,24 @@ describe('DocApi', function () {
|
||||
testDocApi();
|
||||
});
|
||||
|
||||
describe('With GRIST_ANON_PLAYGROUND disabled', async () => {
|
||||
setup('anon-playground', async () => {
|
||||
const additionalEnvConfiguration = {
|
||||
ALLOWED_WEBHOOK_DOMAINS: `example.com,localhost:${webhooksTestPort}`,
|
||||
GRIST_DATA_DIR: dataDir,
|
||||
GRIST_ANON_PLAYGROUND: 'false'
|
||||
};
|
||||
home = docs = await TestServer.startServer('home,docs', tmpDir, suitename, additionalEnvConfiguration);
|
||||
homeUrl = serverUrl = home.serverUrl;
|
||||
hasHomeApi = true;
|
||||
});
|
||||
|
||||
it('should not allow anonymous users to create new docs', async () => {
|
||||
const resp = await axios.post(`${serverUrl}/api/docs`, null, nobody);
|
||||
assert.equal(resp.status, 403);
|
||||
});
|
||||
});
|
||||
|
||||
// the way these tests are written, non-merged server requires redis.
|
||||
if (process.env.TEST_REDIS_URL) {
|
||||
describe("should work with a home server and a docworker", async () => {
|
||||
|
||||
Reference in New Issue
Block a user