wiki:UseCase18

Version 2 (modified by 236021, 4 days ago) ( diff )

--

UseCase18 - System Administrator Manages Users

Initiating Actor - System Administrator

Description

A system administrator creates new user accounts and manages existing ones. The admin can register patients, doctors, lab technicians, and other admins, and can view and filter all users in the system.

Scenario

  1. Admin navigates to the user management section and views all users in the system.
SELECT
  u.user_id,
  u.username,
  u.role,
  u.first_name,
  u.last_name,
  u.is_active
FROM users u
ORDER BY u.role, u.username;
  1. Admin filters users by role.
SELECT
  u.user_id,
  u.username,
  u.role,
  u.first_name,
  u.last_name,
  u.is_active
FROM users u
WHERE u.role = 'DOCTOR'
ORDER BY u.username;
  1. Admin enters the new doctor's professional details, and the system creates the doctor profile first.
INSERT INTO doctors (specialization_id, department_id, first_name, last_name, email_address, level_id)
VALUES (
  (SELECT specialization_id FROM doctor_specialization WHERE specialization_name = 'Cardiology'),
  (SELECT department_id FROM departments WHERE department_name = 'Cardiology'),
  'Nikola',
  'Trajkov',
  'nikola.trajkov@cardio.com',
  (SELECT level_id FROM doctor_level WHERE level = 'RESIDENT')
)
RETURNING doctor_id;
  1. Admin enters the new login credentials, and the system creates the user account linked to that doctor profile.
INSERT INTO users (username, password, role, first_name, last_name, is_active, doctor_id)
VALUES (
  'nikola.trajkov',
  'password123',
  'DOCTOR',
  'Nikola',
  'Trajkov',
  TRUE,
  (SELECT MAX(doctor_id) FROM doctors)
)
RETURNING user_id;
  1. System displays the updated user list confirming the new account.
SELECT
  u.user_id,
  u.username,
  u.role,
  u.first_name,
  u.last_name,
  u.is_active
FROM users u
ORDER BY u.role, u.username;
Note: See TracWiki for help on using the wiki.