Skip to content

Commit 0f7e8d2

Browse files
committed
PUSH
- Resolved an issue where the admin.dashboard.view permission was not being recognized in the frontend, ensuring proper access control for admin features. by @NaysKutzu - The admin page now automatically hides tickets, knowledgebases, and other modules when disabled, creating a cleaner and more focused interface. by @NaysKutzu
1 parent 44126f5 commit 0f7e8d2

File tree

4 files changed

+74
-137
lines changed

4 files changed

+74
-137
lines changed

.github/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@ For installation instructions, system requirements, and complete guides, please
4949

5050
<!-- COUNT-STATS:START -->
5151

52-
_Last updated: 2025-12-15T21:07:53.801Z_
52+
_Last updated: 2025-12-15T23:23:55.471Z_
5353

5454
| Extension | Files | Lines |
5555
| --- | ---: | ---: |
56-
| `.php` | 1,143 | 211,112 |
57-
| `.vue` | 356 | 102,449 |
58-
| `.js` | 91 | 39,209 |
59-
| `.css` | 41 | 37,713 |
60-
| `.ts` | 86 | 9,764 |
61-
| `.yml` | 14 | 4,243 |
62-
| `.yaml` | 3 | 3,587 |
56+
| `.php` | 2,695 | 287,474 |
57+
| `.vue` | 356 | 102,548 |
58+
| `.js` | 124 | 39,545 |
59+
| `.css` | 47 | 37,770 |
60+
| `.ts` | 86 | 10,329 |
61+
| `.yaml` | 20 | 5,665 |
62+
| `.yml` | 21 | 4,636 |
6363
| `.sql` | 77 | 1,715 |
64-
| **Total** | 1,811 | 409,792 |
64+
| **Total** | 3,426 | 489,682 |
6565

6666
<!-- COUNT-STATS:END -->
6767

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
- Plugins now support rendering multiple pages, enabling richer and more versatile plugin experiences! by @nayskutzu
88
- Resolved an issue where backup downloads were unavailable due to JID and JWT token handling errors; downloads now work seamlessly. by @nayskutzu
99
- Resolved an issue where large archives were failing to complete and timing out during the archiving process. by @nayskutzu
10+
- Resolved an issue where the admin.dashboard.view permission was not being recognized in the frontend, ensuring proper access control for admin features. by @nayskutzu
1011

1112
## Improved
1213

1314
- Plugins now support grouped navigation sections on both dashboard and admin pages, enabling more organized and intuitive plugin experiences! by @nayskutzu
15+
- The admin page now automatically hides tickets, knowledgebases, and other modules when disabled, creating a cleaner and more focused interface. by @nayskutzu
1416

1517
## Added
1618

frontend/src/components/AppSidebar.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { useSidebarState } from '@/composables/useSidebarState';
4949
import { useServerContext } from '@/composables/useServerContext';
5050
import { useWingsWebSocketServersList } from '@/composables/useWingsWebSocketServersList';
5151
import { Copy, Check, Play, Square, RotateCw, Skull } from 'lucide-vue-next';
52+
import Permissions from '@/lib/permissions';
5253
5354
const { t } = useI18n();
5455
@@ -116,7 +117,7 @@ const user = computed(() => {
116117
email: sessionStore.user?.email || '',
117118
avatar: sessionStore.user?.avatar || '',
118119
avatar_alt: sessionStore.user?.username?.charAt(0) || '',
119-
hasAdminPanel: sessionStore.hasPermission('ADMIN_DASHBOARD_VIEW') || false,
120+
hasAdminPanel: sessionStore.hasPermission(Permissions.ADMIN_DASHBOARD_VIEW) || false,
120121
role: sessionStore.user?.role || null,
121122
};
122123
});

frontend/src/composables/useNavigation.ts

Lines changed: 61 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ import {
6060
Package,
6161
Bell,
6262
BookOpen,
63-
Mail,
6463
Ticket,
6564
Gauge,
6665
ArrowRightLeft,
@@ -320,79 +319,6 @@ export function useNavigation() {
320319
category: 'main' as const,
321320
group: 'overview',
322321
},
323-
// Account section - individual entries for each account tab
324-
{
325-
id: 'account-profile',
326-
name: t('nav.account'),
327-
title: t('account.profile'),
328-
url: '/dashboard/account?tab=profile',
329-
icon: Users,
330-
isActive:
331-
currentPath.value.startsWith('/dashboard/account') &&
332-
(!route.query.tab || route.query.tab === 'profile'),
333-
category: 'main' as const,
334-
group: 'account',
335-
},
336-
{
337-
id: 'account-settings',
338-
name: t('nav.account'),
339-
title: t('account.settings'),
340-
url: '/dashboard/account?tab=settings',
341-
icon: Settings,
342-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'settings',
343-
category: 'main' as const,
344-
group: 'account',
345-
},
346-
{
347-
id: 'account-appearance',
348-
name: t('nav.account'),
349-
title: t('account.appearance'),
350-
url: '/dashboard/account?tab=appearance',
351-
icon: Activity,
352-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'appearance',
353-
category: 'main' as const,
354-
group: 'account',
355-
},
356-
{
357-
id: 'account-ssh-keys',
358-
name: t('nav.account'),
359-
title: t('account.sshKeys.title'),
360-
url: '/dashboard/account?tab=ssh-keys',
361-
icon: Key,
362-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'ssh-keys',
363-
category: 'main' as const,
364-
group: 'account',
365-
},
366-
{
367-
id: 'account-api-keys',
368-
name: t('nav.account'),
369-
title: t('account.apiKeys.title'),
370-
url: '/dashboard/account?tab=api-keys',
371-
icon: Key,
372-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'api-keys',
373-
category: 'main' as const,
374-
group: 'account',
375-
},
376-
{
377-
id: 'account-activity',
378-
name: t('nav.account'),
379-
title: t('account.activity.title'),
380-
url: '/dashboard/account?tab=activity',
381-
icon: Clock,
382-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'activity',
383-
category: 'main' as const,
384-
group: 'account',
385-
},
386-
{
387-
id: 'account-mail',
388-
name: t('nav.account'),
389-
title: t('account.mail.title'),
390-
url: '/dashboard/account?tab=mail',
391-
icon: Mail,
392-
isActive: currentPath.value.startsWith('/dashboard/account') && route.query.tab === 'mail',
393-
category: 'main' as const,
394-
group: 'account',
395-
},
396322
// Support section - conditionally add based on settings
397323
];
398324

@@ -710,7 +636,11 @@ export function useNavigation() {
710636
permission: Permissions.ADMIN_NOTIFICATIONS_VIEW,
711637
group: 'users',
712638
},
713-
{
639+
];
640+
641+
// Only add knowledgebase admin item if enabled
642+
if (settingsStore.knowledgebaseEnabled) {
643+
items.push({
714644
id: 'admin-knowledgebase',
715645
name: 'Knowledgebase',
716646
title: 'Knowledgebase',
@@ -720,57 +650,62 @@ export function useNavigation() {
720650
category: 'admin' as const,
721651
permission: Permissions.ADMIN_KNOWLEDGEBASE_CATEGORIES_VIEW,
722652
group: 'users',
723-
},
724-
// Ticket System
725-
{
726-
id: 'admin-tickets',
727-
name: 'Tickets',
728-
title: 'Support Tickets',
729-
url: '/admin/tickets',
730-
icon: Ticket,
731-
isActive:
732-
currentPath.value.startsWith('/admin/tickets') &&
733-
!currentPath.value.startsWith('/admin/tickets/categories') &&
734-
!currentPath.value.startsWith('/admin/tickets/priorities') &&
735-
!currentPath.value.startsWith('/admin/tickets/statuses'),
736-
category: 'admin' as const,
737-
permission: Permissions.ADMIN_TICKETS_VIEW,
738-
group: 'tickets',
739-
},
740-
{
741-
id: 'admin-ticket-categories',
742-
name: 'Ticket Categories',
743-
title: 'Ticket Categories',
744-
url: '/admin/tickets/categories',
745-
icon: Ticket,
746-
isActive: currentPath.value.startsWith('/admin/tickets/categories'),
747-
category: 'admin' as const,
748-
permission: Permissions.ADMIN_TICKET_CATEGORIES_VIEW,
749-
group: 'tickets',
750-
},
751-
{
752-
id: 'admin-ticket-priorities',
753-
name: 'Ticket Priorities',
754-
title: 'Ticket Priorities',
755-
url: '/admin/tickets/priorities',
756-
icon: Ticket,
757-
isActive: currentPath.value.startsWith('/admin/tickets/priorities'),
758-
category: 'admin' as const,
759-
permission: Permissions.ADMIN_TICKET_PRIORITIES_VIEW,
760-
group: 'tickets',
761-
},
762-
{
763-
id: 'admin-ticket-statuses',
764-
name: 'Ticket Statuses',
765-
title: 'Ticket Statuses',
766-
url: '/admin/tickets/statuses',
767-
icon: Ticket,
768-
isActive: currentPath.value.startsWith('/admin/tickets/statuses'),
769-
category: 'admin' as const,
770-
permission: Permissions.ADMIN_TICKET_STATUSES_VIEW,
771-
group: 'tickets',
772-
},
773-
];
653+
});
654+
}
655+
656+
// Only add ticket system admin items if enabled
657+
if (settingsStore.ticketSystemEnabled) {
658+
items.push(
659+
{
660+
id: 'admin-tickets',
661+
name: 'Tickets',
662+
title: 'Support Tickets',
663+
url: '/admin/tickets',
664+
icon: Ticket,
665+
isActive:
666+
currentPath.value.startsWith('/admin/tickets') &&
667+
!currentPath.value.startsWith('/admin/tickets/categories') &&
668+
!currentPath.value.startsWith('/admin/tickets/priorities') &&
669+
!currentPath.value.startsWith('/admin/tickets/statuses'),
670+
category: 'admin' as const,
671+
permission: Permissions.ADMIN_TICKETS_VIEW,
672+
group: 'tickets',
673+
},
674+
{
675+
id: 'admin-ticket-categories',
676+
name: 'Ticket Categories',
677+
title: 'Ticket Categories',
678+
url: '/admin/tickets/categories',
679+
icon: Ticket,
680+
isActive: currentPath.value.startsWith('/admin/tickets/categories'),
681+
category: 'admin' as const,
682+
permission: Permissions.ADMIN_TICKET_CATEGORIES_VIEW,
683+
group: 'tickets',
684+
},
685+
{
686+
id: 'admin-ticket-priorities',
687+
name: 'Ticket Priorities',
688+
title: 'Ticket Priorities',
689+
url: '/admin/tickets/priorities',
690+
icon: Ticket,
691+
isActive: currentPath.value.startsWith('/admin/tickets/priorities'),
692+
category: 'admin' as const,
693+
permission: Permissions.ADMIN_TICKET_PRIORITIES_VIEW,
694+
group: 'tickets',
695+
},
696+
{
697+
id: 'admin-ticket-statuses',
698+
name: 'Ticket Statuses',
699+
title: 'Ticket Statuses',
700+
url: '/admin/tickets/statuses',
701+
icon: Ticket,
702+
isActive: currentPath.value.startsWith('/admin/tickets/statuses'),
703+
category: 'admin' as const,
704+
permission: Permissions.ADMIN_TICKET_STATUSES_VIEW,
705+
group: 'tickets',
706+
},
707+
);
708+
}
774709

775710
// Add plugin admin items (with permission filtering)
776711
if (pluginRoutes.value?.admin) {
@@ -1163,7 +1098,6 @@ export function useNavigation() {
11631098

11641099
const groupConfig: Record<string, () => string> = {
11651100
overview: () => t('navGroups.overview'),
1166-
account: () => t('navGroups.account'),
11671101
support: () => t('navGroups.support'),
11681102
plugins: () => t('navGroups.plugins'),
11691103
};

0 commit comments

Comments
 (0)