This commit is contained in:
36
internal/models/auth.go
Normal file
36
internal/models/auth.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Role represents a user role
|
||||
type Role string
|
||||
|
||||
const (
|
||||
RoleAdministrator Role = "administrator"
|
||||
RoleOperator Role = "operator"
|
||||
RoleViewer Role = "viewer"
|
||||
)
|
||||
|
||||
// User represents a system user
|
||||
type User struct {
|
||||
ID string `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Role Role `json:"role"`
|
||||
Active bool `json:"active"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// AuditLog represents an audit log entry
|
||||
type AuditLog struct {
|
||||
ID string `json:"id"`
|
||||
Actor string `json:"actor"` // user ID or system
|
||||
Action string `json:"action"` // "pool.create", "share.delete", etc.
|
||||
Resource string `json:"resource"` // resource type and ID
|
||||
Result string `json:"result"` // "success", "failure"
|
||||
Message string `json:"message,omitempty"`
|
||||
IP string `json:"ip,omitempty"`
|
||||
UserAgent string `json:"user_agent,omitempty"`
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
}
|
||||
Reference in New Issue
Block a user