resolve

package
v0.137.9 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package resolve is how ContentKit's modules ask whether content exists, is visible, opens and is edited by a viewer. The catalog and groups answer it; media, versions, interactions and discovery ask it. It is internal: hosts set access through the API, never through a resolver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EditorRead added in v0.97.0

func EditorRead(ctx context.Context) bool

EditorRead reports a media read that explicitly requested its editor view.

func WithEditorRead added in v0.97.0

func WithEditorRead(ctx context.Context) context.Context

WithEditorRead marks an explicit media management read. It grants no authority: resolvers must still verify that the actor edits the resource.

Types

type Channel added in v0.131.0

type Channel struct {
	Kind, ID, Owner, Scope string
}

Channel is the stored primary channel identity and its permission scope.

type Resolution

type Resolution struct {
	// Ref is the canonical reference every row is stored and read under (a
	// merged group resolves to its survivor). A zero Ref keeps the requested
	// one; a Ref of another tenant is an error.
	Ref contentref.ContentRef
	// Visible = live, or edited by the actor. Media's public files (covers,
	// previews) need only Visible.
	Visible bool
	// Accessible = the actor opens the content.
	Accessible bool
	// ReadRestricted allows private reads before publication or chapter release.
	// It is granted by the content authority; it never permits uploads or edits.
	ReadRestricted bool
	// Editor = the actor may edit the item (current staff, authorized authors, its owner
	// group's editors): media gives a visible item's editor its private files
	// whatever Accessible says.
	Editor bool
	// Owner is the account that authored the item (immutable created_by, an entity's
	// owner), "" when none does. A comment ban in that owner's scope applies
	// to it.
	Owner string
	// Comments is the item's comments setting: open (also ""), closed or
	// hidden.
	Comments string
	// Channel names the primary authoring home whose current moderators manage
	// this item and all its versions. Repost destinations never replace it.
	Channel *Channel
}

Resolution is the verdict about a content reference for one actor.

func One

One resolves a single ref as a batch of one; an omitted ref yields the zero (denying) Resolution.

func (Resolution) Full

func (r Resolution) Full() bool

Full reports access to the item: everything private is served.

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, refs []contentref.ContentRef, actor access.Actor) (map[contentref.ContentKey]Resolution, error)
}

Resolver says whether each ContentRef exists, is visible and opens for the actor. It is batch-first: callers pass every ref a request needs in one call. The map is keyed by each requested ref's Key; a ref missing from it denies. An error fails the whole batch.

Jump to

Keyboard shortcuts

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