(core) clean up a collection of small problems affecting grist-core

Summary:
 * Remove adjustSession hack, interfering with loading docs under saml.
 * Allow the anonymous user to receive an empty list of workspaces for
   the merged org.
 * Behave better on first page load when org is in path - this used to
   fail because of lack of cookie.  This is very visible in grist-core,
   as a failure to load localhost:8484 on first visit.
 * Mark cookie explicitly as SameSite=Lax to remove a warning in firefox.
 * Make errorPages available in grist-core.

This changes the default behavior of grist-core to now start off in
anonymous mode, with an explicit sign-in step available.  If SAML is not configured,
the sign-in operation will unconditionally sign the user in as a default
user, without any password check or other security.  The user email is
taken from GRIST_DEFAULT_EMAIL if set.  This is a significant change, but
makes anonymous mode available in grist-core (which is convenient
for testing) and makes behavior with and without SAML much more consistent.

Test Plan: updated test; manual (time to start adding grist-core tests though!)

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2980
This commit is contained in:
Paul Fitzpatrick
2021-08-17 11:22:30 -04:00
parent e6e792655b
commit f9630b3aa4
17 changed files with 193 additions and 132 deletions

View File

@@ -81,7 +81,7 @@ export class TestingHooks implements ITestingHooks {
log.info("TestingHooks.setServerVersion called with", version);
this._comm.setServerVersion(version);
for (const server of this._workerServers) {
server.comm.setServerVersion(version);
server.getComm().setServerVersion(version);
}
}
@@ -89,7 +89,7 @@ export class TestingHooks implements ITestingHooks {
log.info("TestingHooks.disconnectClients called");
this._comm.destroyAllClients();
for (const server of this._workerServers) {
server.comm.destroyAllClients();
server.getComm().destroyAllClients();
}
}
@@ -97,7 +97,7 @@ export class TestingHooks implements ITestingHooks {
log.info("TestingHooks.commShutdown called");
await this._comm.testServerShutdown();
for (const server of this._workerServers) {
await server.comm.testServerShutdown();
await server.getComm().testServerShutdown();
}
}
@@ -105,7 +105,7 @@ export class TestingHooks implements ITestingHooks {
log.info("TestingHooks.commRestart called");
await this._comm.testServerRestart();
for (const server of this._workerServers) {
await server.comm.testServerRestart();
await server.getComm().testServerRestart();
}
}
@@ -115,7 +115,7 @@ export class TestingHooks implements ITestingHooks {
log.info("TestingHooks.setClientPersistence called with", ttlMs);
this._comm.testSetClientPersistence(ttlMs);
for (const server of this._workerServers) {
server.comm.testSetClientPersistence(ttlMs);
server.getComm().testSetClientPersistence(ttlMs);
}
}
@@ -153,9 +153,9 @@ export class TestingHooks implements ITestingHooks {
public async flushAuthorizerCache(): Promise<void> {
log.info("TestingHooks.flushAuthorizerCache called");
this._server.dbManager.flushDocAuthCache();
this._server.getHomeDBManager().flushDocAuthCache();
for (const server of this._workerServers) {
server.dbManager.flushDocAuthCache();
server.getHomeDBManager().flushDocAuthCache();
}
}