feat: restrict patient deletion to admin users only
This commit is contained in:
@@ -89,6 +89,7 @@ export function PatientTable({
|
||||
}: PatientTableProps) {
|
||||
const { toast } = useToast();
|
||||
const { user } = useAuth();
|
||||
const isAdmin = user?.username === "admin";
|
||||
|
||||
const [currentPatient, setCurrentPatient] = useState<Patient | undefined>(
|
||||
undefined
|
||||
@@ -1075,13 +1076,13 @@ export function PatientTable({
|
||||
|
||||
<TableCell className="text-right">
|
||||
<div className="flex justify-end">
|
||||
{allowDelete && (
|
||||
{allowDelete && isAdmin && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
handleDeletePatient(patient);
|
||||
}}
|
||||
className="text-red-600 hover:text-red-900"
|
||||
aria-label="Delete Staff"
|
||||
aria-label="Delete Patient"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
title="Delete Patient"
|
||||
|
||||
Reference in New Issue
Block a user