Skip to content

fix(marketing): the public intakes write the contact, client and lead as the system account - #2503

Open
rubenvdlinde wants to merge 7 commits into
developmentfrom
fix/intake-writes-as-system-account
Open

rubenvdlinde wants to merge 7 commits into
developmentfrom
fix/intake-writes-as-system-account

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Both public intakes, the web form lead (SubmittedLeadIntake, run from SubmittedLeadListener) and the landing page submission (LandingPageFormSubmittedListener), found and created the contact, the client and the lead through ListObjectStore, which calls OpenRegister with _rbac: false. They now take SystemObjectStore: every find and save runs as pipelinq-system through SystemServiceAccount::runAsSystem() with OpenRegister's access checks on. The register's authorization block already grants user:pipelinq-system read, create and update on contact, client and lead (99-zzz-register-access.json), so nothing in the register changes.

Stacked on #2498 (it introduces SystemObjectStore). Land #2498 first; this PR's own diff is the last commit, 8913d60.

Tests:

  • LandingPageFormSubmittedListenerTest::testTheVisitorsRecordsAreWrittenAsTheSystemAccount: an anonymous visitor's submission with an organisation writes client, contact, lead, touchpoint and the contact's touches, every call as pipelinq-system with _rbac on, and the visitor is anonymous again afterwards.
  • SubmittedLeadIntakeTest::testThePartiesAreWrittenAsTheSystemAccount: the web form lead's contact and client, the same.
  • SubmittedLeadIntakeTest::testNoPublicIntakeWritesWithAccessChecksOff: neither intake's source holds _rbac: false or ListObjectStore.
  • The test helper BuildsSystemObjectStore now records the user each call ran as, and its fake OpenRegister still refuses any call with _rbac: false.

git grep -n "_rbac" -- lib/Service/Marketing/SubmittedLeadIntake.php lib/Listener/LandingPageFormSubmittedListener.php finds nothing (exit 1); the same for ListObjectStore.

Still _rbac: false on this path, both READS, not changed here: the nonce guard TouchpointService::existsForNonce() and the campaign lookup CampaignService::find(), both over ListObjectStore. Moving them is a follow-up if you want the whole path on the system account.

Found while testing, not changed: a landing page submission creates the client but does not link the new contact to it, so recordSubmission touches the contact and not the client on that path (the web form path does link them).

Spec: REQ-MOC-004 in marketing-campaign-on-client now names the intakes' contact, client and lead writes, with a scenario for an anonymous visitor; task 1.7 added and ticked.

Checks at 8913d60: lint 0, phpcs 0, phpmd 0, psalm 0, phpstan 0, PHPUnit 0 (3754). PHP only, so npm and vitest were not rerun; the Hydra gates were not rerun for this commit (#2498's run is 10 failed, all inherited).

…itten as the system account with access checks on
…are not readOnly, so OpenRegister imports contact and client

CI's import refused both schemas: 'serverSet' is not a top-level property key. readOnly would also have refused the touch write on every existing contact; firstTouch is immutable instead, both are hidden in forms.
…ystem account with access checks on, refusals and fallbacks
…ad as the system account, access checks on

SubmittedLeadIntake and LandingPageFormSubmittedListener took ListObjectStore, which runs with _rbac false. They now take SystemObjectStore: every find and save runs as pipelinq-system through SystemServiceAccount::runAsSystem with OpenRegister's access checks on, and the register's authorization block (which grants user:pipelinq-system on contact, client and lead) decides.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/pipelinq @ ca155db

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
check-vue-demi ✅
test-l10n ✅
format ✅
check-schema-l10n ✅
check-l10n-js ✅
check-e2e-nav ✅
check-lib-link ✅
composer ❌ ✅ 109/109
npm ✅ ✅ 747/747
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ✅ 3745/3745 · 9 skipped
Newman ✅ 66/66
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-10-15 18:53 UTC

Download the full PDF report from the workflow artifacts.

This branch has not been deployed

No deployments
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