New Bug With Experimental Impersonation Interface

AI-generated summary

In the topic regarding a new bug with the experimental impersonation interface, PandaKai7 reported an issue where exiting impersonation resulted in a “resource not found” error. Developer martin investigated and identified the root cause: the system incorrectly checks if the impersonated user belongs to the Staff group when stopping impersonation, rather than checking the acting admin. This specifically affects instances where the feature is configured for “Staff” only, as the impersonated user typically lacks staff privileges [6].

Additionally, Moin and martin discussed a separate issue regarding a hidden 15-minute time limit for impersonation, which terminates the session without updating the UI. martin noted that while this is a known limitation, a better user experience would involve auto-refreshing the interface or displaying a warning when the limit is reached.

A fix for the Staff permission bug was proposed in PR #37655. After deployment, PandaKai7 confirmed that the issue was resolved and the feature now functions correctly.

Hello! I would like to report this bug I found, where if you try to exit out of the new experimental impersonation feature, it tells me that the requested URL or resource can’t be found.

Proof:

3 Likes

By the way, this is what I was using for this.

1 Like

Thanks for the report, will have a quick look since I worked on this area recently :eyes:

3 Likes

Welcome to Meta :wave:

How long did you impersonate the user? I noticed something similar and I think it was related to me doing something else in between, so I impersonated them for longer than 15 minutes. I think impersonation is terminated then, but the interface doesn’t reflect that. After a reload, I was always back at my admin account.

2 Likes

I’ve found the issue and I’m working on a fix, it’s just a bug with the change to use upcoming changes. I’m checking if the current user (AKA the impersonated user) can impersonate when stopping the impersonation, rather than the acting user (the admin).

This only happens when Staff is used for the upcoming change “Enabled for”

4 Likes

Ohhh, so it’s a bug with making it staff only, since impersonated user isn’t staff?

2 Likes

Then my issue is a different one. I selected “everyone” and the user I impersonated was a moderator.

2 Likes

Yes, with Everyone it doesn’t matter, but for Staff then it will check the current user is in the staff group (which, unless you impersonate an admin or moderator, they won’t be).

Yes there is a hidden experimental_impersonation_time_limit_minutes setting set to 15 minutes. I’m not super familiar with this system, but definitely would be a nicer experience if we auto-refreshed/updated the UI once you pass this limit, or at least indicate it somewhere.

3 Likes

I am not sure if it was because 15 minutes had passed, but it’s not unlikely. I didn’t want to wait another 15 minutes to verify. I was more focused on how editing categories worked for the moderator than on the impersonation feature.

But I think the error in the browser console was something that refered to the timer

3 Likes

Fix incoming here:

https://github.com/discourse/discourse/pull/37655

4 Likes

Will this automatically update the discourse forum? Because when I just tested it, it looks like the changes aren’t in effect.

1 Like

If you’re hosted with discourse.org updates are done periodically, so once a fix is made it can be anywhere from a couple days to a couple weeks before you get it. At the bottom of your /admin page you can see when your site was last updated.

1 Like

I just deployed your site, fix should be available in about 30 minutes from now :slight_smile:

2 Likes

Thank you! It now works.

2 Likes