@@ -5,11 +5,12 @@ import {
55 groupIdpSyncSettings ,
66 roleIdpSyncSettings ,
77} from "api/queries/organizations" ;
8- import { ErrorAlert } from "components/Alert/ErrorAlert " ;
8+ import { ChooseOne , Cond } from "components/Conditionals/ChooseOne " ;
99import { EmptyState } from "components/EmptyState/EmptyState" ;
10- import { Loader } from "components/Loader/Loader " ;
10+ import { Paywall } from "components/Paywall/Paywall " ;
1111import { SettingsHeader } from "components/SettingsHeader/SettingsHeader" ;
1212import { Stack } from "components/Stack/Stack" ;
13+ import { useFeatureVisibility } from "modules/dashboard/useFeatureVisibility" ;
1314import type { FC } from "react" ;
1415import { Helmet } from "react-helmet-async" ;
1516import { useQueries } from "react-query" ;
@@ -24,6 +25,8 @@ export const IdpSyncPage: FC = () => {
2425 const { organization : organizationName } = useParams ( ) as {
2526 organization : string ;
2627 } ;
28+ // IdP sync does not have its own entitlement and is based on templace_rbac
29+ const { template_rbac : isIdpSyncEnabled } = useFeatureVisibility ( ) ;
2730 const { organizations } = useOrganizationSettings ( ) ;
2831 const organization = organizations ?. find ( ( o ) => o . name === organizationName ) ;
2932
@@ -40,26 +43,10 @@ export const IdpSyncPage: FC = () => {
4043 return < EmptyState message = "Organization not found" /> ;
4144 }
4245
43- if (
44- groupsQuery . isLoading ||
45- groupIdpSyncSettingsQuery . isLoading ||
46- roleIdpSyncSettingsQuery . isLoading
47- ) {
48- return < Loader /> ;
49- }
50-
5146 const error =
5247 groupIdpSyncSettingsQuery . error ||
5348 roleIdpSyncSettingsQuery . error ||
5449 groupsQuery . error ;
55- if (
56- error ||
57- ! groupIdpSyncSettingsQuery . data ||
58- ! roleIdpSyncSettingsQuery . data ||
59- ! groupsQuery . data
60- ) {
61- return < ErrorAlert error = { error } /> ;
62- }
6350
6451 const groupsMap = new Map < string , string > ( ) ;
6552 if ( groupsQuery . data ) {
@@ -84,25 +71,34 @@ export const IdpSyncPage: FC = () => {
8471 description = "Group and role sync mappings (configured using Coder CLI)."
8572 tooltip = { < IdpSyncHelpTooltip /> }
8673 />
87- < Stack direction = "row" spacing = { 2 } >
88- < Button
89- startIcon = { < LaunchOutlined /> }
90- component = "a"
91- href = { docs ( "/admin/auth#group-sync-enterprise" ) }
92- target = "_blank"
93- >
94- Setup IdP Sync
95- </ Button >
96- </ Stack >
74+ < Button
75+ startIcon = { < LaunchOutlined /> }
76+ component = "a"
77+ href = { docs ( "/admin/auth#group-sync-enterprise" ) }
78+ target = "_blank"
79+ >
80+ Setup IdP Sync
81+ </ Button >
9782 </ Stack >
98-
99- < IdpSyncPageView
100- groupSyncSettings = { groupIdpSyncSettingsQuery . data }
101- roleSyncSettings = { roleIdpSyncSettingsQuery . data }
102- groups = { groupsQuery . data }
103- groupsMap = { groupsMap }
104- organization = { organization }
105- />
83+ < ChooseOne >
84+ < Cond condition = { ! isIdpSyncEnabled } >
85+ < Paywall
86+ message = "IdP Sync"
87+ description = "Configure group and role mappings to manage permissions outside of Coder. You need an Premium license to use this feature."
88+ documentationLink = { docs ( "/admin/groups" ) }
89+ />
90+ </ Cond >
91+ < Cond >
92+ < IdpSyncPageView
93+ groupSyncSettings = { groupIdpSyncSettingsQuery . data }
94+ roleSyncSettings = { roleIdpSyncSettingsQuery . data }
95+ groups = { groupsQuery . data }
96+ groupsMap = { groupsMap }
97+ organization = { organization }
98+ error = { error }
99+ />
100+ </ Cond >
101+ </ ChooseOne >
106102 </ >
107103 ) ;
108104} ;
0 commit comments