From 3d66188350f107094309d3dcd62b8202aad25004 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Thu, 29 Apr 2021 23:53:26 +0200 Subject: [PATCH] fix: fix bypass account limitation to create more contacts (#5125) --- app/Exceptions/AccountLimitException.php | 12 ++++++++++++ app/Services/Contact/Contact/CreateContact.php | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 app/Exceptions/AccountLimitException.php diff --git a/app/Exceptions/AccountLimitException.php b/app/Exceptions/AccountLimitException.php new file mode 100644 index 00000000000..cd6f0f2e90a --- /dev/null +++ b/app/Exceptions/AccountLimitException.php @@ -0,0 +1,12 @@ +validate($data); + $account = Account::find($data['account_id']); + if (AccountHelper::hasReachedContactLimit($account) + && AccountHelper::hasLimitations($account) + && ! $account->legacy_free_plan_unlimited_contacts) { + throw new AccountLimitException(); + } + // filter out the data that shall not be updated here $dataOnly = Arr::except( $data,