Add support for hiding passwords in a collection

Ref: https://github.com/bitwarden/server/pull/743
This commit is contained in:
Jeremy Lin
2020-07-02 21:51:20 -07:00
parent b34d548246
commit 979d010dc2
13 changed files with 136 additions and 58 deletions

View File

@@ -310,10 +310,11 @@ impl UserOrganization {
})
}
pub fn to_json_read_only(&self, read_only: bool) -> Value {
pub fn to_json_user_access_restrictions(&self, col_user: &CollectionUser) -> Value {
json!({
"Id": self.uuid,
"ReadOnly": read_only
"ReadOnly": col_user.read_only,
"HidePasswords": col_user.hide_passwords,
})
}
@@ -324,7 +325,11 @@ impl UserOrganization {
let collections = CollectionUser::find_by_organization_and_user_uuid(&self.org_uuid, &self.user_uuid, conn);
collections
.iter()
.map(|c| json!({"Id": c.collection_uuid, "ReadOnly": c.read_only}))
.map(|c| json!({
"Id": c.collection_uuid,
"ReadOnly": c.read_only,
"HidePasswords": c.hide_passwords,
}))
.collect()
};