Skip to content

Commit

Permalink
Only allow admins/owners to toggle 2FA
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield committed Dec 5, 2024
1 parent e2dd5cf commit 7c1e2af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/scenes/settings/organization/Members.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LemonInput, LemonModal, LemonSwitch } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { PayGateMini } from 'lib/components/PayGateMini/PayGateMini'
import { useRestrictedArea } from 'lib/components/RestrictedArea'
import { TZLabel } from 'lib/components/TZLabel'
import { OrganizationMembershipLevel } from 'lib/constants'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
Expand Down Expand Up @@ -145,6 +146,8 @@ export function Members(): JSX.Element | null {
const { preflight } = useValues(preflightLogic)
const { user } = useValues(userLogic)

const twoFactorRestrictionReason = useRestrictedArea({ minimumAccessLevel: OrganizationMembershipLevel.Admin })

useEffect(() => {
ensureAllMembersLoaded()
}, [])
Expand Down Expand Up @@ -300,6 +303,7 @@ export function Members(): JSX.Element | null {
bordered
checked={!!currentOrganization?.enforce_2fa}
onChange={(enforce_2fa) => updateOrganization({ enforce_2fa })}
disabledReason={twoFactorRestrictionReason}
/>
</PayGateMini>
</>
Expand Down

0 comments on commit 7c1e2af

Please sign in to comment.