Files
bookhoard/bruno/user/admin/List Users.bru
T
john-okeefe 481adaa71e feat: Implement role-based registration restrictions and reorganize Bruno collection
- Add role-based restrictions to POST /api/auth/register endpoint
- Only admins can create admin accounts if any admin already exists
- First user automatically gets admin role regardless of request
- Regular users can only create user accounts, not admin accounts
- Unauthenticated users can only create first admin, not subsequent admins
- Reorganize Bruno collection into logical subfolders (auth/, admin/, profile/)
- Update documentation to reflect new registration restrictions and security rules

BREAKING CHANGES:
- /api/auth/register now enforces role-based creation restrictions
- Bruno collection reorganized with subfolder structure
2026-01-27 14:15:06 -05:00

94 lines
2.3 KiB
Plaintext

meta {
name: List Users
type: http
seq: 5
}
get {
url: {{base_url}}/api/auth/users
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## List Users
Retrieves a list of all users with complete user information.
**Method:** GET
**Endpoint:** /api/auth/users
**Authentication:** Required (Admin only)
**Response:** Array of user objects with complete information:
- `id` (string): User ID (UUID)
- `email` (string): Email address
- `username` (string): Username
- `first_name` (string): First name (empty if not set)
- `last_name` (string): Last name (empty if not set)
- `role` (string): User role ("user" or "admin")
- `theme` (string): Theme preference (empty if default)
- `created_at` (string): Creation timestamp (ISO 8601)
- `updated_at` (string): Last update timestamp (ISO 8601)
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 403: Forbidden (admin access required)
**Features:**
- Admin-only endpoint with complete user information
- Returns first_name, last_name, role, theme fields
- Useful for user management interfaces
}
get {
url: {{base_url}}/api/auth/users
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## List Users (Admin)
Retrieves a list of all users with complete user information.
**Method:** GET
**Endpoint:** /api/auth/users
**Authentication:** Required (Admin only)
**Response:** Array of user objects with complete information:
- `id` (string): User ID (UUID)
- `email` (string): Email address
- `username` (string): Username
- `first_name` (string): First name (empty if not set)
- `last_name` (string): Last name (empty if not set)
- `role` (string): User role ("user" or "admin")
- `theme` (string): Theme preference (empty if default)
- `created_at` (string): Creation timestamp (ISO 8601)
- `updated_at` (string): Last update timestamp (ISO 8601)
**Status Codes:**
- 200: Success
- 401: Unauthorized
- 403: Forbidden (admin access required)
**Enhanced Features:**
- Now admin-only endpoint (moved from public to protected admin group)
- Returns complete user profile information including names and role
- Useful for comprehensive admin user management
}