ZDDC/zddc/internal/handler
ZDDC 7c0b66590c feat(server,shared): tell denied users who can — subtly, before wasted effort
When a user lacks permission, the app should (a) not let them do data entry it
will reject and (b) subtly say who can. General mechanism + the key gates.

Server — compute & expose "who can <verb> here":
- zddc.WhoCan(chain, verb) → Authority{Roles, People}: the acl.permissions
  grantees holding the verb across the cascade (roles + their members) plus the
  admins (who bypass). New whocan.go + whocan_test.go.
- AccessView gains path_who_can (profilehandler.go), populated only for verbs the
  caller LACKS and only when they can read the path (mirrors .zddc readability),
  so one cap.at() answers "can I?" and "if not, who?".
- writeForbiddenWho enriches the 403 body with who_can for the missing verb
  (errors.go); authorizeAction uses it (fileapi.go) as the safety net for denials
  that weren't pre-checked.

Shared — shared/cap.js:
- cap.whoCan(view, verb) + cap.denyHint(view, verb) → {text, title}, role-first
  ("Only the document controller can create here") with the people in the tooltip.
- handleForbidden appends the hint (from the 403 body, else the cached view), so
  every tool that already routes 403s through it (form save, tables save, browse)
  now explains who can — for free.

Key gates:
- Browse party-create (the reported bug): pre-check create authority on ssr/ and
  the slot BEFORE opening the picker — if the user can do neither, show the hint
  instead of the form; if only existing parties are usable, disable "+ New party"
  with the who-can hint. The post-hoc 403 catch now names who can too.
- Tables +Add row disabled state shows the who-can hint.

Plus: subtle /_apps/{browse,archive,classifier}.html links in the landing footer.

Tests: Go WhoCan unit test (role/person split, admin bypass, dedupe); cap.spec.js
(denyHint role-first/people/fallback, whoCan, handleForbidden enrichment) — 5
green; Go handler+zddc+policy suites green. (Pre-existing stale browse toolbar
test browse.spec.js:274 unaffected.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:58:20 -05:00
..
accepthandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
accepthandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
admin_helpers.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
appsvirtual.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
appsvirtual_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
archivehandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
archivehandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
auth_invariants_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
authcheck.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
authcheck_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
configpath.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
converthandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
converthandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
converttemplate.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
converttemplate_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
cors.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
cors_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-mdl.form.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-mdl.table.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-project-mdl.form.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-project-mdl.table.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-project-rsk.form.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-project-rsk.table.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-rsk.form.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-rsk.table.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-ssr.form.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
default-ssr.table.yaml ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
defaults_matrix_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
directory.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
directory_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
errors.go feat(server,shared): tell denied users who can — subtly, before wasted effort 2026-06-12 14:58:20 -05:00
fileapi.go feat(server,shared): tell denied users who can — subtly, before wasted effort 2026-06-12 14:58:20 -05:00
fileapi_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
formhandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
formhandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
history.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
history_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
logring.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
logring_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
mdhistory_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
middleware.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
middleware_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
paths.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
planreview.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
planreview_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
profile_assets.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
profilehandler.go feat(server,shared): tell denied users who can — subtly, before wasted effort 2026-06-12 14:58:20 -05:00
profilehandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
profilepage.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
profileprojects.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
profileprojects_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
projecthandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
projecthandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
projectshandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
schemahandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
sidecar.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
singleflight.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
ssrhandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
ssrhandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
static.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
subtreezip.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
subtreezip_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
tablehandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
tablehandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
tables.html chore(embedded): cut v0.0.27-beta 2026-06-12 11:07:37 -05:00
tokenhandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
tokenhandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
virtualviewhandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
wormbypass_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
zddcfile.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
zddcfile_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
ziphandler.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
ziphandler_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
zipwrite.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00
zipwrite_rt_test.go ZDDC: document-control tools + zddc-server 2026-06-11 13:32:31 -05:00