Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DX] Switch user from the WDT #14458

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
{{ collector.tokenClass|abbr_class }}
</div>
{% endif %}
{% if 'ROLE_PREVIOUS_ADMIN' in collector.roles %}
<div class="sf-toolbar-info-piece">
<b>Switch to user</b>
<a href="?_switch_user=_exit" title="Switch back">Exit</a>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the current url allow only POST method ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact. What about using an AJAX request to a special URL ?

</div>
{% elseif 'ROLE_ALLOWED_TO_SWITCH' in collector.roles %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it won't work when the role is modified

# app/config/security.yml
security:
    firewalls:
        main:
            switch_user: { role: ROLE_ADMIN }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact. Added to the todo list. That goes with the customization of the request parameter.

<form class="sf-toolbar-info-piece">
<b>Switch to user</b>
<input name="_switch_user" placeholder="username" required="required" size="15"/>
</form>
{% endif %}
{% elseif collector.enabled %}
You are not authenticated.
{% else %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@
overflow-y: auto;
}

.sf-toolbar-block input {
border: 1px solid #bbb;
padding: 0 4px;
}

.sf-toolbar-ajax-requests th, .sf-toolbar-ajax-requests td {
border-bottom: 1px solid #ddd;
padding: 0 4px;
Expand Down