granthttp

package
v1.135.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package granthttp serves a managed script's run grants on its portal page (#1846): who other than the owner may run it, and the owner's adding and withdrawing of them.

It is mounted by scripthttp, which resolves the caller and the script and refuses everybody but the script's owner and an administrator before any handler here runs. Every grant and withdrawal is audited.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Grants scriptgrant.Store
	// Owned resolves the script in the path for a caller who owns it, 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)
	// Audit records one act on the script. Nil records nothing.
	Audit func(r *http.Request, tool, scriptID string, params map[string]any, opErr error)
}

Deps carries the grant store, the ownership gate and the audit writer.

type Handler

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

Handler serves the grant 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 grant routes, each wrapped in the portal authentication middleware.

Jump to

Keyboard shortcuts

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