rights system
This commit is contained in:
@@ -147,6 +147,17 @@ function PermissionMatrixTab() {
|
||||
onError: () => showError('Fehler beim Hinzufügen der Gruppe'),
|
||||
});
|
||||
|
||||
const deleteGroupMutation = useMutation({
|
||||
mutationFn: (groupName: string) => permissionsApi.deleteGroup(groupName),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-permission-matrix'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['admin-unknown-groups'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['my-permissions'] });
|
||||
showSuccess('Gruppe entfernt');
|
||||
},
|
||||
onError: () => showError('Fehler beim Entfernen der Gruppe'),
|
||||
});
|
||||
|
||||
const depConfigMutation = useMutation({
|
||||
mutationFn: (config: { groupHierarchy?: Record<string, string[]>; permissionDeps?: Record<string, string[]> }) =>
|
||||
permissionsApi.setDependencyConfig(config),
|
||||
@@ -362,7 +373,18 @@ function PermissionMatrixTab() {
|
||||
</Tooltip>
|
||||
{nonAdminGroups.map(g => (
|
||||
<TableCell key={g} align="center" sx={{ minWidth: 120, fontWeight: 'bold' }}>
|
||||
{g.replace('dashboard_', '')}
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 0.5 }}>
|
||||
{g.replace('dashboard_', '')}
|
||||
<Tooltip title={`Gruppe "${g}" entfernen`} placement="top">
|
||||
<IconButton size="small" onClick={() => {
|
||||
if (window.confirm(`Gruppe "${g}" und alle zugehörigen Berechtigungen wirklich entfernen?`)) {
|
||||
deleteGroupMutation.mutate(g);
|
||||
}
|
||||
}} sx={{ opacity: 0.4, '&:hover': { opacity: 1, color: 'error.main' } }}>
|
||||
<DeleteIcon sx={{ fontSize: 14 }} />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</Box>
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
|
||||
Reference in New Issue
Block a user