Further PR comments.
This commit is contained in:
parent
3e7c1d10cf
commit
65646ba01b
|
@ -225,12 +225,6 @@ export async function platformLogout(opts: PlatformLogoutOpts) {
|
|||
|
||||
const sessionIds = sessions.map(({ sessionId }) => sessionId)
|
||||
await invalidateSessions(userId, { sessionIds, reason: "logout" })
|
||||
let user: User | undefined
|
||||
try {
|
||||
user = await userCache.getUser(userId)
|
||||
} catch {
|
||||
user = undefined
|
||||
}
|
||||
await events.auth.logout(user?.email)
|
||||
await events.auth.logout(ctx.user?.email)
|
||||
await userCache.invalidateUser(userId)
|
||||
}
|
||||
|
|
|
@ -3,10 +3,6 @@ import { processors } from "./processors"
|
|||
import identification from "./identification"
|
||||
import * as backfill from "./backfill"
|
||||
|
||||
export function isAudited(event: Event) {
|
||||
return !!AuditedEventFriendlyName[event]
|
||||
}
|
||||
|
||||
export const publishEvent = async (
|
||||
event: Event,
|
||||
properties: any,
|
||||
|
|
|
@ -3,7 +3,6 @@ export * as processors from "./processors"
|
|||
export * as analytics from "./analytics"
|
||||
export { default as identification } from "./identification"
|
||||
export * as backfillCache from "./backfill"
|
||||
export { isAudited } from "./events"
|
||||
|
||||
import { processors } from "./processors"
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ import {
|
|||
Group,
|
||||
IdentityType,
|
||||
AuditLogQueueEvent,
|
||||
AuditLogFn,
|
||||
AuditLogFn, AuditedEventFriendlyName,
|
||||
} from "@budibase/types"
|
||||
import { EventProcessor } from "./types"
|
||||
import { getAppId } from "../../context"
|
||||
import { isAudited } from "../events"
|
||||
import BullQueue from "bull"
|
||||
import { createQueue, JobQueue } from "../../queue"
|
||||
|
||||
|
@ -41,13 +40,17 @@ export default class AuditLogsProcessor implements EventProcessor {
|
|||
})
|
||||
}
|
||||
|
||||
isAudited(event: Event) {
|
||||
return !!AuditedEventFriendlyName[event]
|
||||
}
|
||||
|
||||
async processEvent(
|
||||
event: Event,
|
||||
identity: Identity,
|
||||
properties: any,
|
||||
timestamp?: string
|
||||
): Promise<void> {
|
||||
if (AuditLogsProcessor.auditLogsEnabled && isAudited(event)) {
|
||||
if (AuditLogsProcessor.auditLogsEnabled && this.isAudited(event)) {
|
||||
// only audit log actual events, don't include backfills
|
||||
const userId =
|
||||
identity.type === IdentityType.USER ? identity.id : undefined
|
||||
|
|
|
@ -17,7 +17,6 @@ import * as pro from "@budibase/pro"
|
|||
import * as api from "./api"
|
||||
import sdk from "./sdk"
|
||||
const pino = require("koa-pino-logger")
|
||||
import { sdk as proSdk } from "@budibase/pro"
|
||||
|
||||
let STARTUP_RAN = false
|
||||
|
||||
|
@ -127,7 +126,7 @@ export async function startup(app?: any, server?: any) {
|
|||
let queuePromises = []
|
||||
// configure events to use the pro audit log write
|
||||
// can't integrate directly into backend-core due to cyclic issues
|
||||
queuePromises.push(events.processors.init(proSdk.auditLogs.write))
|
||||
queuePromises.push(events.processors.init(pro.sdk.auditLogs.write))
|
||||
queuePromises.push(automations.init())
|
||||
queuePromises.push(initPro())
|
||||
if (app) {
|
||||
|
|
Loading…
Reference in New Issue