diff --git a/src/modules/users/table-cells/UserStatusCell.tsx b/src/modules/users/table-cells/UserStatusCell.tsx index a6a3824d4..5d8443570 100644 --- a/src/modules/users/table-cells/UserStatusCell.tsx +++ b/src/modules/users/table-cells/UserStatusCell.tsx @@ -4,16 +4,24 @@ import { cn } from "@utils/helpers"; import { ExternalLinkIcon, HelpCircle } from "lucide-react"; import React from "react"; import { User } from "@/interfaces/User"; +import { useAccount } from "@/modules/account/useAccount"; type Props = { user: User; }; export default function UserStatusCell({ user }: Readonly) { + const account = useAccount(); const status = user.status; const isPendingApproval = user.pending_approval; + const isLocalAuthDisabled = + account?.settings?.local_auth_disabled === true && + user.idp_id === "local"; const getStatusDisplay = () => { + if (isLocalAuthDisabled) { + return { text: "Disabled", color: "bg-gray-400" }; + } if (isPendingApproval) { return { text: "Pending Approval", color: "bg-netbird" }; } @@ -29,43 +37,63 @@ export default function UserStatusCell({ user }: Readonly) { return { text: status || "Unknown", color: "bg-gray-400" }; }; + const tooltipContent = isLocalAuthDisabled ? ( +
+
+ Local authentication is disabled. This user can no longer log in. + Use your IdP for authentication. +
+
+ + Learn more + +
+
+ ) : ( +
+
+ This user needs to be approved by an administrator before it can + join your organization. +
+ +
+ If you want to disable approval for new users, go to{" "} + + Settings + {" "} + and disable{" "} + + {"'User Approval Required'"} + + . +
+
+ Learn more about{" "} + + User Approval + +
+
+ ); + + const showTooltip = isLocalAuthDisabled || isPendingApproval; const { text, color } = getStatusDisplay(); return (
e.stopPropagation()}> -
- This user needs to be approved by an administrator before it can - join your organization. -
- -
- If you want to disable approval for new users, go to{" "} - - Settings - {" "} - and disable{" "} - - {"'User Approval Required'"} - - . -
-
- Learn more about{" "} - - User Approval - -
-
- } + content={tooltipContent} interactive={true} side="right" - disabled={!isPendingApproval} + disabled={!showTooltip} >
) { > {text} - {isPendingApproval && ( + {showTooltip && ( )}