mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-07-10 23:13:16 +08:00
feat: add community enhancements — password reset, audit logs, multi-source backup
Three community-requested features: 1. CLI password reset: `backupx reset-password --username admin --password xxx` Docker users can run via `docker exec`. No full app init needed. 2. Audit logging: async fire-and-forget audit trail for all key operations (login, CRUD on tasks/targets/records, settings changes). New UI page at /audit with category filter and pagination. 3. Multi-source path backup: file backup tasks now support multiple source directories packed into a single tar archive. Backward compatible with existing single sourcePath field.
This commit is contained in:
21
server/internal/model/audit_log.go
Normal file
21
server/internal/model/audit_log.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package model
|
||||
|
||||
import "time"
|
||||
|
||||
type AuditLog struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
UserID uint `gorm:"column:user_id;index" json:"userId"`
|
||||
Username string `gorm:"column:username;size:64;not null" json:"username"`
|
||||
Category string `gorm:"column:category;size:32;index;not null" json:"category"`
|
||||
Action string `gorm:"column:action;size:64;not null" json:"action"`
|
||||
TargetType string `gorm:"column:target_type;size:32" json:"targetType"`
|
||||
TargetID string `gorm:"column:target_id;size:64" json:"targetId"`
|
||||
TargetName string `gorm:"column:target_name;size:128" json:"targetName"`
|
||||
Detail string `gorm:"column:detail;type:text" json:"detail"`
|
||||
ClientIP string `gorm:"column:client_ip;size:45" json:"clientIp"`
|
||||
CreatedAt time.Time `gorm:"index" json:"createdAt"`
|
||||
}
|
||||
|
||||
func (AuditLog) TableName() string {
|
||||
return "audit_logs"
|
||||
}
|
||||
Reference in New Issue
Block a user