mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-09 20:49:07 +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: {
|
db_run! { conn: {
|
||||||
groups_users::table
|
groups_users::table
|
||||||
.inner_join(collections_groups::table.on(
|
.inner_join(collections_groups::table.on(
|
||||||
collections_groups::groups_uuid.eq(groups_users::groups_uuid)
|
collections_groups::groups_uuid.eq(groups_users::groups_uuid)
|
||||||
))
|
))
|
||||||
.filter(collections_groups::collections_uuid.eq(collection_uuid))
|
.filter(collections_groups::collections_uuid.eq(collection_uuid))
|
||||||
.select(groups_users::all_columns)
|
.select(groups_users::users_organizations_uuid)
|
||||||
.load::<GroupUserDb>(conn)
|
.load::<String>(conn)
|
||||||
.expect("Error loading group users for collection")
|
.expect("Error loading group users for collection")
|
||||||
.from_db()
|
|
||||||
}}
|
}}
|
||||||
}
|
.into_iter()
|
||||||
|
.collect()
|
||||||
/// 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()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn update_user_revision(&self, conn: &mut DbConn) {
|
pub async fn update_user_revision(&self, conn: &mut DbConn) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue