From 484bf5b703fa85b61580ffb34f59768c4bd200b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Tue, 15 Jan 2019 16:35:08 +0100 Subject: [PATCH] Check that the client is not updating an outdated cipher, that should be part of an org now --- src/api/core/ciphers.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index c393b61f..2dcbef50 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -221,6 +221,10 @@ pub fn update_cipher_from_data( nt: &Notify, ut: UpdateType, ) -> EmptyResult { + if cipher.organization_uuid.is_some() && data.OrganizationId.is_none() { + err!("Organization mismatch. Please resync the client before updating the cipher") + } + if let Some(org_id) = data.OrganizationId { match UserOrganization::find_by_user_and_org(&headers.user.uuid, &org_id, &conn) { None => err!("You don't have permission to add item to organization"),