Skip to content

Commit

Permalink
feat: Use isEnterprise from endpoint version response to determine pe…
Browse files Browse the repository at this point in the history
…rmissions (#2422)
  • Loading branch information
novakzaballa committed Aug 4, 2023
1 parent 6420997 commit edf38ac
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,18 @@ const Utils = Object.assign({}, require('./base/_utils'), {
if (plan && plan.includes('start-up')) {
return planNames.startup
}
if (plan && plan.includes('enterprise')) {
if (
global.flagsmithVersion?.backend.is_enterprise ||
(plan && plan.includes('enterprise'))
) {
return planNames.enterprise
}
return planNames.free
},
getPlanPermission: (plan: string, permission: string) => {
let valid = true
const planName = Utils.getPlanName(plan)
if (!Utils.getFlagsmithHasFeature('plan_based_access')) {
return true
}

if (!plan || planName === planNames.free) {
return false
}
Expand Down Expand Up @@ -306,9 +307,6 @@ const Utils = Object.assign({}, require('./base/_utils'), {
},

getPlansPermission: (permission: string) => {
if (!Utils.getFlagsmithHasFeature('plan_based_access')) {
return true
}
const isOrgPermission = permission !== '2FA'
const plans = isOrgPermission
? AccountStore.getActiveOrgPlan()
Expand Down

3 comments on commit edf38ac

@vercel
Copy link

@vercel vercel bot commented on edf38ac Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on edf38ac Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on edf38ac Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-flagsmith.vercel.app
docs.bullet-train.io
docs.flagsmith.com
docs-git-main-flagsmith.vercel.app

Please sign in to comment.