Skip to content

Sync v2: member list endpoint for pgacc - #1

Merged
PeterTheOne merged 4 commits into
mainfrom
feature/sync-v2-members
Nov 1, 2026
Merged

PeterTheOne merged 4 commits into
mainfrom
feature/sync-v2-members

Conversation

@PeterTheOne

@PeterTheOne PeterTheOne commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Sync v2, membership side: the member list for pgacc (counterpart of PPOE/pgacc#84).

  • Adds internal/members.php, with its own document root; the logic is in pgacc/members-api.php. It replaces and removes pgacc/adm_names.php (the old mcrypt-encrypted member list). accsync.php is replaced in Sync v2: write pgacc's payments into Admidio (accsync.php) #2.
  • 403 with an empty body unless REMOTE_ADDR is a peer of the secrets file and the bearer token matches (hash_equals). A missing or invalid secrets file, an empty token or an empty peer list refuse everything. Database errors give 503 with an empty body.
  • JSON [{id, uuid, name, lo, paid}] from one prepared SELECT on the view pgacc_members, read by a user with SELECT on the view only (pgacc/pgacc_members.sql).
  • The view returns valid users with an active role-2 membership, one row each, and the latest active regional organisation (ties go to the lowest role id). paid means field 26 is today or later: "paid until 31 December" still counts as paid on 31 December (the old adm_names.php made everyone unpaid that day).
  • The secrets file is members-secrets.php; its path comes from the PGACC_MEMBERS_SECRETS fastcgi_param. The deployment writes the file, sets up the listener and certificate and applies the SQL; the README describes them (certificate convention: own /etc/<app>/sync-tls.{crt,key}, peer's /etc/<app>/<peer>-tls.crt, self-signed by the callee, handed to the caller through the inventory).
  • Tests: tests/run.sh (MariaDB 12.3 + PHP 8.5 in Docker, synthetic users only, red first, incl. the 31 December / 1 January boundary) plus a GitHub Actions workflow.

Merging with #2: the test harness (tests/schema.sql with every Admidio table both add-ons use, tests/users.sql, tests/grants.sh, compose.yaml, Dockerfile, run.sh running each tests/*-test.php, .github/workflows/tests.yml) is identical in both branches; each branch only adds its own test file and pgacc/*.sql. Whichever merges second merges cleanly except the README sections and the LICENSE list of imported files (keep only mail-alias-sync/adm_mail.php).

Astra review: nothing actionable on the first version; the re-run after these alignment changes hit the Codex usage limit (pending).

🤖 Generated with Claude Code

PeterTheOne and others added 2 commits November 1, 2026 02:10
Sync v2, membership side: pgacc fetches the active members as JSON
([{id, uuid, name, lo, paid}]) from an internal listener. 403 with an
empty body unless the socket address is a configured peer and the bearer
token matches; an empty or missing configuration refuses everything; any
error after that is 503 with an empty body. One prepared SELECT on the
view pgacc_members (one row per valid user with an active role-2
membership; the latest active LO role 37-45, ties to the lowest id;
paid = field 26 after today), read by a user with SELECT on the view only.

Tests (tests/run.sh, MariaDB 12.3 + PHP 8.5 in Docker, synthetic users)
and a GitHub Actions workflow running them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The old encrypted member list for pgacc (mcrypt, shared key, no
authentication) is replaced by internal/members.php. README and LICENSE
no longer list it as imported code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PeterTheOne and others added 2 commits November 1, 2026 03:04
… shared test harness

The secrets file and its FastCGI parameter are named like the other sync v2
secrets (members-secrets.php / PGACC_MEMBERS_SECRETS). The test harness is
the same in both sync v2 branches: one schema with every Admidio table the
add-ons use, one users file, every pgacc/*.sql applied, and run.sh runs each
tests/*-test.php, each resetting its own data. README: the sync v2 section in
the shared structure, with the certificate path convention. LICENSE: the
imported files as a list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Paid until 31 December" is still paid on 31 December: field 26 >=
CURRENT_DATE (was >, as in the old adm_names.php, which made every member
unpaid on 31 December). Tests for today, 31 December and 1 January.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PeterTheOne
PeterTheOne merged commit b5b3c70 into main Nov 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant