fix permissions
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user