Admin tool of the week: this post is part of a weekly series featuring small, open-source maintenance tools from the HISP Centre for DHIS2 system administrators. Read about the series.
The problem
Many DHIS2 instances collect user accounts that nobody uses any more. Staff move on, projects end, training accounts are created and forgotten. These accounts are a security risk: they still have access to data, they often have old or shared passwords, and nobody notices if someone else starts using one. Some of them have far more access than they should, such as old administrator accounts.
Old accounts also make the system harder to manage. They fill up user lists, user groups and sharing dialogs, and they make it hard to tell who actually uses the system.
DHIS2 can disable inactive users automatically with a scheduled job, but the job is easy to miss, and it disables everyone over the limit at once, without a chance to review who they are first.
What the tool does
User Disabler Tool lists the users who have not logged in to DHIS2 for a period that you choose, and disables them one by one or in bulk:
- Filter by months or years inactive, or since a date, and optionally by user role or user group. You can include users who have never logged in.
- Review the list: sort and search it, and click Info to see a user’s roles, groups and organisation units before you decide.
- Disable users one at a time, or select several and use Bulk disable. A summary shows how many users were disabled and lists any that DHIS2 refused, with the reason.
- Schedule it. The tool shows whether DHIS2’s own job for disabling inactive users exists, lets you create it, and lets you switch it on or off. When email is configured, the job warns users a number of days before it disables them.

Try it on the demo instance
You can try the tool without installing anything: open implement.im.dhis2.org/tools/apps/tool-user-disabler and log in as tools / District1#. The demo is a copy of the Sierra Leone database, with last-login dates spread over the past two years. The demo account is not a superuser, so DHIS2 refuses to disable users with more access than it has. The summary shows that too.
Use with care
- A disabled user cannot log in until someone enables the account again. The tool does not enable users; use the Users app for that.
- Check before you disable in bulk. Some accounts are still needed even though they rarely log in, such as accounts used by integrations or scripts. Filter by role or group, or look at Info, to find them.
- If you create the scheduled job, it disables users automatically every time it runs. Make sure users have an email address registered and that email is configured in the instance if you want them to get the reminder.
- DHIS2 only lets you disable users you are allowed to manage. Users with authorities you don’t have, and superusers if you are not one, are refused.
- As always, try the tool on a copy of your database before using in production.
Get it
- Supported DHIS2 versions: 2.41 and later (tested on 2.41, 2.42 and 2.43)
- Download: the latest
.zipfrom the releases page on GitHub, then install it in the App Management app (Upload app) - Documentation and source: github.com/dhis2-utils/tool-user-disabler (see the user guide)
- Authorities: View user to list users; Add/Update Public for users (or Add/Update User Within Managed Group) to disable them; Scheduling Administration to create the scheduled job
- Already using a version from before 1.0.0? The current version is installed as a separate app. Uninstall the old one after installing it, and add the new app to the user roles that had the old one.
Questions, bugs or ideas? Reply below.
Click here to receive notifications for #admin-tool-weekly topics: 
