Documentation
¶
Overview ¶
Package sourcerule is who may run a managed script for which webhook source (#2332). A run reads every event its source stores, so naming a source is reading it: an administrator may name any source, and anyone else only the source made for a form whose script they own.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSourceRefused = errors.New("this script cannot run for that webhook source")
ErrSourceRefused is a script naming a webhook source its owner may not run it for.
Functions ¶
func OwnerOf ¶
func OwnerOf(get func(ctx context.Context, id string) (*script.Script, error)) func(ctx context.Context, scriptID string) (string, error)
OwnerOf is Rule.FormOwner over a script read: the owner's email of the script with the id, "" for a script that does not exist, which owns nothing.
Types ¶
type Rule ¶
type Rule struct {
Sources SourceReader
// FormOwner is the owner's email of the script a form source was made
// for.
FormOwner func(ctx context.Context, scriptID string) (string, error)
}
Rule is who may run a script for which webhook source (#2332). A run reads every event the source stores, so naming a source is reading it: an administrator may name any source, and anyone else only the source made for a form whose script they own, which holds the submissions their own form collected.
func NewRule ¶
NewRule is the rule over the stored webhook sources and the scripts get reads, nil without a database. A source is read only for its name and its form, so its secrets are not decrypted.