Hi,
I built a plugin which is running onDocFormSave event. When saving a resource, it creates a new context with some context settings (e.g. site_url and http_host), access policies and a resource in this context (a symlink). This symlink contains the resource I am saving and is used to show my content on a different domain.
When saving my resource as an administrator, everything works fine. I can see my resource content on the domain.
When saving it with a different user role, the context and symlinks are created as well, but the domain is showing the error page when I browse it. I then have to save the symlink and context manually again, then I can see the content on the domain.
Since everything gets created properly, I think that the problem might be related with the following code. Is it possible that this is only working when executed from a plugin which is triggered from an admin user? I already tried to give the other user roles empty_cache permission, but without success.
I am using Xrouting for routing the domains.
$modx->cacheManager->refresh(array(
'auto_publish' => array('contexts' => $contexts),
'context_settings' => array('contexts' => $contexts),
'resource' => array('contexts' => $contexts),
));