Documentation
¶
Overview ¶
Package bindinghttp serves a managed script's endpoint binding on its portal page (#2171): the binding and its recent failed requests, which the script's owner and an administrator read, and the binding's setting, turning on and off, which only an administrator may do. The rules are manage_script's own: every route here carries its request out through the same internal/endpoint/epcmd handler the tool's endpoint commands do.
It is mounted by scripthttp, which resolves the caller and the script and answers everybody but the script's owner and an administrator before any handler here runs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Commands *epcmd.Handler
Scripts interface {
GetByID(ctx context.Context, id string) (*script.Script, error)
}
// Owned resolves the script in the path for its owner or an
// administrator, or writes the refusal and reports false. actor is who
// the caller is.
Owned func(w http.ResponseWriter, r *http.Request) (scriptID, actor string, ok bool)
// Admin reports whether the caller is an administrator.
Admin func(r *http.Request) bool
}
Deps carries the commands, the script store and the caller's gate.