[PR #2667] [CLOSED] Group support #3127

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

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/2667
Author: @MFijak
Created: 8/2/2022
Status: Closed

Base: mainHead: group_support


📝 Commits (10+)

  • ab6f3c7 migration scripts added
  • 891f4c8 enable UI group support
  • 68cfd90 schema added
  • 5a53041 Db CRUD operations and API endpoints implemented
  • ad7e6bf load assigned group collections for user
  • 073daeb revision update implemented
  • 82091bd fixes for mysql, sqlite
  • 064a1e3 cipher readonly, hide_passwords
  • 39d078a use cipher sync data if possible
  • 827bf4c fix for group collections

📊 Changes

17 files changed (+1188 additions, -19 deletions)

View changed files

migrations/mysql/2022-07-27-110000_add_group_support/down.sql (+3 -0)
migrations/mysql/2022-07-27-110000_add_group_support/up.sql (+23 -0)
migrations/postgresql/2022-07-27-110000_add_group_support/down.sql (+3 -0)
migrations/postgresql/2022-07-27-110000_add_group_support/up.sql (+23 -0)
migrations/sqlite/2022-07-27-110000_add_group_support/down.sql (+3 -0)
migrations/sqlite/2022-07-27-110000_add_group_support/up.sql (+23 -0)
📝 src/api/core/ciphers.rs (+14 -0)
📝 src/api/core/organizations.rs (+370 -3)
📝 src/api/mod.rs (+1 -0)
📝 src/db/models/cipher.rs (+88 -11)
📝 src/db/models/collection.rs (+22 -2)
src/db/models/group.rs (+501 -0)
📝 src/db/models/mod.rs (+2 -0)
📝 src/db/models/organization.rs (+4 -3)
📝 src/db/schemas/mysql/schema.rs (+36 -0)
📝 src/db/schemas/postgresql/schema.rs (+36 -0)
📝 src/db/schemas/sqlite/schema.rs (+36 -0)

📄 Description

Hello all,
This is my first ever pull request and I also never used Rust before. Please tell me if I did anything wrong.
I implemented the group support, which is related to issue #1623.

To test my changes following sites can be used:

  • Organizations->Manage->People
    • Groups can be assigned to people (hover over a member and click the gear symbol)
    • Delete a member
  • Organizations->Manage->Collections
    • Collections can be assigned to groups (click on a collection)
    • Delete a collection
    • Add a collection
  • Organizations->Manage->Groups
    • Create a group (top right “+ New Group”)
    • Modify a group (click on a group)
    • Delete a group (click on a group)
    • Users can be added to groups (hover over a group and click the gear symbol)
  • Vaults
    • Should list any collections which are visible by the user

There was one code segment I was not so sure about if my implementation is the correct approach:

pub async fn find_by_user_uuid(user_uuid: &str, conn: &DbConn)
Db/models/collection.rs

This function basically returns all collections which the user has access to. I squeezed my group implementation into the query builder. Maybe a better approach would be to fire two independent queries. Each for user collections and group collections. I think this would be the better approach, because you can much clearer see what the query does. But I would assume there comes a small performance penalty.


🔄 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/2667 **Author:** [@MFijak](https://github.com/MFijak) **Created:** 8/2/2022 **Status:** ❌ Closed **Base:** `main` ← **Head:** `group_support` --- ### 📝 Commits (10+) - [`ab6f3c7`](https://github.com/dani-garcia/vaultwarden/commit/ab6f3c7b64534865194aac4033cdf8ff72289c91) migration scripts added - [`891f4c8`](https://github.com/dani-garcia/vaultwarden/commit/891f4c829d7f27b60feb0856a20516d5411cd7f9) enable UI group support - [`68cfd90`](https://github.com/dani-garcia/vaultwarden/commit/68cfd90f71ef135386cf4d76a0e43e67211cf57f) schema added - [`5a53041`](https://github.com/dani-garcia/vaultwarden/commit/5a530414de548cd17872a8c6032287b23f4ed342) Db CRUD operations and API endpoints implemented - [`ad7e6bf`](https://github.com/dani-garcia/vaultwarden/commit/ad7e6bfacd658012240c5c2fc6ad6eaab531eb91) load assigned group collections for user - [`073daeb`](https://github.com/dani-garcia/vaultwarden/commit/073daeb18bf6a960910f2f48211fc2906cb215b6) revision update implemented - [`82091bd`](https://github.com/dani-garcia/vaultwarden/commit/82091bdb0a0dd595fc185071bc870b9069cf21fe) fixes for mysql, sqlite - [`064a1e3`](https://github.com/dani-garcia/vaultwarden/commit/064a1e368ef4ea9b608d138fb9a12a64555702fc) cipher readonly, hide_passwords - [`39d078a`](https://github.com/dani-garcia/vaultwarden/commit/39d078a9577ca9010d82aa76c9a08ab5a8d7df29) use cipher sync data if possible - [`827bf4c`](https://github.com/dani-garcia/vaultwarden/commit/827bf4c7f8b0f9eb6e69a558f6b908da053e8160) fix for group collections ### 📊 Changes **17 files changed** (+1188 additions, -19 deletions) <details> <summary>View changed files</summary> ➕ `migrations/mysql/2022-07-27-110000_add_group_support/down.sql` (+3 -0) ➕ `migrations/mysql/2022-07-27-110000_add_group_support/up.sql` (+23 -0) ➕ `migrations/postgresql/2022-07-27-110000_add_group_support/down.sql` (+3 -0) ➕ `migrations/postgresql/2022-07-27-110000_add_group_support/up.sql` (+23 -0) ➕ `migrations/sqlite/2022-07-27-110000_add_group_support/down.sql` (+3 -0) ➕ `migrations/sqlite/2022-07-27-110000_add_group_support/up.sql` (+23 -0) 📝 `src/api/core/ciphers.rs` (+14 -0) 📝 `src/api/core/organizations.rs` (+370 -3) 📝 `src/api/mod.rs` (+1 -0) 📝 `src/db/models/cipher.rs` (+88 -11) 📝 `src/db/models/collection.rs` (+22 -2) ➕ `src/db/models/group.rs` (+501 -0) 📝 `src/db/models/mod.rs` (+2 -0) 📝 `src/db/models/organization.rs` (+4 -3) 📝 `src/db/schemas/mysql/schema.rs` (+36 -0) 📝 `src/db/schemas/postgresql/schema.rs` (+36 -0) 📝 `src/db/schemas/sqlite/schema.rs` (+36 -0) </details> ### 📄 Description Hello all, This is my first ever pull request and I also never used Rust before. Please tell me if I did anything wrong. I implemented the group support, which is related to issue #1623. To test my changes following sites can be used: - Organizations->Manage->People - Groups can be assigned to people (hover over a member and click the gear symbol) - Delete a member - Organizations->Manage->Collections - Collections can be assigned to groups (click on a collection) - Delete a collection - Add a collection - Organizations->Manage->Groups - Create a group (top right “+ New Group”) - Modify a group (click on a group) - Delete a group (click on a group) - Users can be added to groups (hover over a group and click the gear symbol) - Vaults - Should list any collections which are visible by the user There was one code segment I was not so sure about if my implementation is the correct approach: `pub async fn find_by_user_uuid(user_uuid: &str, conn: &DbConn)` _Db/models/collection.rs_ This function basically returns all collections which the user has access to. I squeezed my group implementation into the query builder. Maybe a better approach would be to fire two independent queries. Each for user collections and group collections. I think this would be the better approach, because you can much clearer see what the query does. But I would assume there comes a small performance penalty. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 09:25:59 +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#3127
No description provided.