Phase 10, part 7: posting accounts, and who may post to which

Social accounts become posting accounts: several per network, the
company's and each person's own, with their tokens kept per account. The
old sign-ins are adopted as the company's. Admins say who may post to which
(Settings → Posting accounts); a draft can go out from one account or a
copy to several, each recording who posted it and as what. Signing an
account out, or removing its owner, holds the posts scheduled to it and
tells whoever scheduled them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 09:26:34 -07:00
co-authored by Claude Opus 5.5
parent a4dd36f5a4
commit bb4772637c
31 changed files with 1758 additions and 325 deletions
+35
View File
@@ -2309,6 +2309,41 @@ starts** (multi-tenant still doesn't).
`connections:changed`). Tokens Supermarket refreshes itself aren't
counted. The existing pages stay where they were, behind admin access.
**Part 7 built 2026-11-25** on `phase10`.
- Schema 35: `posting_accounts` (network: x, linkedin, linkedin_page,
reddit; name; the network's ID for it; owner, 0 for the company's;
expiry) and `posting_grants`; drafts get `account_id` (0: the company's
account for its channel), `written_by`, `posted_by` and `posted_as`.
`internal/posting` keeps them; each account's tokens are in the secrets
store as `acct:<id>:access` and `:refresh` (refreshed tokens are saved
there, per account).
- The old single sign-ins become the company's accounts the first time
they're seen (at start, or when the old app's import brings them), and
their old secrets are cleared.
- Signing in: admins connect the company's accounts on Social accounts
(each card lists its accounts, with *Sign out*); anyone with Content
edit connects their own under Your account (`/auth/<network>/start?for=me`,
the person recorded in the OAuth state; only they can finish it). The
same app keys serve both. One LinkedIn page sign-in for the company,
following the page chosen.
- Settings → Posting accounts: people against accounts. Admins may post
to all; a person's own account is theirs; ticks give others. Members
also need Content edit.
- On a draft, *Post as* lists the accounts the person may post to that
work (signed in, not expired, a page chosen), the draft's current one
ticked. Several ticked: the draft goes to the first and a copy (same
batch) to each other, all published or scheduled together. Posting as
an account needs the right, checked when publishing and scheduling, and
again when a scheduled post falls due. Published posts say which account
they went out as.
- Signing an account out (its owner, or an admin), or removing a person
(their own accounts go), sends posts scheduled to it back to Posts with
why, and emails whoever scheduled them; drafts waiting for it fall back
to the company's account.
- The LinkedIn *post as you or the page* choice became the account choice;
reminders of running-out sign-ins cover every account.
- Agents get the same grid in Phase 11.
1. **Users and sessions.**
- Tables:
- `users`: email, name, kind (person or agent), status (invited,