Skip to main content
All user management endpoints require authentication and are restricted to Administrador or Desarrollador roles.

List Users

GET /usuarios

Retrieve all users in the system. Authentication Required: Administrador or Desarrollador role Response: Renders users view with all user records Example Request
curl http://localhost/usuarios \
  --cookie "connect.sid=SESSION_ID"

Get Add User Form

GET /usuarios/add

Get the form to add a new user. Authentication Required: Administrador or Desarrollador role Response: Renders add user form view

Create User

POST /usuarios/add

Create a new user account. Authentication Required: Administrador or Desarrollador role Request Body
nombre
string
required
First name (2-50 characters, letters and hyphens only)
apellido
string
required
Last name (2-50 characters, letters and hyphens only)
cedula
string
required
ID document number (7-9 digits)
cargo
string
required
Position/role (4-50 characters, no numbers)
typeUser
string
required
User type: “Administrador”, “Analista”, or “Desarrollador”
Validation Rules nombre / apellido:
  • Must be 2-50 characters
  • Only letters and hyphens allowed
  • No numbers or special characters (except hyphen)
cedula:
  • Must be numeric
  • 7-9 digits only
  • Must be unique (not already registered)
cargo:
  • Minimum 4 characters
  • Maximum 50 characters
  • No numeric characters
typeUser:
  • Must be exactly: “Administrador”, “Analista”, or “Desarrollador”
Username Generation The system automatically generates usernames using the format:
  • Base format: APELLIDO + first letter of NOMBRE (uppercase)
  • If username exists, adds sequential number (e.g., PEREZJ, PEREZJ1, PEREZJ2)
  • Accents are removed (e.g., PÉREZ becomes PEREZ)
Password Initial password is set to the user’s cedula (ID document number), hashed with bcrypt. Response
redirect
string
On success, redirects to /usuarios
errors.nombre
string
Name validation error
errors.apellido
string
Last name validation error
errors.cedula
string
ID document validation error
errors.cargo
string
Position validation error
errors.typeUser
string
User type validation error
Example Request
curl -X POST http://localhost/usuarios/add \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --cookie "connect.sid=SESSION_ID" \
  -d "nombre=Juan" \
  -d "apellido=Pérez" \
  -d "cedula=12345678" \
  -d "cargo=Analista de Sistemas" \
  -d "typeUser=Analista"
Example Response
Redirects to /usuarios with new user created.Generated username: PEREZJInitial password: 12345678 (same as cedula)

Get Edit User Form

GET /usuarios/edit/:username

Get the form to edit an existing user. Authentication Required: Administrador or Desarrollador role URL Parameters
username
string
required
Username of user to edit
Restrictions:
  • Cannot edit your own account
  • Cannot edit Desarrollador accounts
Response: Renders edit user form with current user data

Update User

POST /usuarios/edit/:username

Update an existing user’s information. Authentication Required: Administrador or Desarrollador role URL Parameters
username
string
required
Username of user to edit
Request Body Same fields as POST /usuarios/add, plus:
username
string
required
Current username (for verification)
Validation: Same rules as create user Note: If cedula is changed, it must not belong to another user Response
redirect
string
On success, redirects to /usuarios
Example Request
curl -X POST http://localhost/usuarios/edit/PEREZJ \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --cookie "connect.sid=SESSION_ID" \
  -d "nombre=Juan Carlos" \
  -d "apellido=Pérez" \
  -d "cedula=12345678" \
  -d "cargo=Analista Senior" \
  -d "typeUser=Analista" \
  -d "username=PEREZJ"

Delete User

POST /usuarios/delete

Delete a user from the system. Authentication Required: Administrador or Desarrollador role Request Body
username
string
required
Username of user to delete
Response
success
string
“¡El usuario ha sido eliminado correctamente!”
Example Request
curl -X POST http://localhost/usuarios/delete \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --cookie "connect.sid=SESSION_ID" \
  -d "username=PEREZJ"
Example Response
{
  "success": "¡El usuario ha sido eliminado correctamente!"
}

User Type Roles

Desarrollador

Full system access, highest privilege level

Administrador

Can manage users and approve permits

Analista

Can create and edit permits, limited administrative access

Username Generation Examples

NameLast NameBase UsernameIf ExistsFinal Username
JuanPérezPEREZJNoPEREZJ
JoséPérezPEREZJYes (1 exists)PEREZJ1
MaríaGonzálezGONZALEZMNoGONZALEZM
AndréMüllerMULLERANoMULLERA
Accents and special characters are automatically removed from usernames.

Build docs developers (and LLMs) love