Hi,
We have a solution where when we log in as a person who can impersonate, there is a db call being made which is made for every user you can impersonate:
In this scenario, the logged in user can impersonate 7678 users.
Which results in a slow login because the call is being made for each user.
The list of users the person can impersonate is a query if that changes anything.
i've attached the debug=true result as a txt file, which you can change to .html if you want to have a look.
Is this call something that is necessary, and if not, something that can be toggled off?
Best regards,
Mikkel Hammer
Developer forum
E-mail notifications
AccessUserAddress call for every user you can impersonate causes slow login
Replies
It seems to be caused by a check like this:
if (Pageview.User.SecondaryUsers.Count > 0)
Sent to QA for verification.
Hi Mikkel,
Do you probably use the Rapido templates?
In Rapido templates (..\Files\Templates\Designs\Rapido\MasterBlocks\ImpersonationBar.cshtml) we do next check to verify that User has secondary users (impersonation check):
if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0)
Model.SecondaryUsers fills the collection of user models, so it could take a lot of time.
We can use Model.HasSecondaryUsers instead of it. It should work fast. So, instead of code above, we can do something like this
if (Model.CurrentUser.ID > 0 && Model.HasSecondaryUsers )
I have added to this message the attachment with fixed ImpersonationBar.cshtml template for the case if you use the Rapido.
Kind regards.
Hi Stanislav,
Yes it is indeed a rapido template, and HasSecondaryUsers seems to work as intended :)
Thanks a lot for the quick response!
Best regards,
Mikkel
Hello,
I have a similar problem in Swift, a user who can impersonate many users, when logging in it takes about 30 seconds..
this is the current version of the template
I updated it with a newer version:
and it still takes about 30 seconds.
Is there any fix for this?
Best regards,
Dan
Which version are you seeing this?
Hi Nicolai,
the first screenshot is taken from Swift version 1.10.0 and the second screenshot is taken from the current version on GitHub 1.24.0. The template is Swift_ImpersonationBar.cshtml
Hi Nicolai,
The Dw version is 9.14.14.
Adrian
The Dw version is 9.14.10
Hi Dan,
If you're willing to customize, I can offer a solution that can make it be much faster.
You can use the API to get the Users's index (which is used anyways in Swift) and from it get a count of user you can impersonate. That way it's not initializing a entire list of users.
Applying it in the end could be as simple as this
And here's (most of) the custom code for it
Hope that helps.
Nuno Aguiar
Hi Nuno,
Thank you very much for the solution! Now it loads very fast ;)
Best,
Dan Gheorghe
You are welcome Dan.
You must be logged in to post in the forum