How to keep track of currently logged in users?

Open Cart5 years ago

I need to modify the source code to keep a list of currently logged in users.
I would insert userId in incoming positions.
Reason am doing this is because my device does not reports driver id. I want my drivers to login into application before they start driving so I would bind user id to incoming positions. If there are multiple drivers, I will be able to generate reports of each driver on the basis of user id in position records.
To achieve this I am dividing this task into two sub tasks.

  1. Keep track of currently login users. I will create a table (tc_user_login) in database and insert user ID with action (login, logout).
  2. If device assigned to user is online and user is logged in, I will add user ID in the row of incoming positions. If device is online but user is not logged in, I will add unidentified user in incoming positions.

Please correct me in the following points if I am wrong.
In order to complete first task, I would call database queries from LogAction class and maintain ArraList of logged in users.
For second class, I would lookup the ArrayList of online users and insert user ID or unidentified user in position rows.

If this is not a good approach, could you prefer an alternative solution?

Ernesto Vallejo5 years ago

Create a new app using API and customize it as needed. Once you modify official app will immediately cause you a problem to upgrade to the newest available.