Enhance MSSP license check to support MSSP Unlimited after MSSP 1-5 and MSSP 6-10 checks (#387)
taylor_socfortress committed
Dec 20, 2024 at 10:16 UTC
4072bb0054cf213bf9c6f33ecdd50fb6d37f124c
1 file changed
+16
-6
backend/app/customers/routes/customers.py
+16
-6
@@ -101,12 +101,22 @@ async def mssp_license_check(session: AsyncSession):
101
)
102
except HTTPException as e:
103
if e.status_code == 400:
104
- # If MSSP 1-5 license check fails, check for MSSP 6-10 license
105
- await is_feature_enabled(
106
- "MSSP 10",
107
- session,
108
- message="You have reached the maximum number of customers allowed for your license type. Please upgrade your license to provision more customers.",
109
- )
104
+ # If MSSP 1-5 license check fails, check for MSSP 6-10 or MSSP Unlimited license
105
+ try:
106
+ await is_feature_enabled(
107
+ "MSSP 10",
108
+ session,
109
+ message="You have reached the maximum number of customers allowed for your license type. Please upgrade your license to provision more customers.",
110
+ )
111
+ except HTTPException as e2:
112
+ if e2.status_code == 400:
113
+ await is_feature_enabled(
114
+ "MSSP Unlimited",
115
+ session,
116
+ message="You have reached the maximum number of customers allowed for your license type. Please upgrade your license to provision more customers.",
117
+ )
118
+ else:
119
+ raise e2
120
else:
121
raise e
122
elif 6 <= provisioned_customers <= 10: