How to implement a session variable for data separation by user/account.

I have an entity in the domain model of my application that every single other entity is connected to via associations. This is because the domain model’s data needs to be separated by the location that each entity is bound to. Each object instance of the primary entity represents one of these locations.   When a user opens the app, they need to be able to select one of the locations and have it stick throughout the entire application so they can perform CRUD operations on entities that belong only to that location until they either leave the app or change their selected location.   Any help would be greatly appreciated!
1 answers

You would need to create access rules where a person is only allowed to make a change to an object if the location of the user is the same as the location of the object you are changing. It is just like creating a multi tenancy app where the location is the tenant object but the user is allowed to switch tenant.