User Spalte

This commit is contained in:
PxlLoewe
2025-07-21 18:56:58 -07:00
parent 6fbb8c49a8
commit ad1dfe9802

View File

@@ -34,6 +34,23 @@ const AdminUserPage = () => {
header: "Nachname", header: "Nachname",
accessorKey: "lastname", accessorKey: "lastname",
}, },
{
header: "Berechtigungen",
cell(props) {
if (props.row.original.permissions.length === 0) {
return <span className="text-gray-700">Keine</span>;
} else if (props.row.original.permissions.includes("ADMIN_USER_ADVANCED")) {
return <span className="text-primary">Admin</span>;
}
return (
<span className="text-secondary">
{props.row.original.permissions
.filter((p) => p === "PILOT" || p === "DISPO")
.join(", ")}
</span>
);
},
},
...(session?.user.permissions.includes("ADMIN_USER_ADVANCED") ...(session?.user.permissions.includes("ADMIN_USER_ADVANCED")
? [ ? [
{ {
@@ -55,8 +72,8 @@ const AdminUserPage = () => {
] as ColumnDef<User>[] ] as ColumnDef<User>[]
} // Define the columns for the user table } // Define the columns for the user table
leftOfSearch={ leftOfSearch={
<p className="text-2xl font-semibold text-left flex items-center gap-2"> <p className="flex items-center gap-2 text-left text-2xl font-semibold">
<User2 className="w-5 h-5" /> Benutzer <User2 className="h-5 w-5" /> Benutzer
</p> </p>
} }
/> />