Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inactivity pruning #32

Closed
vincent-peugnet opened this issue Jan 14, 2021 · 3 comments
Closed

inactivity pruning #32

vincent-peugnet opened this issue Jan 14, 2021 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@vincent-peugnet
Copy link
Owner

account deactivation based on inactivity.

This sounds like a parameter in userClass:

  • inactive (int)

quantity of days before inactivity pruning ( 0 for immunity )

And of course, store in the User class the lastConnect (datetime) and active (bool) datas.

But how to implement this ? should it be :

  1. a cron job ?
  2. or when an user connect ?
  3. Or a scan triggered by admins or moderators ?

I know that I can easily implement a mix of 2 and 3, but maybe you have a better idea @n-peugnet ?

@vincent-peugnet vincent-peugnet added the enhancement New feature or request label Jan 14, 2021
@vincent-peugnet vincent-peugnet added this to the v1 milestone Jan 14, 2021
@n-peugnet
Copy link
Contributor

I would probably keep a lastActivity (datetime) in the user that would be updated on each of its action.
An active (bool) sounds great.
And for the automatic deactivation, a CRON job is more suited IMO. (Maybe symfony has some helper for this ?)
A manual scan can of course also be implemented.

@vincent-peugnet
Copy link
Owner Author

Yeah I made a mistake, lastConnect (datetime) is no use here.

And with lastActivity (datetime), I can display on each user profile the famous : "Las time seen ... minutes ago" 😄

@vincent-peugnet
Copy link
Owner Author

It seems like for this, I should create an event listener and listen to Kernel events.

There seems to be two possibilities:

  1. Listen to kernel.controller that is created just after the controller is choosen.
  2. Listen to kernel.terminate

    This event is dispatched after the response has been sent (after the execution of the handle() method). It’s useful to perform slow or complex tasks that don’t need to be completed to send the response (e.g. sending emails).

To checkout if the request is a isMasterRequest()

I like the idea of this post That add a isActiveNow() method to the user and only update the database after a given time (2minutes in the example). This make sense if the user is a LEFT CLIC KILLER !!

Strategy 2 seems sweet to me. What do you think @n-peugnet ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants