audit message when server starts and shuts down
This commit is contained in:
@@ -76,6 +76,8 @@ type AuditRecord struct {
|
||||
// at all times!
|
||||
const (
|
||||
AuditPublishToFrontPage = 1
|
||||
AuditStartup = 2
|
||||
AuditShutdown = 3
|
||||
AuditLoginOK = 101
|
||||
AuditLoginFail = 102
|
||||
AuditAccountCreated = 103
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user