Files
atlas/internal/models/auth.go
othman.suseno a6da313dfc
Some checks failed
CI / test-build (push) Failing after 59s
add api framework
2025-12-14 22:15:56 +07:00

37 lines
1.1 KiB
Go

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"`
}