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 ¶
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.