feat(store): add audit log table and queries
Entries are visible by kind: organization entries to the organization, account entries to the account, platform entries to admins. The built-in admin role gains the new audit.read permission. Refs #65 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
538e9358c3
commit
bd986cd49f
5 files changed
+235
No files matched your search
@@ -96,6 +96,7 @@ type Querier interface {
|
||||
IncidentsForMonitors(ctx context.Context, arg IncidentsForMonitorsParams) ([]Incident, error)
|
||||
// Incidents overlapping the time since $1, for SLA calculation.
|
||||
IncidentsSince(ctx context.Context, resolvedAt *time.Time) ([]IncidentsSinceRow, error)
|
||||
InsertAuditEvent(ctx context.Context, arg InsertAuditEventParams) error
|
||||
// check_results and its aggregates have no row-level security (see
|
||||
// migration 00013). Every query here must filter by org_id.
|
||||
InsertCheckResults(ctx context.Context, arg []InsertCheckResultsParams) (int64, error)
|
||||
@@ -109,6 +110,9 @@ type Querier interface {
|
||||
// Agents owned by org, or platform agents when org is NULL.
|
||||
ListAgents(ctx context.Context, orgID *uuid.UUID) ([]ListAgentsRow, error)
|
||||
ListAssignments(ctx context.Context, orgID uuid.UUID) ([]ListAssignmentsRow, error)
|
||||
// Newest first, paged by time. kind narrows to one kind; the row policy
|
||||
// already limits what the scope can see.
|
||||
ListAuditEvents(ctx context.Context, arg ListAuditEventsParams) ([]ListAuditEventsRow, error)
|
||||
ListChannels(ctx context.Context) ([]NotificationChannel, error)
|
||||
ListEnabledChannelIDs(ctx context.Context, orgID uuid.UUID) ([]uuid.UUID, error)
|
||||
// System scope: every enabled monitor with its regions, for reconciling the
|
||||
@@ -151,6 +155,7 @@ type Querier interface {
|
||||
OpenIncident(ctx context.Context, arg OpenIncidentParams) (Incident, error)
|
||||
OpenIncidents(ctx context.Context) ([]Incident, error)
|
||||
OrgIDBySlug(ctx context.Context, slug string) (uuid.UUID, error)
|
||||
PurgeAuditEvents(ctx context.Context, argTime time.Time) (int64, error)
|
||||
PurgeExpiredTokens(ctx context.Context, expiresAt *time.Time) (int64, error)
|
||||
// Incidents resolved before the oldest data still charted.
|
||||
PurgeIncidents(ctx context.Context, resolvedAt *time.Time) (int64, error)
|
||||
|
||||
Reference in new issue
Block a user