permission changes
This commit is contained in:
@@ -17,6 +17,9 @@ import PersonalWarningsBanner from '../components/dashboard/PersonalWarningsBann
|
||||
|
||||
function Dashboard() {
|
||||
const { user } = useAuth();
|
||||
const canViewAtemschutz = user?.groups?.some(g =>
|
||||
['dashboard_admin', 'dashboard_kommando', 'dashboard_atemschutz', 'dashboard_moderator'].includes(g)
|
||||
) ?? false;
|
||||
const [dataLoading, setDataLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -83,6 +86,7 @@ function Dashboard() {
|
||||
</Box>
|
||||
|
||||
{/* Atemschutz Status Card */}
|
||||
{canViewAtemschutz && (
|
||||
<Box>
|
||||
<Fade in={!dataLoading} timeout={600} style={{ transitionDelay: '400ms' }}>
|
||||
<Box>
|
||||
@@ -90,6 +94,7 @@ function Dashboard() {
|
||||
</Box>
|
||||
</Fade>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Upcoming Events Widget */}
|
||||
<Box>
|
||||
|
||||
@@ -1135,6 +1135,7 @@ export default function Kalender() {
|
||||
user?.groups?.some((g) => WRITE_GROUPS_EVENTS.includes(g)) ?? false;
|
||||
const canWriteBookings =
|
||||
user?.groups?.some((g) => WRITE_GROUPS_BOOKINGS.includes(g)) ?? false;
|
||||
const canCreateBookings = !!user;
|
||||
|
||||
// ── Tab ─────────────────────────────────────────────────────────────────────
|
||||
const [activeTab, setActiveTab] = useState(0);
|
||||
@@ -1386,7 +1387,7 @@ export default function Kalender() {
|
||||
};
|
||||
|
||||
const handleCellClick = (vehicleId: string, day: Date) => {
|
||||
if (!canWriteBookings) return;
|
||||
if (!canCreateBookings) return;
|
||||
setEditingBooking(null);
|
||||
setBookingForm({
|
||||
...EMPTY_BOOKING_FORM,
|
||||
@@ -1866,7 +1867,7 @@ export default function Kalender() {
|
||||
</Button>
|
||||
</Box>
|
||||
|
||||
{canWriteBookings && (
|
||||
{canCreateBookings && (
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<Add />}
|
||||
@@ -1952,9 +1953,9 @@ export default function Kalender() {
|
||||
}
|
||||
sx={{
|
||||
bgcolor: isFree ? 'success.50' : undefined,
|
||||
cursor: isFree && canWriteBookings ? 'pointer' : 'default',
|
||||
cursor: isFree && canCreateBookings ? 'pointer' : 'default',
|
||||
'&:hover':
|
||||
isFree && canWriteBookings
|
||||
isFree && canCreateBookings
|
||||
? { bgcolor: 'success.100' }
|
||||
: {},
|
||||
p: 0.5,
|
||||
@@ -2043,7 +2044,7 @@ export default function Kalender() {
|
||||
)}
|
||||
|
||||
{/* FAB */}
|
||||
{canWriteBookings && (
|
||||
{canCreateBookings && (
|
||||
<Fab
|
||||
color="primary"
|
||||
sx={{ position: 'fixed', bottom: 32, right: 32 }}
|
||||
|
||||
Reference in New Issue
Block a user