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
This commit is contained in:
2026-01-27 14:15:06 -05:00
parent 71584c1b55
commit 481adaa71e
15 changed files with 197 additions and 138 deletions
+46
View File
@@ -0,0 +1,46 @@
meta {
name: Update Email
type: http
seq: 2
}
put {
url: {{base_url}}/api/auth/email
body: json
auth: inherit
}
body {
{
"email": "newemail@example.com"
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Update Email
Updates the authenticated user's email address.
**Method:** PUT
**Endpoint:** /api/auth/email
**Authentication:** Required
**Request Body:**
- `email` (string, required): New email address (must be valid email format)
**Response:**
- `message` (string): Success message
**Status Codes:**
- 200: Success
- 400: Invalid email format
- 401: Unauthorized
- 409: Email already taken
}