wiki:UseCase0009

Version 1 (modified by 221511, 5 days ago) ( diff )

--

UC0009: Register a New User

Initiating actor: Faculty Administrator

Other actors: None

A faculty administrator creates a new user account in the system. The administrator enters the new user's personal details, selects their role from the available user types, and sets an initial password. The system validates that the email is not already in use, hashes the password, and inserts the new user record into the database.

Scenario

  1. The administrator selects the option to register a new user. The system retrieves and displays the available roles.
    SELECT type_id, type_name, description
    FROM project.user_types
    ORDER BY type_id;
    
  1. The administrator enters the new user's first name, last name, and institutional email address.
  1. The system checks that the email address is not already registered.
    SELECT COUNT(*) AS email_exists
    FROM project.users
    WHERE email = 'new.user@finki.ukim.mk';
    
  1. The email is not in use (email_exists = 0). The administrator selects a role from the displayed list (e.g., Teaching Staff) and enters an initial password for the new user.
  1. The system hashes the password using bcrypt and creates the new user account.
    INSERT INTO project.users (first_name, last_name, email, password, type_id)
    VALUES ('Petar', 'Jovanov', 'petar.jovanov@finki.ukim.mk', '$2b$12$...hashed...', 2)
    RETURNING user_id, first_name, last_name, email;
    
  1. The system displays a confirmation with the newly created user's details and assigned role.

Alternative Scenario: Email Already Exists

3a. The email is already registered (email_exists > 0). The system displays an error message A user with this email already exists and asks the administrator to enter a different email address.

Note: See TracWiki for help on using the wiki.