bindinghttp

package
v1.148.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves the binding routes.

func New

func New(deps Deps) *Handler

New builds the handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler)

Register mounts the routes, each wrapped in the portal authentication.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL