Help us shape the future of Go! Take the 2026 Go Developer Survey

personarules

package
v1.152.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package personarules is what the admin API does to a persona's rules before it stores them: the API-route rules normalized to the form they are stored in (#1479), and the rules and portal levels the registry would refuse, refused before the write (#2225).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(rules []persona.APIRouteRule) []persona.APIRouteRule

Normalize returns the rules as they are stored: whitespace trimmed, empty patterns dropped, methods uppercased, and an empty action written as the explicit "allow" it means.

Methods are uppercased because the toolkit normalizes an inbound method to uppercase before the check runs and the patterns are matched case-sensitively — a rule typed as "delete" would otherwise be stored, displayed, and never match anything. Paths are left exactly as written: a path glob is the operator's, and rewriting one would stop a hand-written pattern round-tripping to the editor as the pattern it was typed as.

func Validate

func Validate(p *persona.Persona, adminPersona string) error

Validate refuses the API route rules and portal levels the registry would refuse, before the store write: a rule refused after it would already be persisted. It also refuses the account types the platform cannot honor (#2257): adminPersona is the configured administrator persona's name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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