diff options
author | Mathijs van Veluw <[email protected]> | 2024-07-03 21:11:04 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-03 21:11:04 +0200 |
commit | d42b264a93eace528dc20f0cd363742d4fbce448 (patch) | |
tree | 0dd5f1882f4f8dd1168dc1c1855f1d564d26ffb8 | |
parent | a4c7fadbf4ffa242fb78ebd152080028e7f2993c (diff) | |
download | vaultwarden-d42b264a93eace528dc20f0cd363742d4fbce448.tar.gz vaultwarden-d42b264a93eace528dc20f0cd363742d4fbce448.zip |
Fix collections and native app issue (#4685)
Collections were not visible in the organization view.
This was because the `flexibleCollections` was set to `true`
Found an issue with loading some old created Secure Notes which had `{}` or `{"type":null}` as there `data` value.
This isn't allowed. When detected, replace it with `{"type":0}`
Fixes #4682
Fixes #4590
-rw-r--r-- | src/db/models/cipher.rs | 6 | ||||
-rw-r--r-- | src/db/models/organization.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/db/models/cipher.rs b/src/db/models/cipher.rs index f765f470..545463d3 100644 --- a/src/db/models/cipher.rs +++ b/src/db/models/cipher.rs @@ -189,6 +189,12 @@ impl Cipher { } } + // Fix secure note issues when data is `{}` + // This breaks at least the native mobile clients + if self.atype == 2 && (self.data.eq("{}") || self.data.to_ascii_lowercase().eq("{\"type\":null}")) { + type_data_json = json!({"type": 0}); + } + // Clone the type_data and add some default value. let mut data_json = type_data_json.clone(); diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index fce9f9c9..f378ba40 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -406,7 +406,7 @@ impl UserOrganization { "accessSecretsManager": false, "limitCollectionCreationDeletion": true, "allowAdminAccessToAllCollectionItems": true, - "flexibleCollections": true, + "flexibleCollections": false, "permissions": permissions, |