A login within a login? An account within an account?

Imagine you want an app where user logs in and enters different incidents to do work.


Whenever a user logs in to your app, his user record is always "invisibly present in the background". That means he may not see his details on every screen, but the system can always use GetUserId() and read/write stuff using the user's identity.


My question: How can we have both a user record and an incident record "invisibly present in the background"? That means when user makes a change, the change can be tagged to him using GetUserId() AS WELL AS tagged to the incident he is in using a sort of "GetIncidentId()".


So when userX is in incidentA and he creates a record, system can both GetUserId() and "GetIncidentId()" to identify the record. Then userX can logout of incidentA and login to incidentB then create a record, and this second record will be tagged to userX and incidentB. Then we can repeat the process with userY...


How would you do this? Is this a login within a login? An account within an account?

Hello Ys, 

There are lots of different ways of doing this, depending on your interface, and you don't need anything closer to a login inside login. 

How is your interface? does the user creates a record from inside an Incident detail page? Or a list? 

Just pass the Incident I'd to the new page and use it when saving the record... 

What's the problem with this approach? 

Cheers. 

For what i can understand, what you want to achieve is not really a login within a login, but you want to have a Context for user operation. In your example the user would log in, and the context would be the Incident he is working on. 

To achieve this you can do it quite a few ways, one for example the following pattern:

Set a session variable name IncidentId of the type Incident id, and create 3 functions:

- LogOnToIncident() where you would set that session variable

- LogOffFromIncident() where you would clear the session variable

- GetIncidentId() where you retrieve the Incident Id 

Hope this helps you 

Best Regards,