-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preview website as user / user-role of choice (masquerade-as function) #122
Comments
Think this is not easy to be implemented and maybe its part of the sulu community bundle /cc @wachterjohannes what you think? @nwaelkens in the controller you know if you are in the preview: https://github.com/sulu/sulu/blob/develop/src/Sulu/Bundle/WebsiteBundle/Controller/DefaultController.php#L32 so you could set it to the view: public function indexAction(StructureInterface $structure, $preview = false, $partial = false)
{
$response = $this->renderStructure(
$structure,
[
'preview' => $preview,
],
$preview,
$partial
);
return $response;
} So you can check with |
@alexander-schranz: That's for the moment indeed a solution for me, tnx! |
I don't know how we should handle that in the admin. maybe we could do it in community-bundle but also there we don't know what changes when the user is logged in. the only way would be to fake the user - but this will be quite hard to achieve. |
@wachterjohannes as we have an own kernel for Preview there could be an PreviewUserProvider this need only return a Symfony UserInterface for the roles. But don't know how much work is to add a roles dropdown in a third party bundle. And how to add a parameter which role is selected. But for me its definitly part of the community bundle. |
tbh for the current UI this is nearly impossible to extend by a third party bundle. this should be part of 2.0 refactoring. |
@alexander-schranz I also see that as a part of the CommunityBundle, therfore going to transfer the issue. |
Actual Behavior
The admin can preview pages meant for registered users only, but misses the member-elements on that page (logged-in bar with menu, reaction-form, etc). This is quite confusing.
The preview in the backend partly ignores if you are logged in as a user or not.
{% if app.user %}
to show/hide a member menu and/or other items for logged in users only.{% if app.user %}
resolves always tofalse
. That's unwanted behaviour and creates pages for the content-editor which do not exist.Expected Behavior / Solution
The feature I'm proposing is a masquerade-as-user option within the preview. See my screenshots.
I suggest:
Just a suggestion off course. This would be a great tool to preview the website, specially in combination with SuluCommunityBundle.
Drupal has a module 'Masquerade' which does this. https://www.drupal.org/project/masquerade
My screenshots:
The text was updated successfully, but these errors were encountered: