đ§ UserController Documentation
QUICK DOCUMENTATIONâ
- File Path: /API/Controllers/UserController.cs
- Primary Purpose: Manages users within the system, including user information, permissions, and client associations.
- Key Endpoints:
- đ GET /List - Retrieves list of users
- đ GET /Get - Gets a specific user by ID
- đ POST /Update - Updates user details
- âī¸ POST /Invite - Invites a new user to the system
- đī¸ POST /Delete - Deletes a user from the system
- đ POST /ChangeClient - Changes a user's active client
- đ POST /ToggleValuerMode - Toggles valuer mode for a user
- Related Models: ApplicationUserDto
- Used By:
- User administration screens
- Client user management
- Account management
- Access control functionality
DETAILED DOCUMENTATIONâ
đ Overviewâ
The UserController manages user accounts within Asset Valuer Pro. Users represent individuals who have access to the system, each with specific permissions, roles, and client associations. This controller handles all aspects of user management, including listing, retrieval, updating, invitation, deletion, and client association. Access to this controller is restricted to users with the Administrator role.
đī¸ Controller Dependenciesâ
- Namespace: AVP.API.Controllers
- Services Used:
- Mediator (CQRS pattern implementation)
- Other Dependencies:
- đ Authorization attribute requiring the Administrator role
đ Endpointsâ
đ List Usersâ
- HTTP Method: GET
- URL Pattern: /List
- Authentication: đ Required (Administrator role only)
- Description: Retrieves a list of users, optionally filtered by criteria
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetUserListQuery | Yes | Query parameters for filtering users |
Response Formatâ
[
{
"id": "user123",
"email": "john.smith@example.com",
"firstName": "John",
"lastName": "Smith",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "User",
"isActive": true,
"lastLogin": "2025-04-10T14:30:00Z",
"isValuerMode": false
},
{
"id": "user456",
"email": "jane.doe@example.com",
"firstName": "Jane",
"lastName": "Doe",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "Administrator",
"isActive": true,
"lastLogin": "2025-04-15T09:45:00Z",
"isValuerMode": true
}
]
đ Get Userâ
- HTTP Method: GET
- URL Pattern: /Get
- Authentication: đ Required (Administrator role only)
- Description: Retrieves detailed information about a specific user
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetUserQuery | Yes | Contains UserId to retrieve |
Response Formatâ
{
"id": "user123",
"email": "john.smith@example.com",
"firstName": "John",
"lastName": "Smith",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "User",
"isActive": true,
"createdDate": "2024-05-10T00:00:00Z",
"lastLogin": "2025-04-10T14:30:00Z",
"isValuerMode": false,
"permissions": [
"ViewAssets",
"EditAssets",
"ViewReports",
"RunValuations"
],
"clients": [
{
"id": 456,
"name": "City Council XYZ",
"role": "User"
},
{
"id": 457,
"name": "State Department ABC",
"role": "ReadOnly"
}
]
}
đ Update Userâ
- HTTP Method: POST
- URL Pattern: /Update
- Authentication: đ Required (Administrator role only)
- Description: Updates user information
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | UpdateUserCommand | Yes | Contains user data to update |
Response Formatâ
{
"id": "user123",
"email": "john.smith@example.com",
"firstName": "John",
"lastName": "Smith-Johnson",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "Administrator",
"isActive": true,
"createdDate": "2024-05-10T00:00:00Z",
"lastLogin": "2025-04-10T14:30:00Z",
"isValuerMode": false,
"permissions": [
"ViewAssets",
"EditAssets",
"ViewReports",
"RunValuations",
"ManageUsers"
],
"clients": [
{
"id": 456,
"name": "City Council XYZ",
"role": "Administrator"
},
{
"id": 457,
"name": "State Department ABC",
"role": "ReadOnly"
}
]
}
đ Change Clientâ
- HTTP Method: POST
- URL Pattern: /ChangeClient
- Authentication: đ Required (Administrator role only)
- Description: Changes a user's active client
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ChangeClientCommand | Yes | Contains UserId and ClientId to set as active |
Response Formatâ
"Successfully changed client for user"
âī¸ Invite Userâ
- HTTP Method: POST
- URL Pattern: /Invite
- Authentication: đ Required (Administrator role only)
- Description: Invites a new user to the system
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | InviteUserCommand | Yes | Contains user information for invitation |
Response Formatâ
{
"success": true,
"message": "Invitation sent successfully",
"invitationId": "inv123"
}
âī¸ Reinvite Userâ
- HTTP Method: POST
- URL Pattern: /Reinvite
- Authentication: đ Required (Administrator role only)
- Description: Resends an invitation to a user who has not yet accepted
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ReinviteUserCommand | Yes | Contains UserId to reinvite |
Response Formatâ
{
"success": true,
"message": "Invitation resent successfully",
"invitationId": "inv456"
}
đī¸ Delete Userâ
- HTTP Method: POST
- URL Pattern: /Delete
- Authentication: đ Required (Administrator role only)
- Description: Deletes a user from the system
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | DeleteUserCommand | Yes | Contains UserId to delete |
Response Formatâ
[
{
"id": "user456",
"email": "jane.doe@example.com",
"firstName": "Jane",
"lastName": "Doe",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "Administrator",
"isActive": true,
"lastLogin": "2025-04-15T09:45:00Z",
"isValuerMode": true
},
{
"id": "user789",
"email": "robert.brown@example.com",
"firstName": "Robert",
"lastName": "Brown",
"clientId": 456,
"clientName": "City Council XYZ",
"role": "User",
"isActive": true,
"lastLogin": "2025-04-12T11:15:00Z",
"isValuerMode": false
}
]
(Returns the remaining users after deletion)
đ Toggle Valuer Modeâ
- HTTP Method: POST
- URL Pattern: /ToggleValuerMode
- Authentication: đ Required (Administrator role only)
- Description: Toggles valuer mode for a user, which changes the user interface and available features
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ToggleValuerMode | Yes | Contains UserId to toggle valuer mode |
Response Formatâ
1
(Returns success flag)
đĄ Tips for User Managementâ
- â ī¸ Deleting a user cannot be undone - consider deactivating users instead of deleting them
- âšī¸ Valuer mode provides specialized interfaces for field valuers with simplified workflows
- đ User permissions are determined by their role and client association
- â New users must accept their invitation before they can access the system