Developer forum

Forum » CMS - Standard features » Get list of users that can impersonate

Get list of users that can impersonate

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

I thought I could use this function to get the list of users that can impersonate the current user:

var currentUser = Dynamicweb.Security.UserManagement.User.GetCurrentExtranetUser();
var users = currentUser.GetUsersThatCanSetMeAsSecondary();

This does not return any users, even if I have added users to the list through admin.

2019-08-08_1333.png

Replies

 
Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

Okay, I found out what's causing this. The currentUser object is saved upon login. If changes are made after the user has been logged in, the changes are not shown. As soon as I logged out, and in again I saw the changes. I have to get a new user object, in order for it to work without logging out and in again.

 

You must be logged in to post in the forum