capability

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package capability defines the Published Language of authorization: the capability names every module checks and the users module resolves. Names are stable strings so modules never hardcode them and no second vocabulary drifts elsewhere. Unknown names fail closed at the resolver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ManageContent

func ManageContent(postType string) string

ManageContent builds the per-type manage capability for a post-type slug.

Types

type Capability

type Capability string

Capability names a permission the kernel resolver decides.

const (
	// CapabilityAdmin is the reserved superuser grant.
	CapabilityAdmin Capability = "admin"
	// CapabilityMedia grants media upload/generation.
	CapabilityMedia Capability = "media"
	// CapabilityComments grants authenticated commenting.
	CapabilityComments Capability = "comments"
	// CapabilityPublishContent grants direct publishing.
	CapabilityPublishContent Capability = "content.publish"
	// CapabilityManageContent is the prefix for per-type manage grants of
	// the form "content.manage:<post-type>". Use ManageContent to build it.
	CapabilityManageContent Capability = "content.manage"
)

func Split

func Split(capability string) (name Capability, arg string)

Split breaks a capability into its name and argument ("content.manage", "post" for "content.manage:post"). A bare name yields an empty argument.

Jump to

Keyboard shortcuts

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