diff --git a/services/web/app/src/Features/Subscription/plansFeatures.js b/services/web/app/src/Features/Subscription/plansFeatures.js
index 481b3cd5ed..51c9cf6824 100644
--- a/services/web/app/src/Features/Subscription/plansFeatures.js
+++ b/services/web/app/src/Features/Subscription/plansFeatures.js
@@ -243,6 +243,16 @@ const groupPlans = [
organization: true,
},
},
+ {
+ feature: 'managed_users_accounts',
+ info: 'managed_users_accounts_plan_info',
+ value: 'bool',
+ plans: {
+ group_standard: false,
+ group_professional: true,
+ organization: false,
+ },
+ },
{
feature: 'sso_integration',
info: 'sso_integration_info',
@@ -636,20 +646,6 @@ const studentPlans = [
},
]
-if (Settings.managedUsers?.enabled) {
- const row = 2
- groupPlans[1].items.splice(row, 0, {
- feature: 'managed_users_accounts',
- info: 'managed_users_accounts_plan_info',
- value: 'bool',
- plans: {
- group_standard: false,
- group_professional: true,
- organization: false,
- },
- })
-}
-
module.exports = {
individual: individualPlans,
group: groupPlans,
diff --git a/services/web/app/src/infrastructure/ExpressLocals.js b/services/web/app/src/infrastructure/ExpressLocals.js
index dd6a07d25d..f096be6c49 100644
--- a/services/web/app/src/infrastructure/ExpressLocals.js
+++ b/services/web/app/src/infrastructure/ExpressLocals.js
@@ -420,6 +420,7 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
cookieDomain: Settings.cookieDomain,
templateLinks: Settings.templateLinks,
labsEnabled: Settings.labs && Settings.labs.enable,
+ groupSSOEnabled: Settings.groupSSO?.enabled,
}
next()
})
diff --git a/services/web/frontend/js/features/subscription/components/dashboard/group-settings-button.tsx b/services/web/frontend/js/features/subscription/components/dashboard/group-settings-button.tsx
index 51041cba82..6e77b580e7 100644
--- a/services/web/frontend/js/features/subscription/components/dashboard/group-settings-button.tsx
+++ b/services/web/frontend/js/features/subscription/components/dashboard/group-settings-button.tsx
@@ -1,5 +1,7 @@
import { RowLink } from '@/features/subscription/components/dashboard/row-link'
+import getMeta from '@/utils/meta'
import { useTranslation } from 'react-i18next'
+import { ExposedSettings } from '../../../../../../types/exposed-settings'
import { ManagedGroupSubscription } from '../../../../../../types/subscription/dashboard/subscription'
export default function GroupSettingsButton({
@@ -9,8 +11,16 @@ export default function GroupSettingsButton({
}) {
const { t } = useTranslation()
- const subscriptionHasGroupSSO = subscription?.features?.groupSSO
- const subscriptionHasManagedUsers = subscription?.features?.managedUsers
+ const { groupSSOEnabled } = getMeta(
+ 'ol-ExposedSettings',
+ {}
+ ) as ExposedSettings
+
+ const subscriptionHasManagedUsers =
+ subscription.features?.managedUsers !== false
+ const subscriptionHasGroupSSO =
+ subscription.features?.groupSSO === true ||
+ (groupSSOEnabled && subscription.features?.groupSSO === null)
let groupSettingRowSubText = ''
if (subscriptionHasGroupSSO && subscriptionHasManagedUsers) {
diff --git a/services/web/test/frontend/features/subscription/components/dashboard/managed-group-subscriptions.test.tsx b/services/web/test/frontend/features/subscription/components/dashboard/managed-group-subscriptions.test.tsx
index 126fb0169a..7521f94126 100644
--- a/services/web/test/frontend/features/subscription/components/dashboard/managed-group-subscriptions.test.tsx
+++ b/services/web/test/frontend/features/subscription/components/dashboard/managed-group-subscriptions.test.tsx
@@ -12,7 +12,10 @@ import {
} from '../../helpers/render-with-subscription-dash-context'
import { UserId } from '../../../../../../types/user'
-function getManagedGroupSubscription(groupSSO: boolean, managedUsers: boolean) {
+function getManagedGroupSubscriptions(
+ groupSSO: boolean | null,
+ managedUsers: boolean | null
+): ManagedGroupSubscription[] {
const subscriptionOne = {
...groupActiveSubscription,
userIsGroupMember: true,
@@ -44,13 +47,15 @@ function getManagedGroupSubscription(groupSSO: boolean, managedUsers: boolean) {
}
const managedGroupSubscriptions: ManagedGroupSubscription[] =
- getManagedGroupSubscription(false, false)
+ getManagedGroupSubscriptions(false, false)
const managedGroupSubscriptions2: ManagedGroupSubscription[] =
- getManagedGroupSubscription(true, true)
+ getManagedGroupSubscriptions(true, true)
const managedGroupSubscriptions3: ManagedGroupSubscription[] =
- getManagedGroupSubscription(true, false)
+ getManagedGroupSubscriptions(true, false)
const managedGroupSubscriptions4: ManagedGroupSubscription[] =
- getManagedGroupSubscription(false, true)
+ getManagedGroupSubscriptions(false, true)
+const managedGroupSubscriptions5: ManagedGroupSubscription[] =
+ getManagedGroupSubscriptions(null, true)
describe('', function () {
afterEach(function () {
@@ -122,63 +127,209 @@ describe('', function () {
.be.null
})
- it('renders the Manage group settings row when feature is turned on', async function () {
- renderWithSubscriptionDashContext(, {
- metaTags: [
- {
- name: 'ol-managedGroupSubscriptions',
- value: managedGroupSubscriptions2,
- },
- {
- name: 'ol-groupSettingsEnabledFor',
- value: [managedGroupSubscriptions2[0]._id],
- },
- ],
+ describe('with group SSO off by default', function () {
+ beforeEach(function () {
+ window.metaAttributesCache.set('ol-ExposedSettings', {
+ groupSSOEnabled: false,
+ })
+ })
+
+ it('renders the Manage group settings row when feature is turned on', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions2,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions2[0]._id],
+ },
+ ],
+ })
+ await screen.findAllByText('Manage group settings')
+ await screen.findAllByText('Configure and manage SSO and Managed Users')
+ })
+
+ describe('renders the the correct subText for Manage Group settings row', async function () {
+ it('with managedUsers.enabled=true and groupSSO.enabled=true', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions2,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions2[0]._id],
+ },
+ ],
+ })
+ await screen.findAllByText('Configure and manage SSO and Managed Users')
+ })
+
+ it('with managedUsers.enabled=false and groupSSO.enabled=true', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions3,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions3[0]._id],
+ },
+ ],
+ })
+ await screen.findAllByText('Configure and manage SSO')
+ })
+
+ it('with managedUsers.enabled=true and groupSSO.enabled=false', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions4,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions4[0]._id],
+ },
+ ],
+ })
+ await screen.findAllByText('Turn on Managed Users')
+ })
+
+ it('with managedUsers.enabled=true and groupSSO.enabled=null', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions5,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions5[0]._id],
+ },
+ ],
+ })
+ await screen.findAllByText('Turn on Managed Users')
+ })
})
- await screen.findAllByText('Manage group settings')
- await screen.findAllByText('Configure and manage SSO and Managed Users')
})
- it('renders the the correct subText for Manage Group settings row', async function () {
- renderWithSubscriptionDashContext(, {
- metaTags: [
- {
- name: 'ol-managedGroupSubscriptions',
- value: managedGroupSubscriptions2,
- },
- {
- name: 'ol-groupSettingsEnabledFor',
- value: [managedGroupSubscriptions2[0]._id],
- },
- ],
+ describe('with group SSO on by default', function () {
+ it('renders the Manage group settings row when features are turned on', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions2,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions2[0]._id],
+ },
+ {
+ name: 'ol-ExposedSettings',
+ value: {
+ groupSSOEnabled: true,
+ },
+ },
+ ],
+ })
+ await screen.findAllByText('Manage group settings')
+ await screen.findAllByText('Configure and manage SSO and Managed Users')
})
- await screen.findAllByText('Configure and manage SSO and Managed Users')
- renderWithSubscriptionDashContext(, {
- metaTags: [
- {
- name: 'ol-managedGroupSubscriptions',
- value: managedGroupSubscriptions3,
- },
- {
- name: 'ol-groupSettingsEnabledFor',
- value: [managedGroupSubscriptions3[0]._id],
- },
- ],
+ describe('renders the the correct subText for Manage Group settings row', async function () {
+ it('with managedUsers.enabled=true and groupSSO.enabled=true', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions2,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions2[0]._id],
+ },
+ {
+ name: 'ol-ExposedSettings',
+ value: {
+ groupSSOEnabled: true,
+ },
+ },
+ ],
+ })
+ await screen.findAllByText('Configure and manage SSO and Managed Users')
+ })
+
+ it('with managedUsers.enabled=false and groupSSO.enabled=true', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions3,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions3[0]._id],
+ },
+ {
+ name: 'ol-ExposedSettings',
+ value: {
+ groupSSOEnabled: true,
+ },
+ },
+ ],
+ })
+ await screen.findAllByText('Configure and manage SSO')
+ })
+
+ it('with managedUsers.enabled=true and groupSSO.enabled=false', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions4,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions4[0]._id],
+ },
+ {
+ name: 'ol-ExposedSettings',
+ value: {
+ groupSSOEnabled: true,
+ },
+ },
+ ],
+ })
+ await screen.findAllByText('Turn on Managed Users')
+ })
+
+ it('with managedUsers.enabled=true and groupSSO.enabled=null', async function () {
+ renderWithSubscriptionDashContext(, {
+ metaTags: [
+ {
+ name: 'ol-managedGroupSubscriptions',
+ value: managedGroupSubscriptions5,
+ },
+ {
+ name: 'ol-groupSettingsEnabledFor',
+ value: [managedGroupSubscriptions5[0]._id],
+ },
+ {
+ name: 'ol-ExposedSettings',
+ value: {
+ groupSSOEnabled: true,
+ },
+ },
+ ],
+ })
+ await screen.findAllByText('Configure and manage SSO and Managed Users')
+ })
})
- await screen.findAllByText('Configure and manage SSO')
- renderWithSubscriptionDashContext(, {
- metaTags: [
- {
- name: 'ol-managedGroupSubscriptions',
- value: managedGroupSubscriptions4,
- },
- {
- name: 'ol-groupSettingsEnabledFor',
- value: [managedGroupSubscriptions4[0]._id],
- },
- ],
- })
- await screen.findAllByText('Turn on Managed Users')
})
})
diff --git a/services/web/types/exposed-settings.ts b/services/web/types/exposed-settings.ts
index 4bf076b2a8..9a26441965 100644
--- a/services/web/types/exposed-settings.ts
+++ b/services/web/types/exposed-settings.ts
@@ -45,4 +45,6 @@ export type ExposedSettings = {
fileIgnorePattern: string
templateLinks?: TemplateLink[]
labsEnabled: boolean
+ managedUsersEnabled?: boolean
+ groupSSOEnabled?: boolean
}
diff --git a/services/web/types/subscription/dashboard/subscription.ts b/services/web/types/subscription/dashboard/subscription.ts
index c04d7f9e86..8bcef0f908 100644
--- a/services/web/types/subscription/dashboard/subscription.ts
+++ b/services/web/types/subscription/dashboard/subscription.ts
@@ -78,8 +78,8 @@ export type ManagedGroupSubscription = Omit & {
planLevelName: string
admin_id: User
features: {
- groupSSO: boolean
- managedUsers: boolean
+ groupSSO: boolean | null
+ managedUsers: boolean | null
}
}