[5690] User last active#6466
Conversation
|
@amercader , can we use successful login signal from the |
|
@TomeCirun @smotornyuk as I mentioned on the issue I think that rather than tracking logins we should track the last time a user has been active, ie identified in a request. Otherwise we lose all API access. So basically have a This does mean a DB write on each request so maybe we can store the current last_active value in the session and only write it if its bigger than X mins (which can be configurable). If all this seems to complicated and we want to stick with actual UI logins I'm fine with it. |
Yes, that's right. When I added this signal, it decided that Authenticator is the right place to notify about successful logins. And other authenticators probably should also emit this signal when it's appropriate. I didn't put this signal to the
This means that we have to collect all the sessions periodically and check them. Which in turn requires two decisions:
Another option(really unreliable) is to modify the user object and do not call
|
|
Hey, @amercader do these changes seem sensible? |
amercader
left a comment
There was a problem hiding this comment.
This is looking great @TomeCirun , but we need a test to make sure that the functionality works as expected. Add a test where the user does a request to see if last_active gets set, and maybe another one to check that ckan.user.last_active works. Let me know if you need pointers on how to write those.
|
@amercader do you have any idea why this happens? |
|
@TomeCirun I don't know about these failures, but they are unrelated to your changes. I've created an issue to track them if you want to investigate in a separate PR: #6537 Thanks for your PR, we'll review it as soon as we have availability |
|
Hey, @amercader is there anything else that can be done in this PR? |
|
@amercader is there anything preventing us to merge this PR? |
Only time, and the relentless onslaught of the world against our attention. Thanks for this, it's a very valuable contribution |
Fixes #5690
Proposed fixes:
I added:
-
last_activecolumn tousertable-
set_user_last_logininstance method-
helper function-
migration fileFeatures:
Please [X] all the boxes above that apply