Remove or hide the "Impersonate" functionality

Stefan Sturm asked on April 10, 2019 15:25

Hello,

due to legal purposes we need to remove the "impersonate" functionality.

Is there any easy way to achieve this?

Kind regards, Stefan

Correct Answer

Brenden Kehren answered on April 10, 2019 15:53

Simply put, don't allow anyone to be assigned the "Global Administrator" privilege level and you'll be set. If that won't work, you'll need to update the base code in two places. Keep in mind the below is simply a suggestion and NOT a best practice as it goes against Kentico Best Practices to modify the base code. So I'd suggest if you plan to do the following below, you document what you did becuase it will revert back to "normal" when you upgrade.

First, you need to edit /CMSModules/Membership/Pages/Users/User_Edit_General.aspx.cs. Starting about line 93 (for v11) where it's doing a check to see if the privilege level is Global admin or not. If so it adds the button to the header actions. Simply comment out this code and it will remove the functionality, in this spot.

Second is the use icon in the top right of the screen. You can find this code under /CMSAdminControls/UI/UserMenu.ascx.cs Simply put for this one, you want to set the visibility of the Impersonation placeholder. So about line 155 and 158 (v11) set the cancel impersonation and impersonate placeholders to false. That should do the trick. So no matter what this will always hide that button.

1 votesVote for this answer Unmark Correct answer

Recent Answers


David te Kloese answered on April 10, 2019 15:34

In case you impersonate, this will be visible in the log? So you should always be able to see if something like this happens

Image Text

0 votesVote for this answer Mark as a Correct answer

Stefan Sturm answered on April 10, 2019 15:43 (last edited on April 10, 2019 15:44)

Hello David,

If I'm right Log entries are limited, so its not a reliable information source. But in our case it must simply be denied to impersonate, also for an administrator.

0 votesVote for this answer Mark as a Correct answer

Stefan Sturm answered on April 10, 2019 17:25

Thank you Brenden!

This was exactly what i was looking for.

Regards Stefan

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.