Skip to content

Commit 2a263b9

Browse files
authored
fix: always show add user button (#9229)
Fixes #9172 There is always at least one authentication method enabled (none), so we should remove the authMethod check to make sure that the button is always shown.
1 parent 4a9c773 commit 2a263b9

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

site/src/components/UsersLayout/UsersLayout.tsx

+10-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Link from "@mui/material/Link"
33
import { makeStyles } from "@mui/styles"
44
import GroupAdd from "@mui/icons-material/GroupAddOutlined"
55
import PersonAdd from "@mui/icons-material/PersonAddOutlined"
6-
import { useMachine } from "@xstate/react"
76
import { USERS_LINK } from "components/Navbar/NavbarView"
87
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader"
98
import { useFeatureVisibility } from "hooks/useFeatureVisibility"
@@ -16,15 +15,13 @@ import {
1615
useNavigate,
1716
} from "react-router-dom"
1817
import { combineClasses } from "utils/combineClasses"
19-
import { authMethodsXService } from "xServices/auth/authMethodsXService"
2018
import { Margins } from "../../components/Margins/Margins"
2119
import { Stack } from "../../components/Stack/Stack"
2220

2321
export const UsersLayout: FC = () => {
2422
const styles = useStyles()
2523
const { createUser: canCreateUser, createGroup: canCreateGroup } =
2624
usePermissions()
27-
const [authMethods] = useMachine(authMethodsXService)
2825
const navigate = useNavigate()
2926
const { template_rbac: isTemplateRBACEnabled } = useFeatureVisibility()
3027

@@ -34,17 +31,16 @@ export const UsersLayout: FC = () => {
3431
<PageHeader
3532
actions={
3633
<>
37-
{canCreateUser &&
38-
authMethods.context.authMethods?.password.enabled && (
39-
<Button
40-
onClick={() => {
41-
navigate("/users/create")
42-
}}
43-
startIcon={<PersonAdd />}
44-
>
45-
Create user
46-
</Button>
47-
)}
34+
{canCreateUser && (
35+
<Button
36+
onClick={() => {
37+
navigate("/users/create")
38+
}}
39+
startIcon={<PersonAdd />}
40+
>
41+
Create user
42+
</Button>
43+
)}
4844
{canCreateGroup && isTemplateRBACEnabled && (
4945
<Link component={RouterLink} to="/groups/create">
5046
<Button startIcon={<GroupAdd />}>Create group</Button>

0 commit comments

Comments
 (0)