mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-07 03:29:10 +00:00
Query returns UUID only
This commit is contained in:
parent
bb100df31a
commit
f4e9857dfd
1 changed files with 5 additions and 13 deletions
|
@ -488,27 +488,19 @@ impl GroupUser {
|
|||
}}
|
||||
}
|
||||
|
||||
pub async fn find_by_collection(collection_uuid: &str, conn: &mut DbConn) -> Vec<Self> {
|
||||
pub async fn get_collection_group_users_uuid(collection_uuid: &str, conn: &mut DbConn) -> HashSet<String> {
|
||||
db_run! { conn: {
|
||||
groups_users::table
|
||||
.inner_join(collections_groups::table.on(
|
||||
collections_groups::groups_uuid.eq(groups_users::groups_uuid)
|
||||
))
|
||||
.filter(collections_groups::collections_uuid.eq(collection_uuid))
|
||||
.select(groups_users::all_columns)
|
||||
.load::<GroupUserDb>(conn)
|
||||
.select(groups_users::users_organizations_uuid)
|
||||
.load::<String>(conn)
|
||||
.expect("Error loading group users for collection")
|
||||
.from_db()
|
||||
}}
|
||||
}
|
||||
|
||||
/// returns uuid of members of collection groups
|
||||
pub async fn get_collection_group_users_uuid(collection_uuid: &str, conn: &mut DbConn) -> HashSet<String> {
|
||||
GroupUser::find_by_collection(collection_uuid, conn)
|
||||
.await
|
||||
.iter()
|
||||
.map(|u| u.users_organizations_uuid.clone())
|
||||
.collect()
|
||||
.into_iter()
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub async fn update_user_revision(&self, conn: &mut DbConn) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue