Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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

Setting the Number of Days to Retire Users

  1. Log in to OpenMRS.

  2. Set the global property users.numberOfDaysToRetire

  3. Save the changes.

Running the Auto-Deactivating User Task

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.

Implementation

The task is defined in the AutoRetireUsersTask class.

Steps to Schedule the Task:

  1. Set up configuration details for the task:

    • Task config ID: A unique id

    • 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'.

    • Class: Set schedulable_class to be org.openmrs.scheduler.tasks.AutoRetireUsersTask

    • Start Time: Set the desired start time.

    • Start Time Pattern: Determines the pattern of 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.

    • Started: Set to true to start the task.

    • Other properties: You can set other properties as desired

  2. Save the configuration:

    1. Save the task configuration.

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

  • No labels