Setting up Auto Retiring User Task

This guide explains how to create an auto-deactivating-user task in OpenMRS. The setup involves setting the "number of days to retire users" and configuring the auto-deactivation task via the user interface.

The auto-deactivating user task is implemented as a scheduled task in OpenMRS. This task will automatically retire users who have been inactive for the specified number of days.

Note: Admin users (aka super users) will not be retired.

Task Configuration

  1. Set up configuration details for the task:

    • Name: Name of the task e.g. Auto Retire Users

    • Description: Short description of the task e.g. Retires all active users that are inactive for XX number of days specified by the value of the global property 'users.numberOfDaysToRetire'.

    • Schedulable Class: org.openmrs.scheduler.tasks.AutoRetireUsersTask

 

  1. Schedule the task:

  • Start Time: Set the desired start time.

  • Repeat Interval: Set to desired repeat interval.

  • Start on Startup: Set to true if you want the schedule to start immediately after the application starts.

  1. Set the global property users.numberOfDaysToRetire and it’s value as numeric value e.g. 2 (if you want to auto-retire users after 2 days of inactivity).

  2. Save the configuration.

The task will now be scheduled to run at the specified interval, automatically retiring inactive users based on the global property setting.