larxius commited on
Commit
38075fc
·
verified ·
1 Parent(s): 719f100

Update frontend/src/pages/Settings.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/pages/Settings.jsx +17 -14
frontend/src/pages/Settings.jsx CHANGED
@@ -619,26 +619,29 @@ export const AlertSettingsPage = () => {
619
  const profileEmail = user ? user.email : 'alex.mercer@larxiuswss.io';
620
  const profileRole = user?.role ? `Role: ${user.role}` : 'Lead Security Engineer';
621
 
622
- const isSchedulerAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin', 'soc_analyst', 'read_only', 'read_only_user'].includes(user?.role);
623
- const isAdminOrSuper = ['super_admin', 'support_engineer', 'admin', 'org_admin'].includes(user?.role);
 
 
 
 
624
 
625
  const tabItems = [
626
  { id: 'profile', label: 'My Profile', icon: 'person' }
627
  ];
628
 
629
- if (isSchedulerAllowed) {
630
- tabItems.push({ id: 'scheduler', label: 'Scheduler', icon: 'schedule' });
631
- tabItems.push({ id: 'demoBookings', label: 'Demo Bookings', icon: 'event_available' });
632
- }
 
 
633
 
634
- if (isAdminOrSuper) {
635
- tabItems.push(
636
- { id: 'notifications', label: 'Notifications', icon: 'notifications' },
637
- { id: 'apiKeys', label: 'API Keys', icon: 'key' },
638
- { id: 'team', label: 'Team', icon: 'group' },
639
- { id: 'billing', label: 'Billing', icon: 'credit_card' }
640
- );
641
- }
642
 
643
  return (
644
  <div className="flex flex-col gap-gutter text-left w-full">
 
619
  const profileEmail = user ? user.email : 'alex.mercer@larxiuswss.io';
620
  const profileRole = user?.role ? `Role: ${user.role}` : 'Lead Security Engineer';
621
 
622
+ const isSchedulerAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin', 'soc_analyst'].includes(user?.role);
623
+ const isDemoBookingsAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin'].includes(user?.role);
624
+ const isNotificationsAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin', 'soc_analyst', 'executive_user'].includes(user?.role);
625
+ const isApiKeysAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin', 'soc_analyst'].includes(user?.role);
626
+ const isTeamAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin'].includes(user?.role);
627
+ const isBillingAllowed = ['super_admin', 'support_engineer', 'admin', 'org_admin'].includes(user?.role);
628
 
629
  const tabItems = [
630
  { id: 'profile', label: 'My Profile', icon: 'person' }
631
  ];
632
 
633
+ if (isSchedulerAllowed) tabItems.push({ id: 'scheduler', label: 'Scheduler', icon: 'schedule' });
634
+ if (isDemoBookingsAllowed) tabItems.push({ id: 'demoBookings', label: 'Demo Bookings', icon: 'event_available' });
635
+ if (isNotificationsAllowed) tabItems.push({ id: 'notifications', label: 'Notifications', icon: 'notifications' });
636
+ if (isApiKeysAllowed) tabItems.push({ id: 'apiKeys', label: 'API Keys', icon: 'key' });
637
+ if (isTeamAllowed) tabItems.push({ id: 'team', label: 'Team', icon: 'group' });
638
+ if (isBillingAllowed) tabItems.push({ id: 'billing', label: 'Billing', icon: 'credit_card' });
639
 
640
+ useEffect(() => {
641
+ if (tabItems.length > 0 && !tabItems.some(t => t.id === activeTab)) {
642
+ setActiveTab(tabItems[0].id);
643
+ }
644
+ }, [user?.role, activeTab, tabItems.length]);
 
 
 
645
 
646
  return (
647
  <div className="flex flex-col gap-gutter text-left w-full">