Expand description
Administrative API Endpoints
Handles user management, system configuration, and admin operations.
§Security Model
Every handler in this module must independently verify the caller holds the
admin role via [verify_admin_role]. There is no middleware-level admin
guard on these routes — authorization is enforced per-handler so that
non-admin error paths can still return proper 401/403 responses.
When adding new admin endpoints, always call verify_admin_role(&auth_token)?
immediately after token validation.
Structs§
- Activate
User Request - PUT /admin/users/{user_id}/activate Activate/deactivate user (admin only)
- Admin
Config Update - Request body for
PUT /admin/config— all fields optional. - Admin
Config View - Response body for
GET /admin/config. - Audit
LogEntry - GET /admin/audit-logs Get audit logs (admin only)
- Audit
LogQuery - Audit
LogResponse - Audit
LogStats - Summary statistics returned by
GET /admin/audit-logs/stats. - Create
User Request - Create user request
- System
Stats - System stats response
- Update
User Roles Request - Update user roles request
- User
List Item - User list item
- User
List Query - User list query parameters
- User
List Response - User list response
Functions§
- activate_
user - create_
user - POST /admin/users Create new user (admin only)
- delete_
user - DELETE /admin/users/{user_id} Delete user (admin only)
- get_
audit_ log_ stats - GET /admin/audit-logs/stats
- get_
audit_ logs - get_
config - GET /admin/config
- get_
system_ stats - GET /admin/stats Get system statistics (admin only)
- list_
users - GET /admin/users List all users (admin only)
- update_
config - PUT /admin/config
- update_
user_ roles - PUT /admin/users/{user_id}/roles Update user roles (admin only)