Enhancing The Impersonate Functionality

Update: This has now been added OOB to Geneva to the elevate privilege dialog, but not for the impersonate dialog


When building security rules, I find myself impersonating back and forward constantly between numerous users trying to test what a user can see or do.

What gets to me is that every time I impersonate, it throws me to the homepage and then I had to navigate again to the correct location I was testing.

You could of course open multiple windows and impersonate in the other one, but things eventually get confusing.

Instead, what I added was the ability to stay on your current page by adding a new checkbox to the impersonation page:

Screen Shot 2015-07-27 at 15.39.29

(Note: I know it looks out of place, but I couldn’t be bothered to do any styling! Was just an admin thing :> )

To add the checkbox, I amended the ‘impersonate_dialog’ UI macro by adding one line:

Remain on same page: <input type="checkbox" name="stayonpage"/>

Now that the checkbox was added to the form, I wanted to re-direct according to whether this is checked or not.

This required a small amendment to the ‘impersonate_dialog’ UI page.

In the processing script, you can see it does the redirect and hardcoded to navpage.do.

Changing this to the following will re-direct back to the last page on the stack:

//Check that the checkbox has been sent back
if (typeof stayonpage != 'undefined' && stayonpage == 'on') {
//If its been checked, find the bottom URL from the stack and re-direct accordingly
response.sendRedirect('nav_to.do?uri=' + gs.getSession().getStack().bottom());
else {

This little change will improve the impersonation functionality massively (at least I found it immensely useful).

You can also do a very similar thing on the elevate privileges page (elevated_role_dialog). So when, for example, you find an ACL you want to update but can’t because your privileges aren’t elevated, you can elevate and still remain on the relevant ACL.

Only other thing to note is that I wouldn’t recommend putting this in an update set and moving it outside of your non-production environments.

Editing out of the box UI pages and UI macros puts your upgrades at a higher risk of breaking.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.