mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add methods for quarantining documents
Summary: Adds a new CLI command, doc, with a subcommand that quarantines an active document. Adds a group query param to a housekeeping endpoint for updating the document group prior to checking if a doc needs to be reassigned. Both methods require support user credentials. Test Plan: Server tests. (Additional testing will be done manually on staging.) Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3570
This commit is contained in:
@@ -599,8 +599,15 @@ export class DocWorkerApi {
|
||||
// and frees it for reassignment if not. Has no effect if document is in the
|
||||
// expected group. Does not require specific rights. Returns true if the document
|
||||
// is freed up for reassignment, otherwise false.
|
||||
//
|
||||
// Optionally accepts a `group` query param for updating the document's group prior
|
||||
// to (possible) reassignment. (Note: Requires special permit.)
|
||||
this._app.post('/api/docs/:docId/assign', canEdit, throttled(async (req, res) => {
|
||||
const docId = getDocId(req);
|
||||
const group = optStringParam(req.query.group);
|
||||
if (group && req.specialPermit?.action === 'assign-doc') {
|
||||
await this._docWorkerMap.updateDocGroup(docId, group);
|
||||
}
|
||||
const status = await this._docWorkerMap.getDocWorker(docId);
|
||||
if (!status) { res.json(false); return; }
|
||||
const workerGroup = await this._docWorkerMap.getWorkerGroup(status.docWorker.id);
|
||||
|
||||
@@ -67,6 +67,7 @@ export interface IDocWorkerMap extends IPermitStores, IElectionStore, IChecksumS
|
||||
|
||||
getWorkerGroup(workerId: string): Promise<string|null>;
|
||||
getDocGroup(docId: string): Promise<string|null>;
|
||||
updateDocGroup(docId: string, docGroup: string): Promise<void>;
|
||||
|
||||
getRedisClient(): RedisClient|null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user