mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(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:
@@ -35,14 +35,8 @@ export function makeForkIds(options: { userId: number|null, isAnonymous: boolean
|
||||
};
|
||||
}
|
||||
|
||||
// For importing, we can assign any worker to the job. As a hack, we reuse the document
|
||||
// assignment mechanism. To spread the work around a bit if we have several doc workers,
|
||||
// we use a fake document id between import0 and import9.
|
||||
// This method takes a DocWorkerMap to allow for something smarter in future.
|
||||
// This used to do a hack for importing, but now does nothing.
|
||||
// Instead, the server will interpret the special docId "import".
|
||||
export function getAssignmentId(docWorkerMap: IDocWorkerMap, docId: string): string {
|
||||
let assignmentId = docId;
|
||||
if (assignmentId === 'import') {
|
||||
assignmentId = `import${Math.round(Math.random() * 10)}`;
|
||||
}
|
||||
return assignmentId;
|
||||
return docId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user