(core) start reconciling forking with granular access

Summary:
This allows a fork to be made by a user if:
 * That user is an owner of the document being forked, or
 * That user has full read access to the document being forked.

The bulk of the diff is reorganization of how forking is done.  ActiveDoc.fork is now responsible for creating a fork, not just a docId/urlId for the fork. Since fork creation should not be limited to the doc worker hosting the trunk, a helper endpoint is added for placing the fork.

The change required sanitizing worker allocation a bit, and allowed session knowledge to be removed from HostedStorageManager.

Test Plan: Added test; existing tests pass.

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2700
This commit is contained in:
Paul Fitzpatrick
2021-01-12 10:48:40 -05:00
parent 68a682f876
commit 438f259687
16 changed files with 193 additions and 69 deletions

View File

@@ -2,6 +2,7 @@ import {SessionUserObj} from 'app/server/lib/BrowserSession';
import * as Comm from 'app/server/lib/Comm';
import {Hosts} from 'app/server/lib/extractOrg';
import {ICreate} from 'app/server/lib/ICreate';
import {IPermitStore} from 'app/server/lib/Permit';
import {Sessions} from 'app/server/lib/Sessions';
import * as express from 'express';
@@ -14,6 +15,7 @@ export interface GristServer {
getHost(): string;
getHomeUrl(req: express.Request, relPath?: string): string;
getHomeUrlByDocId(docId: string, relPath?: string): Promise<string>;
getPermitStore(): IPermitStore;
}
export interface GristLoginMiddleware {