8000
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package org.keycloak.representations.idm; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Request body for inviting an existing user to an organization by user ID. | ||
| */ | ||
| public class OrganizationInvitationExistingUserRequest { | ||
|
|
||
| private String id; | ||
| private Map<String, List<String>> attributes; | ||
|
|
||
| public OrganizationInvitationExistingUserRequest() { | ||
| } | ||
|
|
||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(String id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Map<String, List<String>> getAttributes() { | ||
| return attributes; | ||
| } | ||
|
|
||
| public void setAttributes(Map<String, List<String>> attributes) { | ||
| this.attributes = attributes; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| package org.keycloak.representations.idm; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * Request body for inviting a new or existing user to an organization by email. | ||
| */ | ||
| public class OrganizationInvitationUserRequest { | ||
|
|
||
| private String email; | ||
| private String firstName; | ||
| private String lastName; | ||
| private Map<String, List<String>> attributes; | ||
|
|
||
| public OrganizationInvitationUserRequest() { | ||
| } | ||
|
|
||
| public String getEmail() { | ||
| return email; | ||
| } | ||
|
|
||
| public void setEmail(String email) { | ||
| this.email = email; | ||
| } | ||
|
|
||
| public String getFirstName() { | ||
| return firstName; | ||
| } | ||
|
|
||
| public void setFirstName(String firstName) { | ||
| this.firstName = firstName; | ||
| } | ||
|
|
||
| public String getLastName() { | ||
| return lastName; | ||
| } | ||
|
|
||
| public void setLastName(String lastName) { | ||
| this.lastName = lastName; | ||
| } | ||
|
|
||
| public Map<String, List<String>> getAttributes() { | ||
| return attributes; | ||
| } | ||
|
|
||
| public void setAttributes(Map<String, List<String>> attributes) { | ||
| this.attributes = attributes; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { Button, Form, Modal, ModalVariant } from "@patternfly/react-core"; | ||
| import { FormProvider, useForm } from "react-hook-form"; | ||
| import { useTranslation } from "react-i18next"; | ||
| import { KeyValueInput } from "../components/key-value-form/KeyValueInput"; | ||
| import { | ||
| KeyValueType, | ||
| keyValueToArray, | ||
| } from "../components/key-value-form/key-value-convert"; | ||
|
|
||
| type InvitationAttributesModalProps = { | ||
| onSubmit: (attributes: Record<string, string[]>) => Promise<void>; | ||
| onClose: () => void; | ||
| }; | ||
|
|
||
| type InvitationAttributesForm = { | ||
| attributes: KeyValueType[]; | ||
| }; | ||
|
|
||
| export const InvitationAttributesModal = ({ | ||
| onSubmit, | ||
| onClose, | ||
| }: InvitationAttributesModalProps) => { | ||
| const { t } = useTranslation(); | ||
| const form = useForm<InvitationAttributesForm>(); | ||
| const { | ||
| handleSubmit, | ||
| formState: { isSubmitting }, | ||
| } = form; | ||
|
|
||
| const submitForm = async (data: InvitationAttributesForm) => { | ||
| const attributes = keyValueToArray(data.attributes); | ||
| await onSubmit(attributes); | ||
| }; | ||
|
|
||
| return ( | ||
| <Modal | ||
| variant={ModalVariant.small} | ||
| title={t("invitationAttributes")} | ||
| isOpen | ||
| > | ||
| actions={[ | ||
| <Button | ||
| data-testid="send" | ||
| key="confirm" | ||
| variant="primary" | ||
| > | ||
| isDisabled={isSubmitting} | ||
| isLoading={isSubmitting} | ||
| > | ||
| {t("send")} | ||
| </Button>, | ||
| <Button | ||
| data-testid="cancel" | ||
| key="cancel" | ||
| variant="link" | ||
| > | ||
| > | ||
| {t("cancel")} | ||
| </Button>, | ||
| ]} | ||
| > | ||
| <FormProvider {...form}> | ||
| <Form id="invitation-attributes-form"> | ||
| <KeyValueInput name="attributes" /> | ||
| </Form> | ||
| </FormProvider> | ||
| </Modal> | ||
| ); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.