November Happy Hour will be moved to Thursday December 5th.

Log in as user, programatically - CMS 12

Vote:
 

In CMS 11 we could log in as a user like this

PrincipalInfo.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("Dummy User"), new[] { "Everyone" });

It made sense in scheduled jobs, if it were important that the job had the privilieges as a normal visitor. Even if the job were started manually.

How can this be done in CMS 12? PrincipalInfo.CurrentPrincipal is readonly now.

#281054
Edited, May 29, 2022 9:55
Vote:
 

Have you tried `IPrincipalAccessor`?

#281256
Jun 02, 2022 7:09
Vote:
 

You are correct, Vincent, IPrincipalAccessor was the way to go! I figured it out, but forgot to update this thread.

#281257
Jun 02, 2022 7:12
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.