From fb4e6bab14f5da3fa6818a9dfd34449b7ff17f28 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Mon, 1 Oct 2018 15:59:10 +0100 Subject: [PATCH 1/2] Clean up the share_collection handling --- src/api/core/ciphers.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index 2355482..66c7c88 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -430,16 +430,12 @@ fn share_cipher_by_uuid(uuid: &str, data: ShareCipherData, headers: &Headers, co Some(organization_uuid) => { let mut shared_to_collection = false; for uuid in &data.CollectionIds { - match Collection::find_by_uuid(uuid, &conn) { + match Collection::find_by_uuid_and_org(uuid, &organization_uuid, &conn) { None => err!("Invalid collection ID provided"), Some(collection) => { if collection.is_writable_by_user(&headers.user.uuid, &conn) { - if collection.org_uuid == organization_uuid { - CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn); - shared_to_collection = true; - } else { - err!("Collection does not belong to organization") - } + CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn); + shared_to_collection = true; } else { err!("No rights to modify the collection") } From c3c74506a77308a3316a1eb265488b4c2be0c968 Mon Sep 17 00:00:00 2001 From: Miroslav Prasil Date: Mon, 1 Oct 2018 16:00:11 +0100 Subject: [PATCH 2/2] Add missing fields to returned Org json --- src/db/models/organization.rs | 5 +++-- src/main.rs | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 65b779b..7f1d297 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -66,7 +66,7 @@ impl Organization { "Name": self.name, "Seats": 10, "MaxCollections": 10, - + "MaxStorageGb": 10, // The value doesn't matter, we don't check server-side "Use2fa": true, "UseDirectory": false, "UseEvents": false, @@ -83,7 +83,7 @@ impl Organization { "BillingEmail": self.billing_email, "Plan": "TeamsAnnually", "PlanType": 5, // TeamsAnnually plan - + "UsersGetPremium": true, "Object": "organization", }) } @@ -158,6 +158,7 @@ impl UserOrganization { "Name": org.name, "Seats": 10, "MaxCollections": 10, + "UsersGetPremium": true, "Use2fa": true, "UseDirectory": false, diff --git a/src/main.rs b/src/main.rs index f6e58c9..3466436 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ #![feature(plugin, custom_derive, vec_remove_item, try_trait)] #![plugin(rocket_codegen)] +#![recursion_limit="128"] #![allow(proc_macro_derive_resolution_fallback)] // TODO: Remove this when diesel update fixes warnings extern crate rocket; extern crate rocket_contrib;