Documentation
¶
Overview ¶
Package reachapi serves the portal's search and facets over a person's reach (#2500): GET /api/v1/portal/assets/search, /assets/facets, /collections/search and /collections/facets, and the per-row description (share summaries, permissions) the portal's listings attach to a page.
Every route asks the store for what the caller can open, narrowed to the scope the request names; the store applies the reach in SQL (internal/portal/reachstore), so a row the caller cannot open is never returned, ranked or counted. It is built only by pkg/portal, which mounts it and calls its row description from the listing routes it still owns.
Index ¶
- func Marks(r *http.Request) (status string, verified bool)
- func OwnedCollectionIDs(collections []portaldomain.Collection, user *access.User) []string
- func Owners(r *http.Request) []string
- func Reach(r *http.Request, user *access.User, fallback portaldomain.Scope) *portaldomain.Reach
- type Config
- type Handler
- func (h *Handler) CollectionPermissions(ctx context.Context, collections []portaldomain.Collection, user *access.User) map[string]portaldomain.SharePermission
- func (h *Handler) DescribeAssets(ctx context.Context, assets []portaldomain.Asset, reach *portaldomain.Reach, ...) Rows
- func (h *Handler) Register(mux *http.ServeMux)
- type Rows
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Marks ¶ added in v1.166.0
Marks is the status and verified filters (#2502, #2503): status is draft, published, deprecated or none (an unknown value filters nothing), and verified=true keeps only assets carrying an unexpired verification.
func OwnedCollectionIDs ¶
func OwnedCollectionIDs(collections []portaldomain.Collection, user *access.User) []string
OwnedCollectionIDs is the ids of the collections the caller owns, the rows whose share summaries are theirs to see.
func Reach ¶
func Reach(r *http.Request, user *access.User, fallback portaldomain.Scope) *portaldomain.Reach
Reach is the caller's reach for a listing or search: everything they can open, narrowed to the scope the request names (fallback when it names none). An administrator's reach is their own; the admin listing is the route that spans every owner.
Types ¶
type Config ¶
type Config struct {
Assets any
Collections any
Access *access.Checker
// Embed turns a query into a vector, nil when no provider is
// configured, which ranks lexically.
Embed func(ctx context.Context, query string) []float32
}
Config is what the routes read: the stores (each used for the capabilities it implements), the authorization core and the query embedder.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the reach routes.
func (*Handler) CollectionPermissions ¶
func (h *Handler) CollectionPermissions(ctx context.Context, collections []portaldomain.Collection, user *access.User) map[string]portaldomain.SharePermission
CollectionPermissions is the caller's share permission on each listed collection they do not own.
func (*Handler) DescribeAssets ¶
func (h *Handler) DescribeAssets(ctx context.Context, assets []portaldomain.Asset, reach *portaldomain.Reach, user *access.User) Rows
DescribeAssets describes a page of assets for the caller.
type Rows ¶
type Rows struct {
Summaries map[string]portaldomain.ShareSummary
Permissions map[string]portaldomain.SharePermission
}
Rows is what a page of assets reports beside its rows: the share summaries of the rows the caller owns, and the caller's permission on each row they do not. A share summary says whether a row has a public link, which is its owner's to know, so a row shared with the caller carries none.