Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use isEnterprise from endpoint version response to determine permissions #2422

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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