+ ];
+
+ if (!canEdit && !canDelete) return columns;
+
+ columns.push({
+ id: 'actions',
+ header: () =>
Actions
,
+ cell: ({ row }) => {
+ const user = row.original;
+ return (
+
+ {canEdit ? (
+ ) : null}
+ {canDelete ? (
{user.effective_status === 'active' ? 'Deactivate' : 'Activate'}
-
- );
- },
+ ) : null}
+
+ );
},
- ],
- [onEdit, onToggleStatus, pendingUserId],
- );
+ });
+
+ return columns;
+ }, [canDelete, canEdit, onEdit, onToggleStatus, pendingUserId]);
}
diff --git a/src/app/(modules)/users/page.tsx b/src/app/(modules)/users/page.tsx
index 3e4a686..20bedb7 100644
--- a/src/app/(modules)/users/page.tsx
+++ b/src/app/(modules)/users/page.tsx
@@ -6,6 +6,8 @@ import { Plus, Users } from 'lucide-react';
import { PageHeader } from '@/components/page-header';
import { PoweredBy } from '@/components/powered-by';
import { Button } from '@/components/ui/button';
+import { PERMISSIONS } from '@/constants/permissions';
+import { PermissionGuard } from '@/guards';
import type { AdministrationUser } from '@/types';
import { useUserColumns } from './components/UserColumns';
@@ -103,10 +105,12 @@ export default function UsersPage() {
description="Manage users and role assignment"
icon={Users}
actions={
-