diff --git a/bruno/user/admin/Update User Max Devices - Invalid Too High.bru b/bruno/user/admin/Update User Max Devices - Invalid Too High.bru new file mode 100644 index 0000000..0fd9963 --- /dev/null +++ b/bruno/user/admin/Update User Max Devices - Invalid Too High.bru @@ -0,0 +1,32 @@ +meta { + name: Update User Max Devices - Exceeds Maximum + type: http + seq: 3 +} + +put { + url: {{base_url}}/api/auth/users/{{user_id}}/max-devices + body: { + max_devices: 101 + } + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} + +vars { + user_id: 123e4567-e89b-12d3-a456-426614174000 + max_devices: 101 +} + +docs { + ## Update User Max Devices - Invalid (Exceeds Maximum) + + Attempts to set max_devices to 101 (above maximum of 100). + + **Expected:** 400 Bad Request + **Response:** `{"error": "validation error"}` +} diff --git a/bruno/user/admin/Update User Max Devices - Invalid Zero.bru b/bruno/user/admin/Update User Max Devices - Invalid Zero.bru new file mode 100644 index 0000000..5b0f2e3 --- /dev/null +++ b/bruno/user/admin/Update User Max Devices - Invalid Zero.bru @@ -0,0 +1,32 @@ +meta { + name: Update User Max Devices - Invalid Max Devices + type: http + seq: 2 +} + +put { + url: {{base_url}}/api/auth/users/{{user_id}}/max-devices + body: { + max_devices: 0 + } + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} + +vars { + user_id: 123e4567-e89b-12d3-a456-426614174000 + max_devices: 0 +} + +docs { + ## Update User Max Devices - Invalid (Zero) + + Attempts to set max_devices to 0 (below minimum). + + **Expected:** 400 Bad Request + **Response:** `{"error": "validation error"}` +} diff --git a/bruno/user/admin/Update User Max Devices - Missing ID.bru b/bruno/user/admin/Update User Max Devices - Missing ID.bru new file mode 100644 index 0000000..9420c68 --- /dev/null +++ b/bruno/user/admin/Update User Max Devices - Missing ID.bru @@ -0,0 +1,27 @@ +meta { + name: Update User Max Devices - Missing ID + type: http + seq: 4 +} + +put { + url: {{base_url}}/api/auth/users//max-devices + body: { + max_devices: 10 + } + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} + +docs { + ## Update User Max Devices - Missing User ID + + Attempts to update max devices without providing user ID. + + **Expected:** 400 Bad Request + **Response:** `{"error": "user id required"}` +} diff --git a/bruno/user/admin/Update User Max Devices - Success.bru b/bruno/user/admin/Update User Max Devices - Success.bru new file mode 100644 index 0000000..32adf34 --- /dev/null +++ b/bruno/user/admin/Update User Max Devices - Success.bru @@ -0,0 +1,32 @@ +meta { + name: Update User Max Devices - Success + type: http + seq: 1 +} + +put { + url: {{base_url}}/api/auth/users/{{user_id}}/max-devices + body: { + max_devices: 5 + } + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} + +vars { + user_id: 123e4567-e89b-12d3-a456-426614174000 + max_devices: 5 +} + +docs { + ## Update User Max Devices - Success Case + + Successfully updates a user's max devices limit to 5. + + **Expected:** 200 OK + **Response:** `{"message": "max devices updated"}` +} diff --git a/bruno/user/admin/Update User Max Devices.bru b/bruno/user/admin/Update User Max Devices.bru new file mode 100644 index 0000000..5b7b0a7 --- /dev/null +++ b/bruno/user/admin/Update User Max Devices.bru @@ -0,0 +1,95 @@ +meta { + name: Update User Max Devices + type: http + seq: 6 +} + +put { + url: {{base_url}}/api/auth/users/{{user_id}}/max-devices + body: { + max_devices: {{max_devices}} + } + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} + +docs { + ## Update User Max Devices (Admin) + + Updates the maximum number of devices a user can register. + + **Method:** PUT + + **Endpoint:** /api/auth/users/:id/max-devices + + **Authentication:** Required (Admin only) + + **URL Parameters:** + - `id` (string): User ID (UUID) + + **Request Body:** + ```json + { + "max_devices": 10 + } + ``` + - `max_devices` (integer, required): Maximum devices (1-100) + + **Response:** + ```json + { + "message": "max devices updated" + } + ``` + + **Status Codes:** + - 200: Success + - 400: Invalid request (missing id, invalid max_devices, out of range) + - 401: Unauthorized + - 403: Forbidden (admin access required) + - 500: Internal server error + + **Validation:** + - `max_devices` must be between 1 and 100 + - User ID must be a valid UUID + - User must exist + + **Features:** + - Admin-only endpoint for managing user device quotas + - Allows per-user device limits (default: 10) + - Prevents excessive device registrations per user + - Useful for multi-tenant or managed deployments + + **Examples:** + + Set max devices to 5: + ```json + { + "max_devices": 5 + } + ``` + + Set max devices to 50 (premium user): + ```json + { + "max_devices": 50 + } + ``` + + Set max devices to 1 (restricted user): + ```json + { + "max_devices": 1 + } + ``` + + **Use Cases:** + - Restrict free-tier users to 5 devices + - Allow premium users up to 100 devices + - Reduce device cap for suspicious accounts + - Implement tiered device limits per user plan +}