mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 21:26:04 +00:00
Merge pull request #4005 from Infisical/fix/billingPageIdentityLimit
fix(billing): fix feature flags to only use identityLimit
This commit is contained in:
@@ -361,13 +361,6 @@ export const ldapConfigServiceFactory = ({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const plan = await licenseService.getPlan(orgId);
|
const plan = await licenseService.getPlan(orgId);
|
||||||
if (plan?.slug !== "enterprise" && plan?.memberLimit && plan.membersUsed >= plan.memberLimit) {
|
|
||||||
// limit imposed on number of members allowed / number of members used exceeds the number of members allowed
|
|
||||||
throw new BadRequestError({
|
|
||||||
message: "Failed to create new member via LDAP due to member limit reached. Upgrade plan to add more members."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
||||||
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
export const BillingPlanRows = {
|
export const BillingPlanRows = {
|
||||||
MemberLimit: { name: "Organization member limit", field: "memberLimit" },
|
|
||||||
IdentityLimit: { name: "Organization identity limit", field: "identityLimit" },
|
IdentityLimit: { name: "Organization identity limit", field: "identityLimit" },
|
||||||
WorkspaceLimit: { name: "Project limit", field: "workspaceLimit" },
|
WorkspaceLimit: { name: "Project limit", field: "workspaceLimit" },
|
||||||
EnvironmentLimit: { name: "Environment limit", field: "environmentLimit" },
|
EnvironmentLimit: { name: "Environment limit", field: "environmentLimit" },
|
||||||
|
|||||||
@@ -442,9 +442,7 @@ export const licenseServiceFactory = ({
|
|||||||
rows: data.rows.map((el) => {
|
rows: data.rows.map((el) => {
|
||||||
let used = "-";
|
let used = "-";
|
||||||
|
|
||||||
if (el.name === BillingPlanRows.MemberLimit.name) {
|
if (el.name === BillingPlanRows.WorkspaceLimit.name) {
|
||||||
used = orgMembersUsed.toString();
|
|
||||||
} else if (el.name === BillingPlanRows.WorkspaceLimit.name) {
|
|
||||||
used = projectCount.toString();
|
used = projectCount.toString();
|
||||||
} else if (el.name === BillingPlanRows.IdentityLimit.name) {
|
} else if (el.name === BillingPlanRows.IdentityLimit.name) {
|
||||||
used = (identityUsed + orgMembersUsed).toString();
|
used = (identityUsed + orgMembersUsed).toString();
|
||||||
@@ -464,12 +462,10 @@ export const licenseServiceFactory = ({
|
|||||||
const allowed = onPremFeatures[field as keyof TFeatureSet];
|
const allowed = onPremFeatures[field as keyof TFeatureSet];
|
||||||
let used = "-";
|
let used = "-";
|
||||||
|
|
||||||
if (field === BillingPlanRows.MemberLimit.field) {
|
if (field === BillingPlanRows.WorkspaceLimit.field) {
|
||||||
used = orgMembersUsed.toString();
|
|
||||||
} else if (field === BillingPlanRows.WorkspaceLimit.field) {
|
|
||||||
used = projectCount.toString();
|
used = projectCount.toString();
|
||||||
} else if (field === BillingPlanRows.IdentityLimit.field) {
|
} else if (field === BillingPlanRows.IdentityLimit.field) {
|
||||||
used = identityUsed.toString();
|
used = (identityUsed + orgMembersUsed).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -311,13 +311,6 @@ export const samlConfigServiceFactory = ({
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const plan = await licenseService.getPlan(orgId);
|
const plan = await licenseService.getPlan(orgId);
|
||||||
if (plan?.slug !== "enterprise" && plan?.memberLimit && plan.membersUsed >= plan.memberLimit) {
|
|
||||||
// limit imposed on number of members allowed / number of members used exceeds the number of members allowed
|
|
||||||
throw new BadRequestError({
|
|
||||||
message: "Failed to create new member via SAML due to member limit reached. Upgrade plan to add more members."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
||||||
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
@@ -912,14 +912,6 @@ export const orgServiceFactory = ({
|
|||||||
|
|
||||||
// if there exist no org membership we set is as given by the request
|
// if there exist no org membership we set is as given by the request
|
||||||
if (!inviteeOrgMembership) {
|
if (!inviteeOrgMembership) {
|
||||||
if (plan?.slug !== "enterprise" && plan?.memberLimit && plan.membersUsed >= plan.memberLimit) {
|
|
||||||
// limit imposed on number of members allowed / number of members used exceeds the number of members allowed
|
|
||||||
throw new BadRequestError({
|
|
||||||
name: "InviteUser",
|
|
||||||
message: "Failed to invite member due to member limit reached. Upgrade plan to invite more members."
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
|
||||||
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|||||||
import { apiRequest } from "@app/config/request";
|
import { apiRequest } from "@app/config/request";
|
||||||
|
|
||||||
import { organizationKeys } from "../organization/queries";
|
import { organizationKeys } from "../organization/queries";
|
||||||
|
import { subscriptionQueryKeys } from "../subscriptions/queries";
|
||||||
import { identitiesKeys } from "./queries";
|
import { identitiesKeys } from "./queries";
|
||||||
import {
|
import {
|
||||||
AddIdentityAliCloudAuthDTO,
|
AddIdentityAliCloudAuthDTO,
|
||||||
@@ -82,6 +83,9 @@ export const useCreateIdentity = () => {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||||
});
|
});
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: subscriptionQueryKeys.getOrgSubsription(organizationId)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -123,6 +127,9 @@ export const useDeleteIdentity = () => {
|
|||||||
queryClient.invalidateQueries({
|
queryClient.invalidateQueries({
|
||||||
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
queryKey: organizationKeys.getOrgIdentityMemberships(organizationId)
|
||||||
});
|
});
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: subscriptionQueryKeys.getOrgSubsription(organizationId)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { APIKeyDataV2 } from "../apiKeys/types";
|
|||||||
import { MfaMethod } from "../auth/types";
|
import { MfaMethod } from "../auth/types";
|
||||||
import { TGroupWithProjectMemberships } from "../groups/types";
|
import { TGroupWithProjectMemberships } from "../groups/types";
|
||||||
import { setAuthToken } from "../reactQuery";
|
import { setAuthToken } from "../reactQuery";
|
||||||
|
import { subscriptionQueryKeys } from "../subscriptions/queries";
|
||||||
import { workspaceKeys } from "../workspace";
|
import { workspaceKeys } from "../workspace";
|
||||||
import { userKeys } from "./query-keys";
|
import { userKeys } from "./query-keys";
|
||||||
import {
|
import {
|
||||||
@@ -188,6 +189,9 @@ export const useAddUsersToOrg = () => {
|
|||||||
},
|
},
|
||||||
onSuccess: (_, { organizationId, projects }) => {
|
onSuccess: (_, { organizationId, projects }) => {
|
||||||
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(organizationId) });
|
queryClient.invalidateQueries({ queryKey: userKeys.getOrgUsers(organizationId) });
|
||||||
|
queryClient.invalidateQueries({
|
||||||
|
queryKey: subscriptionQueryKeys.getOrgSubsription(organizationId)
|
||||||
|
});
|
||||||
|
|
||||||
projects?.forEach((project) => {
|
projects?.forEach((project) => {
|
||||||
if (project.slug) {
|
if (project.slug) {
|
||||||
|
|||||||
+1
-5
@@ -39,10 +39,6 @@ export const OrgMembersSection = () => {
|
|||||||
const { mutateAsync: deleteMutateAsync } = useDeleteOrgMembership();
|
const { mutateAsync: deleteMutateAsync } = useDeleteOrgMembership();
|
||||||
const { mutateAsync: updateOrgMembership } = useUpdateOrgMembership();
|
const { mutateAsync: updateOrgMembership } = useUpdateOrgMembership();
|
||||||
|
|
||||||
const isMoreUsersAllowed = subscription?.memberLimit
|
|
||||||
? subscription.membersUsed < subscription.memberLimit
|
|
||||||
: true;
|
|
||||||
|
|
||||||
const isMoreIdentitiesAllowed = subscription?.identityLimit
|
const isMoreIdentitiesAllowed = subscription?.identityLimit
|
||||||
? subscription.identitiesUsed < subscription.identityLimit
|
? subscription.identitiesUsed < subscription.identityLimit
|
||||||
: true;
|
: true;
|
||||||
@@ -58,7 +54,7 @@ export const OrgMembersSection = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!isMoreUsersAllowed || !isMoreIdentitiesAllowed) && !isEnterprise) {
|
if (!isMoreIdentitiesAllowed && !isEnterprise) {
|
||||||
handlePopUpOpen("upgradePlan", {
|
handlePopUpOpen("upgradePlan", {
|
||||||
description: "You can add more members if you upgrade your Infisical plan."
|
description: "You can add more members if you upgrade your Infisical plan."
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user