From 928ad6c1d82d6f2c9c81b87898e28ae60146ca8e Mon Sep 17 00:00:00 2001 From: Stephen White Date: Fri, 25 Jan 2019 14:18:06 +0000 Subject: [PATCH 1/2] Fix the list of users with access to a collection to display correctly. https://github.com/dani-garcia/bitwarden_rs/issues/364 --- src/api/core/organizations.rs | 6 +----- src/db/models/organization.rs | 10 ++-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 318c641..d9b903d 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -375,11 +375,7 @@ fn get_collection_users(org_id: String, coll_id: String, _headers: AdminHeaders, }) .collect(); - Ok(Json(json!({ - "Data": user_list, - "Object": "list", - "ContinuationToken": null, - }))) + Ok(Json(json!(user_list))) } #[derive(FromForm)] diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 0efcb5e..c755a06 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -296,14 +296,8 @@ impl UserOrganization { let user = User::find_by_uuid(&self.user_uuid, conn).unwrap(); json!({ - "OrganizationUserId": self.uuid, - "AccessAll": self.access_all, - "Name": user.name, - "Email": user.email, - "Type": self.type_, - "Status": self.status, - "ReadOnly": read_only, - "Object": "collectionUser", + "Id": self.uuid, + "ReadOnly": read_only }) } From fc0e239bdf7ae4aeed5df9273532c0985457d491 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Fri, 25 Jan 2019 14:25:15 +0000 Subject: [PATCH 2/2] No point calling find_by_uuid now we don't use the result. --- src/db/models/organization.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index c755a06..498e64e 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -293,8 +293,6 @@ impl UserOrganization { } pub fn to_json_collection_user_details(&self, read_only: bool, conn: &DbConn) -> Value { - let user = User::find_by_uuid(&self.user_uuid, conn).unwrap(); - json!({ "Id": self.uuid, "ReadOnly": read_only