mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add remaining audit log events
Summary: Adds the remaining batch of audit log events, and a CLI utility to generate documentation for installation and site audit events. Test Plan: Manual. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4356
This commit is contained in:
@@ -90,7 +90,7 @@ describe('HomeDBManager', function() {
|
||||
|
||||
it('can add an org', async function() {
|
||||
const user = await home.getUserByLogin('chimpy@getgrist.com');
|
||||
const orgId = (await home.addOrg(user, {name: 'NewOrg', domain: 'novel-org'}, teamOptions)).data!;
|
||||
const orgId = (await home.addOrg(user, {name: 'NewOrg', domain: 'novel-org'}, teamOptions)).data!.id;
|
||||
const org = await home.getOrg({userId: user.id}, orgId);
|
||||
assert.equal(org.data!.name, 'NewOrg');
|
||||
assert.equal(org.data!.domain, 'novel-org');
|
||||
@@ -109,7 +109,7 @@ describe('HomeDBManager', function() {
|
||||
useNewPlan: true,
|
||||
// omit plan, to use a default one (teamInitial)
|
||||
// it will either be 'stub' or anything set in GRIST_DEFAULT_PRODUCT
|
||||
})).data!;
|
||||
})).data!.id;
|
||||
let org = await home.getOrg({userId: user.id}, orgId);
|
||||
assert.equal(org.data!.name, 'NewOrg');
|
||||
assert.equal(org.data!.domain, 'novel-org');
|
||||
@@ -121,7 +121,7 @@ describe('HomeDBManager', function() {
|
||||
orgId = (await home.addOrg(user, {name: 'NewOrg', domain: 'novel-org'}, {
|
||||
setUserAsOwner: false,
|
||||
useNewPlan: true,
|
||||
})).data!;
|
||||
})).data!.id;
|
||||
|
||||
org = await home.getOrg({userId: user.id}, orgId);
|
||||
assert.equal(org.data!.billingAccount.product.name, STUB_PLAN);
|
||||
@@ -135,7 +135,7 @@ describe('HomeDBManager', function() {
|
||||
const user = await home.getUserByLogin('chimpy@getgrist.com');
|
||||
const domain = 'repeated-domain';
|
||||
const result = await home.addOrg(user, {name: `${domain}!`, domain}, teamOptions);
|
||||
const orgId = result.data!;
|
||||
const orgId = result.data!.id;
|
||||
assert.equal(result.status, 200);
|
||||
await assert.isRejected(home.addOrg(user, {name: `${domain}!`, domain}, teamOptions),
|
||||
/Domain already in use/);
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('fixSiteProducts', function() {
|
||||
|
||||
const productOrg = (id: number) => getOrg(id)?.then(org => org?.billingAccount?.product?.name);
|
||||
|
||||
const freeOrgId = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
const freeOrg = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
name: org,
|
||||
domain: org,
|
||||
}, {
|
||||
@@ -54,7 +54,7 @@ describe('fixSiteProducts', function() {
|
||||
product: 'teamFree',
|
||||
}));
|
||||
|
||||
const teamOrgId = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
const teamOrg = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
name: 'fix-team-org',
|
||||
domain: 'fix-team-org',
|
||||
}, {
|
||||
@@ -64,7 +64,7 @@ describe('fixSiteProducts', function() {
|
||||
}));
|
||||
|
||||
// Make sure it is created with teamFree product.
|
||||
assert.equal(await productOrg(freeOrgId), 'teamFree');
|
||||
assert.equal(await productOrg(freeOrg.id), 'teamFree');
|
||||
|
||||
// Run the fixer.
|
||||
assert.isTrue(await fixSiteProducts({
|
||||
@@ -73,10 +73,10 @@ describe('fixSiteProducts', function() {
|
||||
}));
|
||||
|
||||
// Make sure we fixed the product is on Free product.
|
||||
assert.equal(await productOrg(freeOrgId), 'Free');
|
||||
assert.equal(await productOrg(freeOrg.id), 'Free');
|
||||
|
||||
// Make sure the other org is still on team product.
|
||||
assert.equal(await productOrg(teamOrgId), 'team');
|
||||
assert.equal(await productOrg(teamOrg.id), 'team');
|
||||
});
|
||||
|
||||
it("doesn't run when on saas deployment", async function() {
|
||||
@@ -123,7 +123,7 @@ describe('fixSiteProducts', function() {
|
||||
|
||||
const db = server.dbManager;
|
||||
const user = await db.getUserByLogin(email, {profile});
|
||||
const orgId = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
const org = db.unwrapQueryResult(await db.addOrg(user, {
|
||||
name: 'sanity-check-org',
|
||||
domain: 'sanity-check-org',
|
||||
}, {
|
||||
@@ -135,12 +135,12 @@ describe('fixSiteProducts', function() {
|
||||
const getOrg = (id: number) => db.connection.manager.findOne(Organization,
|
||||
{where: {id}, relations: ['billingAccount', 'billingAccount.product']});
|
||||
const productOrg = (id: number) => getOrg(id)?.then(org => org?.billingAccount?.product?.name);
|
||||
assert.equal(await productOrg(orgId), 'teamFree');
|
||||
assert.equal(await productOrg(org.id), 'teamFree');
|
||||
|
||||
assert.isFalse(await fixSiteProducts({
|
||||
db: server.dbManager,
|
||||
deploymentType: server.server.getDeploymentType(),
|
||||
}));
|
||||
assert.equal(await productOrg(orgId), 'teamFree');
|
||||
assert.equal(await productOrg(org.id), 'teamFree');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user