User Management Overview
The admin user management page is accessible via GET/admin/users (AdminController.java:17), which displays the user management interface.
View All Users
Access comprehensive lists of all registered users with their details and status.
Monitor Access Logs
Track user login activity, including timestamps, IP addresses, and success status.
Manage User Roles
Assign and modify user roles to control platform permissions.
User Status Control
Activate or deactivate user accounts as needed.
User Entity Structure
TheAppUser entity (AppUser.java:22) contains comprehensive user information:
| Field | Type | Validation | Description |
|---|---|---|---|
id | Long | Auto-generated | Unique user identifier |
firstName | String | Required, 2-100 chars | User’s first name |
lastName | String | Required, max 150 chars | User’s last name |
dni | String | Pattern: 8 digits + letter | Spanish ID number |
username | String | Required, valid email, unique | User’s email address |
phone | String | Pattern: 9-15 digits | Contact phone number |
active | Boolean | Required, default: true | Account status |
registeredAt | LocalDateTime | Auto-set | Registration timestamp |
lastLoginAt | LocalDateTime | Auto-updated | Last login timestamp |
role | UserRole | Required | User’s assigned role |
Key User Methods
User Roles
TheUserRole entity (UserRole.java:20) defines the available user roles in the system.
Available Role Types
TheRoleName enum (UserRole.java:22) defines four role types:
Role Entity Fields
| Field | Type | Description |
|---|---|---|
id | Long | Unique role identifier |
name | RoleName | Role type enum value |
description | String | Role description (max 100 chars) |
active | Boolean | Whether role is active |
Role Helper Methods
Access Logging
TheAccessLog entity (AccessLog.java:18) tracks all user login attempts for security monitoring.
AccessLog Structure
| Field | Type | Description |
|---|---|---|
id | Long | Unique log identifier |
accessedAt | LocalDateTime | When the access attempt occurred |
sourceIp | String | IP address of the request (max 45 chars) |
success | boolean | Whether login was successful |
user | AppUser | Reference to the user account |
Automatic Timestamp Creation
The access timestamp is automatically set when a log entry is created:Database Indexing
Access logs are indexed for efficient querying:User Oversight Features
View User Details
View User Details
Access comprehensive user information including:
- Full name and contact details
- Registration date and last login
- Assigned role and permissions
- Active/inactive status
- Professional profile (if applicable)
Monitor Login Activity
Monitor Login Activity
Track user access patterns through AccessLog entries:
- Login timestamps
- Source IP addresses
- Success/failure status
- Historical login patterns
Manage User Status
Manage User Status
Control user account status:
- Activate or deactivate accounts
- Prevent access without deleting accounts
- Preserve user data for historical records
Role Assignment
Role Assignment
Assign appropriate roles to users:
- ADMIN: Full platform management
- PROFESSIONAL: Service provider capabilities
- USER: Standard client access
- MODERATOR: Limited administrative access
Security Considerations
The
password field in AppUser is excluded from toString and equals operations (AppUser.java:51-53) to prevent accidental password exposure in logs.Best Practices
Regular Access Review
Periodically review access logs to identify suspicious login patterns or unauthorized access attempts.
Role Management
Assign the minimum necessary role to each user. Only grant ADMIN or MODERATOR roles to trusted personnel.
Account Deactivation
When users no longer need access, deactivate their accounts rather than deleting them to maintain audit trails.
Related Resources
- Category Management - Managing service categories
- Admin Dashboard - Overview of admin statistics
