Variables applicable to a session?

I’m trying to implement a multi-tenant solution whereby my tenant users would be able to work on their specific objects while my super admin users would be able to work on every tenants’ objects. Ideally, I would like to be able to use the same screens for both super admin and tenants. This means I need a mechanism to identify which tenant a super admin is acting “in the name of” until switching to another one.  Intuitively, I would have used some sort of session variable to store the current user’s tenant or the tenant that the SA has selected. From then on, each time I need to store or filter data by tenant, I’d just use this variable to determine the corresponding tenant. But I couldn’t find a way to add custom objects to the session.  Is there a best practice to handle this case? Thanks    
1 answers

If you hold the tenant in a object an associate the users with the tenant, you could create an admin user that also is part of a tenant. The allow the admin to switch from one tenant to another and you’re done.

This will however not work for the build in MxAdmin as this is not stored in the user entity. If this is really needed you could setup the association to the session entity and in the entity access make sure the MxAdmin rights to data follow the path to the tenant via the session and allow the MxAdmin to change the relation to the tenant from the session object.