mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-08-01 16:49:09 +00:00
Simplify group membership check
Co-authored-by: Stefan Melmuk <509385+stefan0xC@users.noreply.github.com>
This commit is contained in:
parent
7bc45a04f7
commit
7c938668af
1 changed files with 6 additions and 4 deletions
|
@ -362,10 +362,12 @@ async fn get_org_collections_details(org_id: &str, headers: ManagerHeadersLoose,
|
|||
})
|
||||
.collect();
|
||||
|
||||
// if current user is in any collection-assigned group
|
||||
// or in a group having access to all collections
|
||||
// or itself has access to all collections
|
||||
assigned = assigned || has_collection_access_via_group.contains(&user_org.uuid);
|
||||
// if the current user is not assigned and groups are enabled,
|
||||
// check if they have access to the given collection via a group
|
||||
if !assigned && CONFIG.org_groups_enabled()
|
||||
{
|
||||
assigned = GroupUser::get_group_members_for_collection(&col.uuid, &mut conn).await.contains(&user_org.uuid);
|
||||
}
|
||||
|
||||
let mut json_object = col.to_json();
|
||||
json_object["Assigned"] = json!(assigned);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue