lastuser
lastuser copied to clipboard
Admin "sudo" framework
We occasionally receive support requests stating something is not working for a user, or sometimes we have to setup an account on behalf of a user (such as a guest speaker at an event or a customer receiving a walkthrough from a sales person).
At this time there is no mechanism for an admin to access another user's account. This is required. Process:
- Admin opens an incognito window and logs in to Lastuser (since client apps aren't necessarily aware of sudo mode and will still show the admin user's account).
- Admin then activates sudo mode, which copies the
useridandsessionidfrom their session cookie intosudo_useridandsudo_sessionid(thereby indicating this is a sudo session). - Admin picks from a menu: register as a user, or login as an existing user (using admin's password instead of user's password).
- The user's credentials are processed as with a regular login (using
login_internal), but the Session record is now flagged with the parent session to indicate sudo access. - The user is sent an email notification (verified address only) about an admin accessing their account, including the admin's identity (fullname and username, not necessarily contact information).
- When the admin logs out of the user's account (using
logout_internal), the user is sent another email notification and the admin's credentials are restored from thesudo_*session keys. - If a sudo session is idle for half an hour (background sweep), it is logged out automatically, with the email notice stating that it was closed for inactivity.
Admins are identified using the same configuration setting that is used for dashboard access.
As this is a sensitive feature, email notifications alone aren't sufficient. We need an audit log for each user account logging this and other critical actions (profile, org, team updates).
How does this work in the case of client apps? App sessions aren't as easy to replicate as browser sessions.