All checks were successful
continuous-integration/drone/push Build is passing
Closes !2 Added review dashboard button as well. <img width="1313" alt="image.png" src="attachments/a2abd430-7ff6-431a-9261-82e026de58f5">  Reviewed-on: #304 Reviewed-by: Rhys Lloyd <quaternions@noreply@itzana.me> Co-authored-by: itzaname <me@sliving.io> Co-committed-by: itzaname <me@sliving.io>
29 lines
868 B
Go
29 lines
868 B
Go
package model
|
|
|
|
import "time"
|
|
|
|
type Policy int32
|
|
|
|
const (
|
|
ScriptPolicyNone Policy = 0 // not yet reviewed
|
|
ScriptPolicyAllowed Policy = 1
|
|
ScriptPolicyBlocked Policy = 2
|
|
ScriptPolicyDelete Policy = 3
|
|
ScriptPolicyReplace Policy = 4
|
|
)
|
|
|
|
type ScriptPolicy struct {
|
|
ID int64 `gorm:"primaryKey"`
|
|
// 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.
|
|
FromScriptHash int64 `gorm:"uniqueIndex"` // postgres does not support unsigned integers, so we have to pretend
|
|
// The ID of the replacement source (ScriptPolicyReplace)
|
|
// or verbatim source (ScriptPolicyAllowed)
|
|
// or 0 (other)
|
|
ToScriptID int64
|
|
Policy Policy
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|