Ibexa DXP Discussions

Community discussion forum for developers working with Ibexa DXP

Site access specific services

We have an installation of ez which we are upgrading from 1.9 -> 2.3

The previous installation used a app.pre_content_view_listener to preload all views with specific shared objects. This was/is configured in the main ezplatform.yml: Upgrade to 2.3 admin not loading: "No route found for "GET /admin""

After the upgrade, this listener is now affecting the backend. When I publish an object now we get errors due to this listener (we used the location service to fetch some content, which now does not play well with the admin).

To bypass this my immediate thought would be to make the said event listener site_access relative, or bundle relative opposed to global.

Is this possible and/or the correct approach for ez?

You can get the current siteaccess from the Request object. You can inject the request stack, get the current request and extract the siteaccess with:

$request = $requestStack->getCurrentRequest();
$siteAccessName = $request->attributes->get('siteaccess')->name;

Hopefully, that can be enough for you, since there’s no other way to make any service dependant on siteaccess, since activation of services in Symfony is done before siteaccess is resolved.

Ah ok, and inject this into the pre_content_view_listener

if(site access is not admin) then:…

Makes sense.

Yeah, something like that. Can’t think of any other way currently.

Would be cool if there was the option in the future to embed available services into a site access group. In my case the site_group.

This also work though and thanks :smiley:

1 Like