maps-service/pkg/model/policy.go

28 lines
735 B
Go
Raw Permalink Normal View History

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
const(
ScriptPolicyAllowed Policy=0
ScriptPolicyBlocked Policy=1
ScriptPolicyDelete Policy=2
ScriptPolicyReplace Policy=3
)
type ScriptPolicy struct {
2024-12-10 06:27:52 +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-06 00:16:32 +00:00
FromScriptHash uint64
// The ID of the replacement source (ScriptPolicyReplace)
// or verbatim source (ScriptPolicyAllowed)
// or 0 (other)
ToScriptID int64
2024-12-05 01:27:49 +00:00
Policy Policy
2024-12-10 06:27:52 +00:00
CreatedAt time.Time
UpdatedAt time.Time
2024-12-05 01:27:49 +00:00
}