2024-12-05 01:27:49 +00:00
|
|
|
package model
|
|
|
|
|
2024-12-10 06:27:52 +00:00
|
|
|
import "time"
|
|
|
|
|
2024-12-05 01:27:49 +00:00
|
|
|
type Policy int32
|
|
|
|
|
2024-12-12 22:29:20 +00:00
|
|
|
const (
|
2024-12-14 05:50:19 +00:00
|
|
|
ScriptPolicyNone Policy = 0 // not yet reviewed
|
|
|
|
ScriptPolicyAllowed Policy = 1
|
|
|
|
ScriptPolicyBlocked Policy = 2
|
|
|
|
ScriptPolicyDelete Policy = 3
|
|
|
|
ScriptPolicyReplace Policy = 4
|
2024-12-05 01:27:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ScriptPolicy struct {
|
2024-12-12 22:29:20 +00:00
|
|
|
ID int64 `gorm:"primaryKey"`
|
2024-12-05 01:27:49 +00:00
|
|
|
// Hash of the source code that leads to this policy.
|
|
|
|
// If this is a replacement mapping, the original source may not be pointed to by any policy.
|
|
|
|
// The original source should still exist in the scripts table, which can be located by the same hash.
|
2024-12-20 00:49:22 +00:00
|
|
|
FromScriptHash int64 // postgres does not support unsigned integers, so we have to pretend
|
2024-12-06 00:16:32 +00:00
|
|
|
// The ID of the replacement source (ScriptPolicyReplace)
|
|
|
|
// or verbatim source (ScriptPolicyAllowed)
|
|
|
|
// or 0 (other)
|
2024-12-12 22:29:20 +00:00
|
|
|
ToScriptID int64
|
|
|
|
Policy Policy
|
|
|
|
CreatedAt time.Time
|
|
|
|
UpdatedAt time.Time
|
2024-12-05 01:27:49 +00:00
|
|
|
}
|