IBX-8074: Made SiteAccessService react to CONFIG_SCOPE_CHANGE/RESTORE - #805
Open
Steveb-p wants to merge 3 commits into
Open
IBX-8074: Made SiteAccessService react to CONFIG_SCOPE_CHANGE/RESTORE#805Steveb-p wants to merge 3 commits into
Steveb-p wants to merge 3 commits into
Conversation
getCurrent() only ever reflected the value set once via the shared SiteAccessAware::setSiteAccess() singleton, so it never picked up a scope change dispatched by ContentPreviewHelper or ConsoleCommandListener. It now keeps a small stack, pushing on CONFIG_SCOPE_CHANGE and popping on CONFIG_SCOPE_RESTORE.
ibexa-workflow-automation-1
Bot
requested review from
ViniTou,
alongosz,
barw4,
bnowak,
ciastektk,
konradoboza,
mikadamczyk,
tbialcz and
wiewiurdp
and removed request for
a team
August 12, 2026 11:53
Contributor
Author
|
Backported this to 4.6 too: #806 |
|
Contributor
|
If that's backported to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Related PRs:
IBX-12204, 6.0) — the full stack feature this is a narrow slice ofDescription:
SiteAccessService::getCurrent()only ever returned whatever was set once via the (shared, singleton)SiteAccessAware::setSiteAccess()call.ContentPreviewHelper::changeConfigScope()/restoreConfigScope()andConsoleCommandListener::onConsoleCommand()build a newSiteAccessand only dispatch it as aScopeChangeEventunderMVCEvents::CONFIG_SCOPE_CHANGE/CONFIG_SCOPE_RESTORE— they never touch that shared object. So during content preview or a--siteaccessCLI run,getCurrent()kept returning the outer/main siteaccess instead of the one that's actually active.SiteAccessServicenow implementsEventSubscriberInterfaceand reacts to those two events directly, keeping a small stack: push onCONFIG_SCOPE_CHANGE, pop onCONFIG_SCOPE_RESTORE(never below the base entry, so an unbalanced restore can't null out the current siteaccess).setSiteAccess()still seeds the base of that stack, so the existing DI wiring inrouting.ymland theSiteAccessAwarecontract are untouched.This is deliberately not the full
IBX-12204/#798 rework — nochangeSiteAccess()/restoreSiteAccess()API, noSiteAccessAwaredeprecation, no migratingContentPreviewHelper/ConsoleCommandListener/etc. off it, noMVCEvents::SITEACCESS/FINISH_REQUESTsub-request handling. Just the reactive fix, sinceContentPreviewHelperandConsoleCommandListeneralready dispatch the events we need — zero changes required on their end.For QA:
Unit coverage is in
SiteAccessServiceTest(change/restore, the never-drop-base guard, nested change/restore round-tripping). To see it manually:$container->get(SiteAccessServiceInterface::class)->getCurrent()->name(e.g. from a debug template block, or a breakpoint inContentPreviewHelper::changeConfigScope()right after the call) — it should be the previewed siteaccess, not the one you started from.getCurrent()should be back to the original siteaccess.Same idea for CLI: run any command with
--siteaccess=<other>and confirmSiteAccessServiceInterface::getCurrent()->namereflects it instead of the default.