Getting and Signing in as a user via backend code
I am able to successfully retrieve the UserGuid for a specific customer, but I'm looking for the process of using the code that once the customer's UserGuid is identified, that it would sign-out the current employee's account, and sign-in as the customer account.
Once our staff assist's their customer with their issue, it is policy for the user to sign out, and log back in as themselves.
Thanks!
Hi Troy,
You can check the following forum thread where a similar question has been discussed:
http://www.sitefinity.com/developer-network/forums/developing-with-sitefinity-/sitefinity-6-x-impersonation
And for logging out users via API you can check the following:
http://docs.sitefinity.com/for-developers-authentication-sign-out-api
Regards,
Pavel Benov
Telerik
I'm using the code below to authenticate the user. Is there something I can do to prevent the customer from being granted this privilege that we certainly don't want them to have? Thanks!
UserLoggingReason result = SecurityManager.AuthenticateUser("OpenAccessMembership37Provider", membershipUser.UserName.ToString(), true, out membershipUser);
I resolved this issue in the post above. When I imported users from our Sitefinity 3.7 site, it gave all users backend access. I simply updated the sf_users is_backend_user to 0 via SQL Server. I didn't realize that users still had the Backend Users" role associated. When I authenticated the user I guess it reapplied the is_backend_user flag to true. Removing that role prevented this from happening again.
On a related note, I noticed that when a user is created via the dashboard module, it automatically has the backend user checkbox checked. Is there a way to uncheck that by default, just in the event that an employee creates an account for a customer and doesn't uncheck the box. Thanks!