Merge pull request #204 from mprasil/org_improvements

Org improvements
This commit is contained in:
Daniel García 2018-10-01 17:40:14 +02:00 committed by GitHub
commit 990c83a037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 9 deletions

View File

@ -430,16 +430,12 @@ fn share_cipher_by_uuid(uuid: &str, data: ShareCipherData, headers: &Headers, co
Some(organization_uuid) => { Some(organization_uuid) => {
let mut shared_to_collection = false; let mut shared_to_collection = false;
for uuid in &data.CollectionIds { 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"), None => err!("Invalid collection ID provided"),
Some(collection) => { Some(collection) => {
if collection.is_writable_by_user(&headers.user.uuid, &conn) { if collection.is_writable_by_user(&headers.user.uuid, &conn) {
if collection.org_uuid == organization_uuid {
CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn); CollectionCipher::save(&cipher.uuid.clone(), &collection.uuid, &conn);
shared_to_collection = true; shared_to_collection = true;
} else {
err!("Collection does not belong to organization")
}
} else { } else {
err!("No rights to modify the collection") err!("No rights to modify the collection")
} }

View File

@ -66,7 +66,7 @@ impl Organization {
"Name": self.name, "Name": self.name,
"Seats": 10, "Seats": 10,
"MaxCollections": 10, "MaxCollections": 10,
"MaxStorageGb": 10, // The value doesn't matter, we don't check server-side
"Use2fa": true, "Use2fa": true,
"UseDirectory": false, "UseDirectory": false,
"UseEvents": false, "UseEvents": false,
@ -83,7 +83,7 @@ impl Organization {
"BillingEmail": self.billing_email, "BillingEmail": self.billing_email,
"Plan": "TeamsAnnually", "Plan": "TeamsAnnually",
"PlanType": 5, // TeamsAnnually plan "PlanType": 5, // TeamsAnnually plan
"UsersGetPremium": true,
"Object": "organization", "Object": "organization",
}) })
} }
@ -158,6 +158,7 @@ impl UserOrganization {
"Name": org.name, "Name": org.name,
"Seats": 10, "Seats": 10,
"MaxCollections": 10, "MaxCollections": 10,
"UsersGetPremium": true,
"Use2fa": true, "Use2fa": true,
"UseDirectory": false, "UseDirectory": false,

View File

@ -1,5 +1,6 @@
#![feature(plugin, custom_derive, vec_remove_item, try_trait)] #![feature(plugin, custom_derive, vec_remove_item, try_trait)]
#![plugin(rocket_codegen)] #![plugin(rocket_codegen)]
#![recursion_limit="128"]
#![allow(proc_macro_derive_resolution_fallback)] // TODO: Remove this when diesel update fixes warnings #![allow(proc_macro_derive_resolution_fallback)] // TODO: Remove this when diesel update fixes warnings
extern crate rocket; extern crate rocket;
extern crate rocket_contrib; extern crate rocket_contrib;