fix permissions

This commit is contained in:
Matthias Hochmeister
2026-03-25 09:02:49 +01:00
parent 6f39f22bf9
commit 5db4cc21b5
2 changed files with 7 additions and 7 deletions

View File

@@ -190,7 +190,7 @@ function Sidebar({ mobileOpen, onMobileClose }: SidebarProps) {
let ausruestungTabIdx = 0;
if (hasPermission('ausruestungsanfrage:create_request')) { ausruestungSubItems.push({ text: 'Meine Anfragen', path: `/ausruestungsanfrage?tab=${ausruestungTabIdx}` }); ausruestungTabIdx++; }
if (hasPermission('ausruestungsanfrage:approve')) { ausruestungSubItems.push({ text: 'Alle Anfragen', path: `/ausruestungsanfrage?tab=${ausruestungTabIdx}` }); ausruestungTabIdx++; }
ausruestungSubItems.push({ text: 'Katalog', path: `/ausruestungsanfrage?tab=${ausruestungTabIdx}` });
if (hasPermission('ausruestungsanfrage:view')) { ausruestungSubItems.push({ text: 'Katalog', path: `/ausruestungsanfrage?tab=${ausruestungTabIdx}` }); ausruestungTabIdx++; }
// Build Issues sub-items dynamically (tab order must match Issues.tsx)
const issuesSubItems: SubItem[] = [

View File

@@ -1450,7 +1450,7 @@ export default function Ausruestungsanfrage() {
const canCreate = hasPermission('ausruestungsanfrage:create_request');
const canApprove = hasPermission('ausruestungsanfrage:approve');
const tabCount = 1 + (canCreate ? 1 : 0) + (canApprove ? 1 : 0);
const tabCount = (canCreate ? 1 : 0) + (canApprove ? 1 : 0) + (canView ? 1 : 0);
const [activeTab, setActiveTab] = useState(() => {
const t = Number(searchParams.get('tab'));
@@ -1473,11 +1473,11 @@ export default function Ausruestungsanfrage() {
let next = 0;
if (canCreate) { map.meine = next; next++; }
if (canApprove) { map.alle = next; next++; }
map.katalog = next;
if (canView) { map.katalog = next; next++; }
return map;
}, [canCreate, canApprove]);
}, [canCreate, canApprove, canView]);
if (!canView) {
if (!canView && !canCreate && !canApprove) {
return (
<DashboardLayout>
<Typography>Keine Berechtigung.</Typography>
@@ -1493,13 +1493,13 @@ export default function Ausruestungsanfrage() {
<Tabs value={activeTab} onChange={handleTabChange} variant="scrollable" scrollButtons="auto">
{canCreate && <Tab label="Meine Anfragen" />}
{canApprove && <Tab label="Alle Anfragen" />}
<Tab label="Katalog" />
{canView && <Tab label="Katalog" />}
</Tabs>
</Box>
{canCreate && activeTab === tabIndex.meine && <MeineAnfragenTab />}
{canApprove && activeTab === tabIndex.alle && <AlleAnfragenTab />}
{activeTab === tabIndex.katalog && <KatalogTab />}
{canView && activeTab === tabIndex.katalog && <KatalogTab />}
</DashboardLayout>
);
}