Changes between Initial Version and Version 1 of UseCase0009


Ignore:
Timestamp:
03/16/26 21:06:51 (5 days ago)
Author:
221511
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0009

    v1 v1  
     1= UC0009: Register a New User =
     2
     3'''Initiating actor:''' Faculty Administrator
     4
     5'''Other actors:''' None
     6
     7A 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.
     8
     9== Scenario ==
     10
     11 1. The administrator selects the option to register a new user. The system retrieves and displays the available roles.
     12{{{
     13SELECT type_id, type_name, description
     14FROM project.user_types
     15ORDER BY type_id;
     16}}}
     17
     18 2. The administrator enters the new user's first name, last name, and institutional email address.
     19
     20 3. The system checks that the email address is not already registered.
     21{{{
     22SELECT COUNT(*) AS email_exists
     23FROM project.users
     24WHERE email = 'new.user@finki.ukim.mk';
     25}}}
     26
     27 4. 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.
     28
     29 5. The system hashes the password using bcrypt and creates the new user account.
     30{{{
     31INSERT INTO project.users (first_name, last_name, email, password, type_id)
     32VALUES ('Petar', 'Jovanov', 'petar.jovanov@finki.ukim.mk', '$2b$12$...hashed...', 2)
     33RETURNING user_id, first_name, last_name, email;
     34}}}
     35
     36 6. The system displays a confirmation with the newly created user's details and assigned role.
     37
     38== Alternative Scenario: Email Already Exists ==
     39
     40 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.