diff --git a/backend/src/ee/services/ldap-config/ldap-config-service.ts b/backend/src/ee/services/ldap-config/ldap-config-service.ts index e90f8c031..62d728ac0 100644 --- a/backend/src/ee/services/ldap-config/ldap-config-service.ts +++ b/backend/src/ee/services/ldap-config/ldap-config-service.ts @@ -588,6 +588,12 @@ export const ldapConfigServiceFactory = ({ const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.Ldap); + const plan = await licenseService.getPlan(orgId); + if (!plan.ldap) + throw new BadRequestError({ + message: "Failed to create LDAP group map due to plan restriction. Upgrade plan to create LDAP group map." + }); + const ldapConfig = await ldapConfigDAL.findOne({ id: ldapConfigId, orgId @@ -618,6 +624,12 @@ export const ldapConfigServiceFactory = ({ const { permission } = await permissionService.getOrgPermission(actor, actorId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Delete, OrgPermissionSubjects.Ldap); + const plan = await licenseService.getPlan(orgId); + if (!plan.ldap) + throw new BadRequestError({ + message: "Failed to delete LDAP group map due to plan restriction. Upgrade plan to delete LDAP group map." + }); + const ldapConfig = await ldapConfigDAL.findOne({ id: ldapConfigId, orgId