mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-04-26 09:46:00 +03:00
[PR #5320] [MERGED] rename membership and adopt newtype pattern #3599
Labels
No labels
SSO
Third party
better for forum
bug
bug
documentation
duplicate
enhancement
future Vault
future Vault
future Vault
good first issue
help wanted
low priority
notes
pull-request
question
troubleshooting
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vaultwarden#3599
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/5320
Author: @stefan0xC
Created: 12/22/2024
Status: ✅ Merged
Merged: 1/9/2025
Merged by: @dani-garcia
Base:
main← Head:rename-membership📝 Commits (5)
c1af0cbrename membership655ac03use newtype patternd0fb15eimplement custom derive macro IdFromParam0fcb4d5add UuidFromParam macro for UUIDsc44dfa3add macros to Docker build📊 Changes
51 files changed (+2733 additions, -2047 deletions)
View changed files
📝
.dockerignore(+1 -0)📝
Cargo.lock(+43 -0)📝
Cargo.toml(+7 -0)📝
docker/Dockerfile.alpine(+1 -0)📝
docker/Dockerfile.debian(+1 -0)📝
docker/Dockerfile.j2(+1 -0)➕
macros/Cargo.toml(+13 -0)➕
macros/src/lib.rs(+58 -0)📝
src/api/admin.rs(+52 -53)📝
src/api/core/accounts.rs(+83 -74)📝
src/api/core/ciphers.rs(+262 -229)📝
src/api/core/emergency_access.rs(+43 -38)📝
src/api/core/events.rs(+45 -40)📝
src/api/core/folders.rs(+22 -16)📝
src/api/core/organizations.rs(+698 -646)📝
src/api/core/public.rs(+29 -35)📝
src/api/core/sends.rs(+44 -38)📝
src/api/core/two_factor/authenticator.rs(+9 -9)📝
src/api/core/two_factor/duo.rs(+3 -3)📝
src/api/core/two_factor/duo_oidc.rs(+3 -3)...and 31 more files
📄 Description
I've been working on improving Vaultwarden's legibility by renaming the
UsersOrganizationsto simplyMembershipand making it clearer when something is referring to theUserand when to aMembershiprelation.After doing that I was motivated to try my hands on using the newtype pattern so that the Rust type system can be used to check on compile time if we always call the right
uuidbecause there are a lot of Strings that can be used interchangeably otherwise.For example I noticed that we are passing the wrong id here:
github.com/dani-garcia/vaultwarden@ed4ad67e73/src/api/core/organizations.rs (L910)Because in contrast to
CollectionUsertheGroupUser::newactually expects a different id:github.com/dani-garcia/vaultwarden@ed4ad67e73/src/db/models/group.rs (L122)This was probably overlooked because it's not a major issue when a user is not correctly invited to a group and it only shows up as a small warning in the logs:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.