Admin User Department Assignment - hmislk/hmis GitHub Wiki

Assigning Users to Departments

Overview

A user's primary department is set when their account is created. However, users who work across multiple departments — such as a cashier who covers two counters, or a doctor who consults in different wards — need to be explicitly assigned to each department they are allowed to log in from. This page explains how to add and remove department assignments for a user.

When to Use

  • A staff member is rotated to a new department and needs access there
  • A user needs to work across multiple departments simultaneously
  • A user has moved departments and the old assignment must be removed

Navigating to Department Assignment

  1. Click AdministrationManage Users
  2. Click the user row to select them
  3. Click Manage User Departments in the right action panel
  4. The Departments User Can Log screen opens

Required privilege: AdminManagingUsers

Adding a Department

  1. In the User field, the selected user is pre-populated. You can search for a different user by typing in the autocomplete box.
  2. Select the Institution from the dropdown (or leave blank to see all departments)
  3. Select the Site from the dropdown (optional — narrows the department list)
  4. Select the Department from the filtered dropdown
  5. Click Add
  6. The department appears in the assignment table below

Repeat steps 2–5 to add more departments.

Viewing Existing Assignments

The table below the form shows all departments currently assigned to the user:

Column Description
Institution The institution the department belongs to
Site The physical site of the department
Department The department name
Action Trash icon button to remove the assignment

Removing a Department Assignment

  1. Find the department in the assignment table
  2. Click the trash icon (red Remove button) in the Action column
  3. The assignment is removed immediately — no confirmation dialog appears

Warning: Removing a department assignment means the user can no longer log in from that department. If they try, the system will not give them access. Only remove assignments you are certain are no longer needed.

Important: Primary Department vs Additional Departments

  • The primary department is set on the user account itself (via Manage User). This is where the user works by default.
  • Additional departments added here allow the user to switch to those departments during login, without changing their primary department.
  • A user must have at least their primary department accessible. If their primary department is removed from this list and they have no other assignments, they may not be able to log in.

Technical Notes (Admin/Developer)

Each row in the department assignment table is a UserDepartment entity linking WebUser to Department. During login, the system checks for matching UserDepartment records to build the list of departments the user can select. The userDepartmentController.addDepartmentForUser() method creates the record; userDepartmentController.delete() removes it.

Related Features