audit message when server starts and shuts down

This commit is contained in:
2026-02-21 22:05:33 -07:00
parent 6189b474d0
commit 6e06c7a3a8
5 changed files with 46 additions and 0 deletions
+2
View File
@@ -76,6 +76,8 @@ type AuditRecord struct {
// at all times!
const (
AuditPublishToFrontPage = 1
AuditStartup = 2
AuditShutdown = 3
AuditLoginOK = 101
AuditLoginFail = 102
AuditAccountCreated = 103
+4
View File
@@ -12,6 +12,10 @@
auditReference:
- code: 1
text: "Publish Message to Front Page"
- code: 2
text: "Server Startup"
- code: 3
text: "Server Shutdown"
- code: 101
text: "Login OK"
- code: 102
+11
View File
@@ -561,6 +561,17 @@ func AmGetAnonUser(ctx context.Context) (*User, error) {
return rc, err
}
// AmGetBOFH returns the user account of the global system administrator.
func AmGetBOFH(ctx context.Context) (*User, error) {
row := amdb.QueryRowContext(ctx, "SELECT uid FROM users WHERE base_lvl = ?", AmRole("Global.BOFH").Level())
var uid int32
err := row.Scan(&uid)
if err != nil {
return nil, err
}
return AmGetUser(ctx, uid)
}
// hashPassword hashes the password value.
func hashPassword(password string) string {
if len(password) == 0 {