mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-12-11 17:31:24 +01:00
Fix vault item display in org vault view
In the org vault view, the Bitwarden web vault currently tries to fetch the groups for an org regardless of whether it claims to have group support. If this errors out, no vault items are displayed.
This commit is contained in:
parent
024d12db08
commit
61183d001c
1 changed files with 7 additions and 5 deletions
|
@ -2056,11 +2056,13 @@ async fn _restore_organization_user(
|
||||||
|
|
||||||
#[get("/organizations/<org_id>/groups")]
|
#[get("/organizations/<org_id>/groups")]
|
||||||
async fn get_groups(org_id: String, _headers: ManagerHeadersLoose, mut conn: DbConn) -> JsonResult {
|
async fn get_groups(org_id: String, _headers: ManagerHeadersLoose, mut conn: DbConn) -> JsonResult {
|
||||||
if !CONFIG.org_groups_enabled() {
|
let groups = if CONFIG.org_groups_enabled() {
|
||||||
err!("Group support is disabled");
|
Group::find_by_organization(&org_id, &mut conn).await.iter().map(Group::to_json).collect::<Value>()
|
||||||
}
|
} else {
|
||||||
|
// The Bitwarden clients seem to call this API regardless of whether groups are enabled,
|
||||||
let groups = Group::find_by_organization(&org_id, &mut conn).await.iter().map(Group::to_json).collect::<Value>();
|
// so just act as if there are no groups.
|
||||||
|
Value::Array(Vec::new())
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
"Data": groups,
|
"Data": groups,
|
||||||
|
|
Loading…
Reference in a new issue