diff --git a/src/components/superadmin/UsersTable.tsx b/src/components/superadmin/UsersTable.tsx index d64f83e..6117403 100644 --- a/src/components/superadmin/UsersTable.tsx +++ b/src/components/superadmin/UsersTable.tsx @@ -30,7 +30,10 @@ import { useAppTheme } from "@/hooks/useAppTheme"; import { usePermissions } from "@/hooks/usePermissions"; // Helper function to get user initials -const getUserInitials = (firstName: string | null | undefined, lastName: string | null | undefined): string => { +const getUserInitials = ( + firstName: string | null | undefined, + lastName: string | null | undefined, +): string => { const first = (firstName || "").trim().slice(0, 1); const last = (lastName || "").trim().slice(0, 1); return `${first}${last}`.toUpperCase() || "?"; @@ -69,9 +72,9 @@ interface UsersTableProps { export const UsersTable = forwardRef( ({ tenantId, showHeader = true, compact = false }, ref): ReactElement => { - const { canUpdate } = usePermissions(); + const { canUpdate, canRead, canCreate } = usePermissions(); const { primaryColor } = useAppTheme(); - const { canCreate } = usePermissions(); + // const { canCreate } = usePermissions(); const [users, setUsers] = useState([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); @@ -579,22 +582,26 @@ export const UsersTable = forwardRef( }} placeholder="All" /> - ({ - value: role.id, - label: role.name, - })), - ]} - value={roleFilter || ""} - onChange={(value) => { - setRoleFilter(Array.isArray(value) ? null : value || null); - setCurrentPage(1); - }} - placeholder="All" - /> + {canRead("roles") && ( + ({ + value: role.id, + label: role.name, + })), + ]} + value={roleFilter || ""} + onChange={(value) => { + setRoleFilter( + Array.isArray(value) ? null : value || null, + ); + setCurrentPage(1); + }} + placeholder="All" + /> + )} {canCreate("users") && (