Skip to content

Commit 1d8b00c

Browse files
committed
[chores] Added support for user expiration reminders #608
- Added celery beat schedule for expiration reminder emails - Added support for openwisp_users expiration tasks - Added configurable reminder email schedule variable Closes #608
1 parent 796d407 commit 1d8b00c

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

defaults/main.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ openwisp2_radius_version: "openwisp-radius @ https://github.com/openwisp/openwis
1717
openwisp2_django_version: "django~=5.2.0"
1818
openwisp2_extra_python_packages:
1919
- bpython
20+
# TODO: Remove before merging
21+
- "openwisp-radius[openvpn_status] @ https://github.com/openwisp/openwisp-radius/tarball/issues/706-user-expiration"
22+
- "openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/issues/499-user-expiration"
2023
openwisp2_extra_django_apps: []
2124
openwisp2_extra_django_settings: {}
2225
openwisp2_extra_django_settings_instructions: []
@@ -212,7 +215,8 @@ freeradius_eap_openwisp_site_template_src: freeradius/eap/openwisp_site.j2
212215
freeradius_eap_inner_tunnel_template_src: freeradius/eap/inner_tunnel.j2
213216
freeradius_eap_template_src: freeradius/eap/eap.j2
214217
cron_delete_old_notifications: "'hour': 0, 'minute': 0"
215-
cron_deactivate_expired_users: "'hour': 0, 'minute': 5"
218+
cron_expiration_reminder_email: "'hour': 0, 'minute': 3"
219+
cron_deactivate_expired_users: "'hour': 0, 'minute': 1"
216220
cron_delete_old_radiusbatch_users: "'hour': 0, 'minute': 10"
217221
cron_cleanup_stale_radacct: "'hour': 0, 'minute': 20"
218222
cron_delete_old_postauth: "'hour': 0, 'minute': 30"

docs/user/role-variables.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ take a look at `the default values of these variables
447447
# Defaults to "templates/freeradius/eap/eap.j2" shipped in the role.
448448
freeradius_eap_template_src: custom_eap.j2
449449
cron_delete_old_notifications: "'hour': 0, 'minute': 0"
450-
cron_deactivate_expired_users: "'hour': 0, 'minute': 5"
450+
cron_expiration_reminder_email: "'hour': 0, 'minute': 3"
451+
cron_deactivate_expired_users: "'hour': 0, 'minute': 1"
451452
cron_delete_old_radiusbatch_users: "'hour': 0, 'minute': 10"
452453
cron_cleanup_stale_radacct: "'hour': 0, 'minute': 20"
453454
cron_delete_old_postauth: "'hour': 0, 'minute': 30"

templates/openwisp2/settings.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,22 @@
245245
CELERY_BROKER_TRANSPORT_OPTIONS = {
246246
"max_retries": {{ openwisp2_celery_broker_max_tries }},
247247
}
248-
249248
CELERY_BEAT_SCHEDULE = {
250249
{% if openwisp2_users_user_password_expiration or openwisp2_users_staff_user_password_expiration %}
251250
"password_expiry_email": {
252251
"task": "openwisp_users.tasks.password_expiration_email",
253252
"schedule": crontab(**{ {{ cron_password_expiration_email }} }),
254253
},
255254
{% endif %}
255+
"deactivate_expired_users": {
256+
"task": "openwisp_users.tasks.deactivate_expired_users",
257+
"schedule": crontab(**{ {{ cron_deactivate_expired_users }} }),
258+
"args": None,
259+
},
260+
"expiration_reminder_email": {
261+
"task": "openwisp_users.tasks.expiration_reminder_email",
262+
"schedule": crontab(**{ {{ cron_expiration_reminder_email }} }),
263+
},
256264
{% if openwisp2_notifications_delete_old_notifications %}
257265
"delete_old_notifications": {
258266
"task": "openwisp_notifications.tasks.delete_old_notifications",
@@ -267,12 +275,6 @@
267275
},
268276
{% endif %}
269277
{% if openwisp2_radius and openwisp2_radius_periodic_tasks %}
270-
"deactivate_expired_users": {
271-
"task": "openwisp_radius.tasks.deactivate_expired_users",
272-
"schedule": crontab(**{ {{ cron_deactivate_expired_users }} }),
273-
"args": None,
274-
"relative": True,
275-
},
276278
"delete_old_radiusbatch_users": {
277279
"task": "openwisp_radius.tasks.delete_old_radiusbatch_users",
278280
"schedule": crontab(**{ {{ cron_delete_old_radiusbatch_users }} }),
@@ -415,6 +417,7 @@
415417

416418
LANGUAGE_CODE = "{{ openwisp2_language_code }}"
417419
TIME_ZONE = "{{ openwisp2_time_zone }}"
420+
CELERY_TIMEZONE = TIME_ZONE
418421
{% if openwisp2_internationalization %}
419422
USE_I18N = True
420423
{% endif %}

0 commit comments

Comments
 (0)