siteshared

package
v1.166.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package siteshared lists the site environments shared with a person (#2718): each environment a grant to their verified email or to their persona opens, with its address and whether it is online. It is what someone without the Sites area, an external person above all, has to find a site they were given: Home lists it, and nothing in it names the site's other environments or who else they are shared with, which stay the managers' to know.

Index

Constants

View Source
const Route = "GET /api/v1/portal/shared-sites"

Route is where the list is served.

Variables

This section is empty.

Functions

func Handler

func Handler(store Store, addressing func() site.Addressing, actorOf func(http.ResponseWriter, *http.Request) (sitesvc.Actor, bool)) http.HandlerFunc

Handler serves the list. actorOf resolves the caller and answers the request itself when it cannot; addressing is read on each request, so a changed pages domain shows at once.

@Summary List the site environments shared with me @Description Each environment of a site that a grant to the caller's verified email or to their persona opens, with its address and whether it is online (#2718). Nothing else of those sites is named: not their other environments and not who else they are shared with. Every signed-in person may ask, an external person included; one with no grant gets an empty list. @Tags Sites @Produce json @Success 200 {object} List @Failure 401 {object} httpjson.ProblemDetail @Failure 500 {object} httpjson.ProblemDetail @Security ApiKeyAuth @Security BearerAuth @Router /portal/shared-sites [get]

Types

type Environment

type Environment struct {
	Site        string `json:"site" example:"partner-review"`
	Environment string `json:"environment" example:"dev"`
	// Address is where the environment is reached: its primary domain, else
	// its address on the pages domain; "" when it has neither.
	Address string `json:"address" example:"https://partner-review--dev.pages.example.net"`
	// Online is false while the site's managers have taken it offline or
	// pointed it elsewhere; Message is what they said, if anything.
	Online  bool   `json:"online"`
	Message string `json:"message,omitempty"`
}

Environment is one environment shared with the caller.

func Shared

func Shared(ctx context.Context, store Store, at site.Addressing, actor sitesvc.Actor) ([]Environment, error)

Shared is the environments a grant opens for actor. A grant that names a site the actor's grant no longer opens, or a site removed meanwhile, adds nothing.

type List

type List struct {
	Environments []Environment `json:"environments"`
}

List is the environments shared with the caller, in site name order and, within a site, the order its environments are listed in.

type Store

type Store interface {
	GrantedSiteIDs(ctx context.Context, email, persona string) ([]string, error)
	Get(ctx context.Context, id string) (*site.Site, error)
	SiteDomains(ctx context.Context, siteID string) ([]site.Domain, error)
	SiteAccess(ctx context.Context, siteID, env, email, persona string) (*site.Access, error)
}

Store is what the list reads: the sites with a grant naming the person, each site and its domains, and the access check of one environment.

Jump to

Keyboard shortcuts

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