@@ -175,6 +175,7 @@ const organizationAdminKeys = ["privacy", "OAuth Clients", "SSO", "directory_syn
175175export interface SettingsPermissions {
176176 canViewRoles ?: boolean ;
177177 canViewOrganizationBilling ?: boolean ;
178+ canUpdateOrganization ?: boolean ;
178179}
179180
180181const useTabs = ( {
@@ -203,10 +204,13 @@ const useTabs = ({
203204 } ;
204205 } else if ( tab . href === "/settings/organizations" ) {
205206 const newArray = ( tab ?. children ?? [ ] ) . filter (
206- ( child ) => isOrgAdminOrOwner || ! organizationAdminKeys . includes ( child . name )
207+ ( child ) =>
208+ permissions ?. canUpdateOrganization ||
209+ isOrgAdminOrOwner ||
210+ ! organizationAdminKeys . includes ( child . name )
207211 ) ;
208212
209- if ( isOrgAdminOrOwner ) {
213+ if ( permissions ?. canUpdateOrganization || isOrgAdminOrOwner ) {
210214 newArray . splice ( 4 , 0 , {
211215 name : "attributes" ,
212216 href : "/settings/organizations/attributes" ,
@@ -238,7 +242,7 @@ const useTabs = ({
238242 } ) ;
239243 }
240244 } else {
241- if ( isOrgAdminOrOwner ) {
245+ if ( permissions ?. canUpdateOrganization || isOrgAdminOrOwner ) {
242246 newArray . push ( {
243247 name : "billing" ,
244248 href : "/settings/organizations/billing" ,
@@ -264,7 +268,8 @@ const useTabs = ({
264268 return { ...tab , children : filtered } ;
265269 } else if ( tab . href === "/settings/developer" ) {
266270 const filtered = tab ?. children ?. filter (
267- ( childTab ) => isOrgAdminOrOwner || childTab . name !== "admin_api"
271+ ( childTab ) =>
272+ permissions ?. canUpdateOrganization || isOrgAdminOrOwner || childTab . name !== "admin_api"
268273 ) ;
269274 return { ...tab , children : filtered } ;
270275 }
@@ -274,12 +279,21 @@ const useTabs = ({
274279 // check if name is in adminRequiredKeys
275280 return processedTabs . filter ( ( tab ) => {
276281 if ( organizationRequiredKeys . includes ( tab . name ) ) return ! ! orgBranding ;
277- if ( tab . name === "other_teams" && ! isOrgAdminOrOwner ) return false ;
282+ if ( tab . name === "other_teams" && ! ( permissions ?. canUpdateOrganization || isOrgAdminOrOwner ) )
283+ return false ;
278284
279285 if ( isAdmin ) return true ;
280286 return ! adminRequiredKeys . includes ( tab . name ) ;
281287 } ) ;
282- } , [ isAdmin , orgBranding , isOrgAdminOrOwner , user , isDelegationCredentialEnabled , isPbacEnabled , permissions ] ) ;
288+ } , [
289+ isAdmin ,
290+ orgBranding ,
291+ isOrgAdminOrOwner ,
292+ user ,
293+ isDelegationCredentialEnabled ,
294+ isPbacEnabled ,
295+ permissions ,
296+ ] ) ;
283297
284298 return processTabsMemod ;
285299} ;
@@ -643,7 +657,7 @@ const SettingsSidebarContainer = ({
643657 </ div >
644658 </ Link >
645659 < TeamListCollapsible teamFeatures = { teamFeatures } />
646- { ( ! orgBranding ?. id || isOrgAdminOrOwner ) && (
660+ { ( ! orgBranding ?. id || permissions ?. canUpdateOrganization || isOrgAdminOrOwner ) && (
647661 < VerticalTabItem
648662 name = { t ( "add_a_team" ) }
649663 href = { `${ WEBAPP_URL } /settings/teams/new` }
0 commit comments