mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
Security event logs are no longer logged to the `security_event_log` table by default after this change. They are now configurable through the site_config --------- Co-authored-by: Robert Lin <robert@bobheadxi.dev>
37 lines
684 B
Go
37 lines
684 B
Go
package audit
|
|
|
|
import "github.com/sourcegraph/sourcegraph/schema"
|
|
|
|
type SecurityEventsLocation int
|
|
|
|
const (
|
|
None = iota
|
|
AuditLog
|
|
Database
|
|
All
|
|
)
|
|
|
|
func SecurityEventLocation(cfg schema.SiteConfiguration) SecurityEventsLocation {
|
|
if securityEvent := securityEventConf(cfg); securityEvent != nil {
|
|
switch securityEvent.Location {
|
|
case "none":
|
|
return None
|
|
case "auditlog":
|
|
return AuditLog
|
|
case "database":
|
|
return Database
|
|
case "all":
|
|
return All
|
|
}
|
|
}
|
|
// default to AuditLog
|
|
return AuditLog
|
|
}
|
|
|
|
func securityEventConf(cfg schema.SiteConfiguration) *schema.SecurityEventLog {
|
|
if logCg := cfg.Log; logCg != nil {
|
|
return logCg.SecurityEventLog
|
|
}
|
|
return nil
|
|
}
|