Browse Source
Merge pull request #204 from mprasil/org_improvements
Org improvements
pull/207/head
Daniel García
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
9 deletions
-
src/api/core/ciphers.rs
-
src/db/models/organization.rs
-
src/main.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") |
|
|
|
} |
|
|
|
|
|
@ -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, |
|
|
|
|
|
@ -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; |
|
|
|