Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:27:09+00:00 2026-06-11T01:27:09+00:00

I searched everywhere but it seems impossible thing to do. I was able to

  • 0

I searched everywhere but it seems impossible thing to do.

I was able to catch SwitchEvent coming from SwitchEventListener and get both impersonator and target user objects (one being impersonated as) but I would really like, based on target user roles to redirect request to some other URL.

Example:

I have two restricted areas: “/basic” and “/elevated” where first one requires ROLE_BASIC and the other one ROLE_ELEVATED role. Now, if I am currently logged in as ROLE_ELEVATED user and want to switch to some ROLE_BASIC user using URL:

/basic/?_switch_user=some_basic_user

that would result in AccessDeniedException, and I’m forced to navigate first to:

/?_switch_user=some_basic_user. 

Only after that I can navigate to /basic as token has been written to session.

Now, the question, as subject suggests: Is there any way to redirect user using SwitchEvent (or any other) after doing user switching?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:27:10+00:00Added an answer on June 11, 2026 at 1:27 am

    Ok, I finally got access to my dev computer and looked up the the solution to this problem.

    And, I got to say, it is not as clean as I wanted it to be but delivery date was critical and this was the only way to achieve it back then.

    So, what I basically did was to send AJAX (although, I set async to false) request to URL /?_switch_user=some_basic_user, wait for an answer and if it was successful I would navigate forward to /basic/?_switch_user=some_basic_user URL. I know, it’s quick and dirty, and is pretty much unreliable…

    Hope this helps….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched everywhere from google to this site but seems no answer for it.
Okay, so first, I have searched for this everywhere but it seems like every
I've searched everywhere for this, but I can't seem to find a solution. Perhaps
I searched everywhere but didn't find the solution. I have image 1. How can
I searched everywhere but can't find it. So I'm asking it here. I want
I have searched everywhere but can't find a simple example of paging in MySQL
I've searched everywhere for this but couldn't find the solution, so I decided to
I searched pretty much everywhere on google, but I didn't find anything useable. I
I don't get this. I've searched everywhere and no one's answers have solved this
I have searched everywhere for this and it seems like there isn't any obvious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.