[PR #1682] [MERGED] admin: More granular HTTP return codes for user-related endpoints #2993

Closed
opened 2026-03-03 09:09:16 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/1682
Author: @dongcarl
Created: 5/9/2021
Status: Merged
Merged: 5/12/2021
Merged by: @dani-garcia

Base: mainHead: 2021-05-admin-granular-http-codes


📝 Commits (4)

  • 5f458b2 admin: Return newly-created user in invite_user
  • cccd826 admin: Add /users/ route
  • 68e5d95 admin: Specifically return 404 for user not found
  • e60bdc7 admin: Make invite_user error codes more specific

📊 Changes

2 files changed (+41 additions, -18 deletions)

View changed files

📝 src/api/admin.rs (+39 -16)
📝 src/error.rs (+2 -2)

📄 Description

Based on: #1663

 admin: Specifically return 404 for user not found

- Modify err_code to accept an expr for err_code
- Add get_user_or_404, properly returning 404 instead of a generic 400
  for cases where user is not found
- Use get_user_or_404 where appropriate.
admin: Make invite_user error codes more specific

- Return 409 Conflict for when a user with that email already exists
- Return 500 InternalServerError for everything else

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/1682 **Author:** [@dongcarl](https://github.com/dongcarl) **Created:** 5/9/2021 **Status:** ✅ Merged **Merged:** 5/12/2021 **Merged by:** [@dani-garcia](https://github.com/dani-garcia) **Base:** `main` ← **Head:** `2021-05-admin-granular-http-codes` --- ### 📝 Commits (4) - [`5f458b2`](https://github.com/dani-garcia/vaultwarden/commit/5f458b288a7a7892f075087348ebcd3dab9a771b) admin: Return newly-created user in invite_user - [`cccd826`](https://github.com/dani-garcia/vaultwarden/commit/cccd8262fa78dabc8e1949c4dcb490b99fb0cd84) admin: Add /users/<uuid> route - [`68e5d95`](https://github.com/dani-garcia/vaultwarden/commit/68e5d95d251ded79a019f681a2a6c1665aef751b) admin: Specifically return 404 for user not found - [`e60bdc7`](https://github.com/dani-garcia/vaultwarden/commit/e60bdc7efe247e6b93c7c99b1a44e7147cddbf31) admin: Make invite_user error codes more specific ### 📊 Changes **2 files changed** (+41 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/api/admin.rs` (+39 -16) 📝 `src/error.rs` (+2 -2) </details> ### 📄 Description Based on: #1663 ``` admin: Specifically return 404 for user not found - Modify err_code to accept an expr for err_code - Add get_user_or_404, properly returning 404 instead of a generic 400 for cases where user is not found - Use get_user_or_404 where appropriate. ``` ``` admin: Make invite_user error codes more specific - Return 409 Conflict for when a user with that email already exists - Return 500 InternalServerError for everything else ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 09:09:16 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#2993
No description provided.