diff --git a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx index 5897690bbaa..47e4a8bb7f3 100644 --- a/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx +++ b/ui/litellm-dashboard/src/components/Settings/AdminSettings/UISettings/PageVisibilitySettings.tsx @@ -78,6 +78,10 @@ export default function PageVisibilitySettings({ By default, all pages are visible to internal users. Select specific pages to restrict visibility. + + Note: Only pages accessible to internal user roles are shown here. Admin-only pages are excluded as they + cannot be made visible to internal users regardless of this setting. + { + if (!pageRoles || pageRoles.length === 0) { + return true; // No role restrictions + } + + // Check if any of the page's roles match internal user roles + return pageRoles.some(role => internalUserRoles.includes(role)); +}; /** * Get all available pages from the navigation menu configuration * Used by UI Settings to display available pages for visibility control + * + * IMPORTANT: Only returns pages that internal users can access. + * Pages restricted to admin-only roles are excluded because internal users + * cannot see them regardless of the UI visibility setting. */ export const getAvailablePages = (): PageMetadata[] => { const pages: PageMetadata[] = []; @@ -15,7 +35,14 @@ export const getAvailablePages = (): PageMetadata[] => { menuGroups.forEach((group) => { group.items.forEach((item) => { // Add top-level items (skip parent containers like 'tools', 'experimental', 'settings') - if (item.page && item.page !== "tools" && item.page !== "experimental" && item.page !== "settings") { + // Also skip items that internal users cannot access + if ( + item.page && + item.page !== "tools" && + item.page !== "experimental" && + item.page !== "settings" && + isPageAccessibleToInternalUsers(item.roles) + ) { const label = typeof item.label === "string" ? item.label : item.key; pages.push({ page: item.page, @@ -25,17 +52,20 @@ export const getAvailablePages = (): PageMetadata[] => { }); } - // Add children items + // Add children items (also skip those internal users cannot access) if (item.children) { const parentLabel = typeof item.label === "string" ? item.label : item.key; item.children.forEach((child) => { - const childLabel = typeof child.label === "string" ? child.label : child.key; - pages.push({ - page: child.page, - label: childLabel, - group: `${group.groupLabel} > ${parentLabel}`, - description: pageDescriptions[child.page] || "No description available", - }); + // Include if internal users can access + if (isPageAccessibleToInternalUsers(child.roles)) { + const childLabel = typeof child.label === "string" ? child.label : child.key; + pages.push({ + page: child.page, + label: childLabel, + group: `${group.groupLabel} > ${parentLabel}`, + description: pageDescriptions[child.page] || "No description available", + }); + } }); } });