Developer forum

Forum » CMS - Standard features » Impersonate and Group frontend start page

Impersonate and Group frontend start page

Mario Santos
Reply

Hi,

 

I've two groups of users (Managers and Employees). The Managers can impersonate the Employees, the impersonate mode is set to Replace current user with impersonated user. This is working good.

I'm having issues when I set the groups frontend start pages (different pages for each group), and try to impersonate an employee. The user is switched but the Pageview.User.SecondaryUserID is not set, and I can't stop the impersonation. 

Does anybody had the same issue?

Dw version: 8.8.1.6.

http://screencast.com/t/aJ0An0pAAhA

 

Thank you, Mário


Replies

 
Nicolai Høeg Pedersen
Reply

In your video you login as a manager, and click on "Impersonate" link in the top. Should'nt it be a form on a page where the manager selects which user to impersonate?

http://manual.dynamicweb-cms.com/Dynamicweb-On-line-Manual/Modules/Users/Module-usage/Impersonation.aspx

BR Nicolai

 
Mario Santos
Reply

Hi Nicolai,

Actually we don't need a form to impersonate, the impersonate functionality works with GET. Instead of a form I had a list of anchors with the parameter "DWExtranetSecondaryUserSelector=user.ID", like I've done in some past projects. But, I've changed the template and added a form just to make sure and the issue keeps.

Thank you, Mário

 
Nicolai Høeg Pedersen
Reply

Hi Mario

I know it works with get. But what UserID does your Impersonate link goes to? That was not visible in your video.

Can we get access to the implementation? We cannot reproduce...

 
Mario Santos
Reply

Yes, sure. I've attached the code. What I'm doing wrong? Thanks

 
Nicolai Høeg Pedersen
Reply

That is custom code... You are not using the template tags.

In your code you like this:

serCollection users = String.IsNullOrWhiteSpace(Pageview.User.SecondaryUserID.ToString()) ? User.GetCurrentUser().GetUsersICanSetAsSecondary() : User.GetUserByID(Pageview.User.SecondaryUserUserID).GetUsersICanSetAsSecondary();

At this point you are not impersonating, so Pageview.User.SecondaryUserUserID will never have a value and you get a users collection of null... It will first have a value when you have impersonated someone...

So I don't understand why you do this.

In your layout template or login template from user management, you have a loop called DWExtranetSecondaryUsers that you can iterate to get a list of users you can impersonate. Once you have impersonated, you have a value on Pageview.User.SecondaryUserUserID.

You should take a look at the templates in the manual: http://manual.dynamicweb-cms.com/Dynamicweb-On-line-Manual/Modules/Users/Module-usage/Impersonation.aspx

 
Mario Santos
Reply

I was guessing that the loop DWExtranetSecondaryUsers was only available at layout template. I've added the UserManagement module on paragraph with the login template (LoginWithImpersonation.cshtml) that I've found in the manual.

The results are the same:

  • Impersonate mode set to Only tag orders with impersonating user:
    • I was able to impersonate and stop impersonate (the Pageview.User.SecondaryUserUserID was set)
  • Impersonate mode set to Replace current user with impersonated user and user groups without start page set:
    • I was able to impersonate and stop impersonate (the Pageview.User.SecondaryUserUserID was set)
  • Impersonate mode set to Replace current user with impersonated user and user groups with start page set:
    • I was able to impersonate but can't stop impersonate (the Pageview.User.SecondaryUserUserID was not set)

http://screencast.com/t/y15jT12VNi

I'm not sure what is missing.

Thank you, Mário

 
Oleg Rodionov
Reply

Hi all,

Yes, the issue is really reproduced on our test environment as well, new TFS 24436 has been submitted, thanks for observing.

BR, Oleg QA.

 
Mario Santos
Reply

Hi,

Thank you Oleg and Nicolai. Will this be fixed in the next 8.8.1.x release?

BR, Mário

 
Nicolai Høeg Pedersen
Reply

Yes.

 

You must be logged in to post in the forum