mirror of
https://github.com/bitbaum/hirnli.git
synced 2026-12-04 06:07:31 +01:00
* feat(access): tools and data routes are for members of the organisation Until now /fundraising and every data route under /api sat behind one shared HTTP Basic password in the middleware, or behind nothing with INTERNAL_AUTH=off. No handler asked who was calling, and the organisation came from the Host header, so the password opened every organisation's data. - requireOrgPage in one layout covers every tool page; requireOrgApi is the first statement of every data handler (28 handlers, and the PDF factory). The organisation is the one whose site the request is on, and the caller must be a signed-in member of it: 401 signed out, 403 for a member of another organisation. - The shared register of funders is changed only by the platform operator (users.role, scripts/set-operator.ts). A member writes its own organisation's assessment; a register fact in the same request is refused whole, so no edit is half saved. - Writes and the model route are rate-limited per person with @bitbaum/limitkit. - The activity log records who did it, not 'api'. - The password gate, the public mode and their helpers are removed; the middleware only routes hosts. - A test reads every route file and refuses a data route without the gate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * wip(access): the workspace URL names the organisation; the gate reads it from there Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * wip(workspace): tools and data routes move under /o/<slug>; organisations are private unless published Work in progress on a draft branch: the route and link move is not finished and the full verify has not been run on this commit. - docs/PRODUCT.md: the product decision (person, organisations, funders) - org_profiles.visibility (migration 0021), private by default; revamp-it private, its data kept; share links and the workspace still resolve - scripts/set-visibility.ts Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * feat(workspace): one sign-in, many organisations; private unless published; the owner is never locked out The tools and every data route now live in the workspace, /o/<slug>/…, on the platform's host. The organisation is the one named in the URL and the caller must be a signed-in member of it. An organisation's own host serves its public pages only; old links to /fundraising/… there are sent to the workspace. Organisations are private unless published (org_profiles.visibility, migration 0021). revamp-it becomes private: every row is kept, its public pages stop being served, its share links and workspace still resolve. The server names its owner in HIRNLI_OWNER_EMAIL. Signed in with that address verified, they become the operator and the owner of every organisation that has no member; never a member of one that has members. Verified: pnpm run verify (1183 tests, build), fleet docs-truth, composition and experience audits, and a local walk signed out, as an unverified and as a verified owner address. Known gap: links from tool pages to an organisation's public pages (/wirkung, /finanzen, …) do not exist on the platform host yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t * feat(access): the first admin by the fleet's rule: a role from accountkit and a mailed one-hour link The owner bootstrap matched the signed-in account's address against a server setting. The fleet's back-office rule (written the same day) says access is a role on the account, never an address, and the fallback for the first admin is one button that mails a signed one-hour link to the owner mailbox. A sign-in through OrangeCat also carries an address OrangeCat made up, so the match could never have worked for it. - The operator is now accountkit's admin role. - The account page offers the button while the account is not an admin and the server names a mailbox (OWNER_EMAILS, as in Heidi) and can send mail. - The link works only for the signed-in account it names, for an hour. It makes that account admin and owner of every organisation without a member; never a member of one that has members. Walked locally: signed out, expired, another account's link, the real one. Not walked: the mail itself (no mail key here). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmtMwPqoAJ2pHxdSn3t --------- Co-authored-by: Claude <noreply@anthropic.com>