ZDDC/zddc/internal/policy
ZDDC 465d2f605c feat(policy): IsActiveAdmin field + AllowActionFromChainP entry point
Lays the rails for the consolidation refactor — the decider gains a
single admin-bypass branch at the top of InternalDecider.Allow, and a
new principal-aware entry point computes IsActiveAdmin from chain +
Principal.Elevated. No caller uses the new path yet, so behavior is
unchanged; lock-in tests stay green.

  AllowInput.User.IsActiveAdmin bool   // caller-computed bypass flag
  AllowActionFromChainP(ctx, d, chain, p, path, action) (bool, error)

The decider's branch:

  if input.User.IsActiveAdmin { return true, nil }

is the ONLY admin escape hatch in the package. Strict-ancestor rule
for .zddc edits is preserved inside AllowActionFromChainP via
IsAdminForChain(chain, email, excludeLeaf=true) when action==ActionAdmin.

Email-only entry points (AllowFromChain, AllowActionFromChain) leave
IsActiveAdmin=false implicitly — they're for read-path callers that
don't need admin bypass (directory listing, archive index, profile
read endpoints).

Next commits: migrate authorizeAction and plan-review's pre-flight
to AllowActionFromChainP, then delete the scattered IsAdmin/
IsSubtreeAdmin/CanEditZddc early-outs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 09:17:44 -05:00
..
rego feat(server): federal-mode reference Rego (parent-deny-is-absolute) 2026-05-04 18:05:44 -05:00
federal_parity_test.go feat(server): federal-mode reference Rego (parent-deny-is-absolute) 2026-05-04 18:05:44 -05:00
parity_test.go feat(server): reference Rego, parity test, decision cache, listing ETags 2026-05-04 17:46:24 -05:00
policy.go feat(policy): IsActiveAdmin field + AllowActionFromChainP entry point 2026-05-18 09:17:44 -05:00
policy_test.go feat(server): reference Rego, parity test, decision cache, listing ETags 2026-05-04 17:46:24 -05:00
rego.go feat(server): federal-mode reference Rego (parent-deny-is-absolute) 2026-05-04 18:05:44 -05:00