2021-04-29 06:28:59 +00:00
|
|
|
import React, { useState } from "react";
|
2021-03-03 13:53:42 +00:00
|
|
|
import {
|
|
|
|
ActionGroup,
|
2021-04-20 12:22:36 +00:00
|
|
|
AlertVariant,
|
2021-03-03 13:53:42 +00:00
|
|
|
Button,
|
2021-04-16 20:15:02 +00:00
|
|
|
Chip,
|
|
|
|
ChipGroup,
|
2021-03-03 13:53:42 +00:00
|
|
|
FormGroup,
|
2021-04-16 20:15:02 +00:00
|
|
|
InputGroup,
|
2021-03-03 18:56:03 +00:00
|
|
|
Select,
|
|
|
|
SelectOption,
|
|
|
|
Switch,
|
2021-03-03 13:53:42 +00:00
|
|
|
TextInput,
|
|
|
|
} from "@patternfly/react-core";
|
|
|
|
import { useTranslation } from "react-i18next";
|
2021-03-03 18:56:03 +00:00
|
|
|
import { Controller, UseFormMethods } from "react-hook-form";
|
2021-03-11 20:23:08 +00:00
|
|
|
import { useHistory, useParams } from "react-router-dom";
|
2021-03-03 13:53:42 +00:00
|
|
|
import { FormAccess } from "../components/form-access/FormAccess";
|
2021-05-04 17:58:18 +00:00
|
|
|
import type UserRepresentation from "keycloak-admin/lib/defs/userRepresentation";
|
2021-03-03 18:56:03 +00:00
|
|
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
|
|
|
import { useRealm } from "../context/realm-context/RealmContext";
|
2021-04-29 06:28:59 +00:00
|
|
|
import { useFetch, useAdminClient } from "../context/auth/AdminClient";
|
2021-03-11 20:23:08 +00:00
|
|
|
import moment from "moment";
|
2021-05-04 17:58:18 +00:00
|
|
|
import type GroupRepresentation from "keycloak-admin/lib/defs/groupRepresentation";
|
2021-04-20 12:22:36 +00:00
|
|
|
import { useAlerts } from "../components/alert/Alerts";
|
2021-05-03 20:00:12 +00:00
|
|
|
import { emailRegexPattern } from "../util";
|
2021-06-16 11:35:03 +00:00
|
|
|
import { GroupPickerDialog } from "../components/group/GroupPickerDialog";
|
2021-03-03 13:53:42 +00:00
|
|
|
|
|
|
|
export type UserFormProps = {
|
|
|
|
form: UseFormMethods<UserRepresentation>;
|
|
|
|
save: (user: UserRepresentation) => void;
|
2021-03-11 20:23:08 +00:00
|
|
|
editMode: boolean;
|
|
|
|
timestamp?: number;
|
2021-04-20 12:22:36 +00:00
|
|
|
onGroupsUpdate: (groups: GroupRepresentation[]) => void;
|
2021-03-03 13:53:42 +00:00
|
|
|
};
|
|
|
|
|
2021-03-03 21:17:01 +00:00
|
|
|
export const UserForm = ({
|
2021-03-11 20:23:08 +00:00
|
|
|
form: { handleSubmit, register, errors, watch, control, setValue, reset },
|
2021-03-03 21:17:01 +00:00
|
|
|
save,
|
2021-03-11 20:23:08 +00:00
|
|
|
editMode,
|
2021-04-20 12:22:36 +00:00
|
|
|
onGroupsUpdate,
|
2021-03-03 21:17:01 +00:00
|
|
|
}: UserFormProps) => {
|
2021-03-03 13:53:42 +00:00
|
|
|
const { t } = useTranslation("users");
|
2021-03-03 18:56:03 +00:00
|
|
|
const { realm } = useRealm();
|
|
|
|
|
|
|
|
const [
|
|
|
|
isRequiredUserActionsDropdownOpen,
|
|
|
|
setRequiredUserActionsDropdownOpen,
|
|
|
|
] = useState(false);
|
|
|
|
const history = useHistory();
|
2021-03-11 20:23:08 +00:00
|
|
|
const adminClient = useAdminClient();
|
|
|
|
const { id } = useParams<{ id: string }>();
|
2021-03-03 18:56:03 +00:00
|
|
|
|
2021-03-03 21:17:01 +00:00
|
|
|
const watchUsernameInput = watch("username");
|
2021-06-16 11:35:03 +00:00
|
|
|
const [user, setUser] = useState<UserRepresentation>();
|
2021-04-20 12:22:36 +00:00
|
|
|
const [selectedGroups, setSelectedGroups] = useState<GroupRepresentation[]>(
|
|
|
|
[]
|
|
|
|
);
|
|
|
|
|
|
|
|
const { addAlert } = useAlerts();
|
2021-04-16 20:15:02 +00:00
|
|
|
|
|
|
|
const [open, setOpen] = useState(false);
|
2021-03-11 20:23:08 +00:00
|
|
|
|
2021-04-29 06:28:59 +00:00
|
|
|
useFetch(
|
|
|
|
async () => {
|
|
|
|
if (editMode) return await adminClient.users.findOne({ id: id });
|
|
|
|
},
|
|
|
|
(user) => {
|
2021-06-16 11:35:03 +00:00
|
|
|
if (user) {
|
|
|
|
setupForm(user);
|
|
|
|
setUser(user);
|
|
|
|
}
|
2021-04-29 06:28:59 +00:00
|
|
|
},
|
2021-06-16 11:35:03 +00:00
|
|
|
[selectedGroups]
|
2021-04-29 06:28:59 +00:00
|
|
|
);
|
2021-03-11 20:23:08 +00:00
|
|
|
|
|
|
|
const setupForm = (user: UserRepresentation) => {
|
|
|
|
reset();
|
|
|
|
Object.entries(user).map((entry) => {
|
2021-06-16 11:35:03 +00:00
|
|
|
setValue(entry[0], entry[1]);
|
2021-03-11 20:23:08 +00:00
|
|
|
});
|
|
|
|
};
|
2021-03-03 21:17:01 +00:00
|
|
|
|
2021-03-03 18:56:03 +00:00
|
|
|
const requiredUserActionsOptions = [
|
2021-03-11 20:23:08 +00:00
|
|
|
<SelectOption key={0} value="CONFIGURE_TOTP">
|
2021-03-03 18:56:03 +00:00
|
|
|
{t("configureOTP")}
|
|
|
|
</SelectOption>,
|
2021-03-11 20:23:08 +00:00
|
|
|
<SelectOption key={1} value="UPDATE_PASSWORD">
|
2021-03-03 18:56:03 +00:00
|
|
|
{t("updatePassword")}
|
|
|
|
</SelectOption>,
|
2021-03-11 20:23:08 +00:00
|
|
|
<SelectOption key={2} value="UPDATE_PROFILE">
|
2021-03-03 18:56:03 +00:00
|
|
|
{t("updateProfile")}
|
|
|
|
</SelectOption>,
|
2021-03-11 20:23:08 +00:00
|
|
|
<SelectOption key={3} value="VERIFY_EMAIL">
|
2021-03-03 18:56:03 +00:00
|
|
|
{t("verifyEmail")}
|
|
|
|
</SelectOption>,
|
|
|
|
];
|
|
|
|
|
|
|
|
const clearSelection = () => {
|
|
|
|
setRequiredUserActionsDropdownOpen(false);
|
|
|
|
};
|
|
|
|
|
2021-04-16 20:15:02 +00:00
|
|
|
const deleteItem = (id: string) => {
|
2021-06-16 11:35:03 +00:00
|
|
|
setSelectedGroups(selectedGroups.filter((item) => item.name !== id));
|
2021-04-20 12:22:36 +00:00
|
|
|
onGroupsUpdate(selectedGroups);
|
2021-04-16 20:15:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const addChips = async (groups: GroupRepresentation[]): Promise<void> => {
|
2021-06-16 11:35:03 +00:00
|
|
|
setSelectedGroups([...selectedGroups!, ...groups]);
|
|
|
|
onGroupsUpdate([...selectedGroups!, ...groups]);
|
2021-04-16 20:15:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const addGroups = async (groups: GroupRepresentation[]): Promise<void> => {
|
|
|
|
const newGroups = groups;
|
|
|
|
|
|
|
|
newGroups.forEach(async (group) => {
|
|
|
|
try {
|
|
|
|
await adminClient.users.addToGroup({
|
2021-06-16 11:35:03 +00:00
|
|
|
id,
|
2021-04-16 20:15:02 +00:00
|
|
|
groupId: group.id!,
|
|
|
|
});
|
2021-04-20 12:22:36 +00:00
|
|
|
addAlert(t("users:addedGroupMembership"), AlertVariant.success);
|
2021-04-16 20:15:02 +00:00
|
|
|
} catch (error) {
|
2021-04-20 12:22:36 +00:00
|
|
|
addAlert(
|
|
|
|
t("users:addedGroupMembershipError", { error }),
|
|
|
|
AlertVariant.danger
|
|
|
|
);
|
2021-04-16 20:15:02 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const toggleModal = () => {
|
|
|
|
setOpen(!open);
|
|
|
|
};
|
|
|
|
|
2021-03-03 13:53:42 +00:00
|
|
|
return (
|
|
|
|
<FormAccess
|
|
|
|
isHorizontal
|
2021-03-03 21:17:01 +00:00
|
|
|
onSubmit={handleSubmit(save)}
|
2021-03-03 18:56:03 +00:00
|
|
|
role="manage-users"
|
2021-03-03 13:53:42 +00:00
|
|
|
className="pf-u-mt-lg"
|
|
|
|
>
|
2021-04-16 20:15:02 +00:00
|
|
|
{open && (
|
2021-06-16 11:35:03 +00:00
|
|
|
<GroupPickerDialog
|
|
|
|
type="selectMany"
|
|
|
|
text={{
|
|
|
|
title: "users:selectGroups",
|
|
|
|
ok: "users:join",
|
|
|
|
}}
|
|
|
|
onConfirm={(groups) => {
|
|
|
|
editMode ? addGroups(groups) : addChips(groups);
|
|
|
|
setOpen(false);
|
|
|
|
}}
|
|
|
|
onClose={() => setOpen(false)}
|
|
|
|
filterGroups={selectedGroups.map((g) => g.name!)}
|
2021-04-16 20:15:02 +00:00
|
|
|
/>
|
|
|
|
)}
|
2021-06-16 11:35:03 +00:00
|
|
|
{editMode && user ? (
|
2021-03-11 20:23:08 +00:00
|
|
|
<>
|
2021-06-16 11:35:03 +00:00
|
|
|
<FormGroup label={t("common:id")} fieldId="kc-id" isRequired>
|
|
|
|
<TextInput id={user.id} value={user.id} type="text" isReadOnly />
|
2021-03-11 20:23:08 +00:00
|
|
|
</FormGroup>
|
2021-06-16 11:35:03 +00:00
|
|
|
<FormGroup label={t("createdAt")} fieldId="kc-created-at" isRequired>
|
2021-03-11 20:23:08 +00:00
|
|
|
<TextInput
|
2021-06-16 11:35:03 +00:00
|
|
|
value={moment(user.createdTimestamp).format(
|
|
|
|
"MM/DD/YY hh:MM:ss A"
|
|
|
|
)}
|
2021-03-11 20:23:08 +00:00
|
|
|
type="text"
|
|
|
|
id="kc-created-at"
|
|
|
|
name="createdTimestamp"
|
2021-06-16 11:35:03 +00:00
|
|
|
isReadOnly
|
2021-03-11 20:23:08 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<FormGroup
|
|
|
|
label={t("username")}
|
|
|
|
fieldId="kc-username"
|
|
|
|
isRequired
|
|
|
|
validated={errors.username ? "error" : "default"}
|
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
>
|
|
|
|
<TextInput
|
|
|
|
ref={register()}
|
|
|
|
type="text"
|
|
|
|
id="kc-username"
|
|
|
|
name="username"
|
|
|
|
isReadOnly={editMode}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
)}
|
2021-03-03 13:53:42 +00:00
|
|
|
<FormGroup
|
2021-03-03 18:56:03 +00:00
|
|
|
label={t("email")}
|
2021-03-03 13:53:42 +00:00
|
|
|
fieldId="kc-description"
|
2021-03-03 21:17:01 +00:00
|
|
|
validated={errors.email ? "error" : "default"}
|
2021-03-04 18:49:05 +00:00
|
|
|
helperTextInvalid={t("users:emailInvalid")}
|
2021-03-03 18:56:03 +00:00
|
|
|
>
|
|
|
|
<TextInput
|
2021-03-04 18:49:05 +00:00
|
|
|
ref={register({
|
|
|
|
pattern: emailRegexPattern,
|
|
|
|
})}
|
|
|
|
type="email"
|
2021-03-03 18:56:03 +00:00
|
|
|
id="kc-email"
|
|
|
|
name="email"
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="email-input"
|
2021-03-03 19:36:21 +00:00
|
|
|
aria-label={t("emailInput")}
|
2021-03-03 18:56:03 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("emailVerified")}
|
|
|
|
fieldId="kc-email-verified"
|
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-06-16 11:35:03 +00:00
|
|
|
helpText="users-help:emailVerified"
|
2021-03-03 18:56:03 +00:00
|
|
|
forLabel={t("emailVerified")}
|
|
|
|
forID="email-verified"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
2021-03-11 20:23:08 +00:00
|
|
|
name="emailVerified"
|
2021-03-03 18:56:03 +00:00
|
|
|
defaultValue={false}
|
2021-03-03 21:17:01 +00:00
|
|
|
control={control}
|
2021-03-03 18:56:03 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="email-verified-switch"
|
2021-03-03 18:56:03 +00:00
|
|
|
id={"kc-user-email-verified"}
|
|
|
|
isDisabled={false}
|
2021-03-11 20:23:08 +00:00
|
|
|
onChange={(value) => onChange(value)}
|
|
|
|
isChecked={value}
|
2021-03-03 18:56:03 +00:00
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
/>
|
|
|
|
)}
|
2021-06-16 11:35:03 +00:00
|
|
|
/>
|
2021-03-03 18:56:03 +00:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("firstName")}
|
|
|
|
fieldId="kc-firstname"
|
2021-03-03 21:17:01 +00:00
|
|
|
validated={errors.firstName ? "error" : "default"}
|
2021-03-03 18:56:03 +00:00
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
>
|
|
|
|
<TextInput
|
2021-03-03 21:17:01 +00:00
|
|
|
ref={register()}
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="firstName-input"
|
2021-03-03 18:56:03 +00:00
|
|
|
type="text"
|
|
|
|
id="kc-firstname"
|
2021-03-04 18:49:05 +00:00
|
|
|
name="firstName"
|
2021-03-03 18:56:03 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("lastName")}
|
|
|
|
fieldId="kc-name"
|
2021-03-03 21:17:01 +00:00
|
|
|
validated={errors.lastName ? "error" : "default"}
|
2021-03-03 13:53:42 +00:00
|
|
|
>
|
2021-03-03 18:56:03 +00:00
|
|
|
<TextInput
|
2021-03-03 21:17:01 +00:00
|
|
|
ref={register()}
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="lastName-input"
|
2021-03-03 13:53:42 +00:00
|
|
|
type="text"
|
2021-03-03 18:56:03 +00:00
|
|
|
id="kc-lastname"
|
2021-03-04 18:49:05 +00:00
|
|
|
name="lastName"
|
2021-03-03 19:36:21 +00:00
|
|
|
aria-label={t("lastName")}
|
2021-03-03 13:53:42 +00:00
|
|
|
/>
|
|
|
|
</FormGroup>
|
2021-03-03 18:56:03 +00:00
|
|
|
<FormGroup
|
|
|
|
label={t("common:enabled")}
|
|
|
|
fieldId="kc-enabled"
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-06-16 11:35:03 +00:00
|
|
|
helpText="users-help:disabled"
|
2021-03-03 18:56:03 +00:00
|
|
|
forLabel={t("enabled")}
|
|
|
|
forID="enabled-label"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
2021-03-11 20:23:08 +00:00
|
|
|
name="enabled"
|
2021-06-16 11:35:03 +00:00
|
|
|
defaultValue={true}
|
2021-03-03 21:17:01 +00:00
|
|
|
control={control}
|
2021-03-03 18:56:03 +00:00
|
|
|
render={({ onChange, value }) => (
|
|
|
|
<Switch
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="user-enabled-switch"
|
2021-03-03 18:56:03 +00:00
|
|
|
id={"kc-user-enabled"}
|
2021-03-11 20:23:08 +00:00
|
|
|
onChange={(value) => onChange(value)}
|
|
|
|
isChecked={value}
|
2021-03-03 18:56:03 +00:00
|
|
|
label={t("common:on")}
|
|
|
|
labelOff={t("common:off")}
|
|
|
|
/>
|
|
|
|
)}
|
2021-06-16 11:35:03 +00:00
|
|
|
/>
|
2021-03-03 18:56:03 +00:00
|
|
|
</FormGroup>
|
|
|
|
<FormGroup
|
|
|
|
label={t("requiredUserActions")}
|
|
|
|
fieldId="kc-required-user-actions"
|
2021-03-03 21:17:01 +00:00
|
|
|
validated={errors.requiredActions ? "error" : "default"}
|
2021-03-03 18:56:03 +00:00
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-06-16 11:35:03 +00:00
|
|
|
helpText="users-help:requiredUserActions"
|
2021-03-03 18:56:03 +00:00
|
|
|
forLabel={t("requiredUserActions")}
|
|
|
|
forID="required-user-actions-label"
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
2021-03-11 20:23:08 +00:00
|
|
|
name="requiredActions"
|
|
|
|
defaultValue={[]}
|
2021-03-03 18:56:03 +00:00
|
|
|
typeAheadAriaLabel="Select an action"
|
2021-03-03 21:17:01 +00:00
|
|
|
control={control}
|
2021-03-11 20:23:08 +00:00
|
|
|
render={({ onChange, value }) => (
|
2021-03-03 18:56:03 +00:00
|
|
|
<Select
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid="required-actions-select"
|
2021-03-03 18:56:03 +00:00
|
|
|
placeholderText="Select action"
|
|
|
|
toggleId="kc-required-user-actions"
|
|
|
|
onToggle={() =>
|
|
|
|
setRequiredUserActionsDropdownOpen(
|
|
|
|
!isRequiredUserActionsDropdownOpen
|
|
|
|
)
|
|
|
|
}
|
|
|
|
isOpen={isRequiredUserActionsDropdownOpen}
|
2021-03-11 20:23:08 +00:00
|
|
|
selections={value}
|
|
|
|
onSelect={(_, v) => {
|
|
|
|
const option = v as string;
|
|
|
|
if (value.includes(option)) {
|
|
|
|
onChange(value.filter((item: string) => item !== option));
|
2021-03-03 18:56:03 +00:00
|
|
|
} else {
|
2021-03-11 20:23:08 +00:00
|
|
|
onChange([...value, option]);
|
2021-03-03 18:56:03 +00:00
|
|
|
}
|
|
|
|
}}
|
|
|
|
onClear={clearSelection}
|
|
|
|
variant="typeaheadmulti"
|
|
|
|
>
|
|
|
|
{requiredUserActionsOptions}
|
|
|
|
</Select>
|
|
|
|
)}
|
2021-03-11 20:23:08 +00:00
|
|
|
/>
|
2021-03-03 18:56:03 +00:00
|
|
|
</FormGroup>
|
2021-04-16 20:15:02 +00:00
|
|
|
{!editMode && (
|
|
|
|
<FormGroup
|
|
|
|
label={t("common:groups")}
|
|
|
|
fieldId="kc-groups"
|
|
|
|
validated={errors.requiredActions ? "error" : "default"}
|
|
|
|
helperTextInvalid={t("common:required")}
|
|
|
|
labelIcon={
|
|
|
|
<HelpItem
|
2021-06-16 11:35:03 +00:00
|
|
|
helpText="users-help:groups"
|
|
|
|
forLabel={t("common:groups")}
|
|
|
|
forID="kc-join-groups-button"
|
2021-04-16 20:15:02 +00:00
|
|
|
/>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Controller
|
|
|
|
name="groups"
|
|
|
|
defaultValue={[]}
|
|
|
|
typeAheadAriaLabel="Select an action"
|
|
|
|
control={control}
|
|
|
|
render={() => (
|
|
|
|
<>
|
|
|
|
<InputGroup>
|
2021-04-20 12:22:36 +00:00
|
|
|
<ChipGroup categoryName={" "}>
|
2021-06-16 11:35:03 +00:00
|
|
|
{selectedGroups.map((currentChip) => (
|
2021-04-16 20:15:02 +00:00
|
|
|
<Chip
|
2021-06-16 11:35:03 +00:00
|
|
|
key={currentChip.id}
|
|
|
|
onClick={() => deleteItem(currentChip.name!)}
|
2021-04-16 20:15:02 +00:00
|
|
|
>
|
2021-06-16 11:35:03 +00:00
|
|
|
{currentChip.path}
|
2021-04-16 20:15:02 +00:00
|
|
|
</Chip>
|
|
|
|
))}
|
|
|
|
</ChipGroup>
|
|
|
|
<Button
|
|
|
|
id="kc-join-groups-button"
|
|
|
|
onClick={toggleModal}
|
|
|
|
variant="secondary"
|
2021-04-20 12:22:36 +00:00
|
|
|
data-testid="join-groups-button"
|
2021-04-16 20:15:02 +00:00
|
|
|
>
|
|
|
|
{t("users:joinGroups")}
|
|
|
|
</Button>
|
|
|
|
</InputGroup>
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
)}
|
|
|
|
|
2021-03-03 13:53:42 +00:00
|
|
|
<ActionGroup>
|
2021-03-03 21:17:01 +00:00
|
|
|
<Button
|
2021-03-11 20:23:08 +00:00
|
|
|
data-testid={!editMode ? "create-user" : "save-user"}
|
|
|
|
isDisabled={!editMode && !watchUsernameInput}
|
2021-03-03 21:17:01 +00:00
|
|
|
variant="primary"
|
|
|
|
type="submit"
|
|
|
|
>
|
2021-06-16 11:35:03 +00:00
|
|
|
{editMode ? t("common:save") : t("common:create")}
|
2021-03-03 13:53:42 +00:00
|
|
|
</Button>
|
2021-03-03 19:12:16 +00:00
|
|
|
<Button
|
|
|
|
data-testid="cancel-create-user"
|
2021-06-16 11:35:03 +00:00
|
|
|
onClick={() =>
|
|
|
|
editMode ? setupForm(user!) : history.push(`/${realm}/users`)
|
|
|
|
}
|
2021-03-03 19:12:16 +00:00
|
|
|
variant="link"
|
|
|
|
>
|
2021-06-16 11:35:03 +00:00
|
|
|
{editMode ? t("common:revert") : t("common:cancel")}
|
2021-03-03 13:53:42 +00:00
|
|
|
</Button>
|
|
|
|
</ActionGroup>
|
|
|
|
</FormAccess>
|
|
|
|
);
|
|
|
|
};
|