add FormAccess
This commit is contained in:
parent
707457f5a9
commit
76ff85f8d8
7 changed files with 42 additions and 74 deletions
|
@ -1,22 +1,20 @@
|
||||||
import { Form, FormGroup, Switch } from "@patternfly/react-core";
|
import { FormGroup, Switch } from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsAdvanced = () => {
|
export const LdapSettingsAdvanced = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const helpText = useTranslation("user-federation-help").t;
|
const helpText = useTranslation("user-federation-help").t;
|
||||||
|
|
||||||
const { handleSubmit, control } = useForm<ComponentRepresentation>();
|
const { control } = useForm<ComponentRepresentation>();
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("enableLdapv3Password")}
|
label={t("enableLdapv3Password")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -103,9 +101,7 @@ export const LdapSettingsAdvanced = () => {
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</FormAccess>
|
||||||
<button type="submit">Test submit</button>
|
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
Form,
|
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
|
@ -11,6 +10,7 @@ import React, { useState } from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsCache = () => {
|
export const LdapSettingsCache = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
|
@ -27,17 +27,11 @@ export const LdapSettingsCache = () => {
|
||||||
isEvictionMinuteDropdownOpen,
|
isEvictionMinuteDropdownOpen,
|
||||||
setIsEvictionMinuteDropdownOpen,
|
setIsEvictionMinuteDropdownOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
|
|
||||||
const [isEvictionDayDropdownOpen, setIsEvictionDayDropdownOpen] = useState(
|
const [isEvictionDayDropdownOpen, setIsEvictionDayDropdownOpen] = useState(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
const { handleSubmit, control, register } = useForm<
|
|
||||||
ComponentRepresentation
|
|
||||||
>();
|
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
const hourOptions = [
|
const hourOptions = [
|
||||||
<SelectOption key={0} value={t("common:selectOne")} isPlaceholder />,
|
<SelectOption key={0} value={t("common:selectOne")} isPlaceholder />,
|
||||||
];
|
];
|
||||||
|
@ -52,10 +46,12 @@ export const LdapSettingsCache = () => {
|
||||||
minuteOptions.push(<SelectOption key={index + 1} value={index} />);
|
minuteOptions.push(<SelectOption key={index + 1} value={index} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { control, register } = useForm<ComponentRepresentation>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Cache settings */}
|
{/* Cache settings */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("cachePolicy")}
|
label={t("cachePolicy")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -241,9 +237,7 @@ export const LdapSettingsCache = () => {
|
||||||
ref={register}
|
ref={register}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</FormAccess>
|
||||||
<button type="submit">Test submit</button>
|
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Form,
|
|
||||||
FormGroup,
|
FormGroup,
|
||||||
InputGroup,
|
InputGroup,
|
||||||
Select,
|
Select,
|
||||||
|
@ -15,6 +14,7 @@ import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
import { EyeIcon } from "@patternfly/react-icons";
|
import { EyeIcon } from "@patternfly/react-icons";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsConnection = () => {
|
export const LdapSettingsConnection = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
|
@ -24,18 +24,15 @@ export const LdapSettingsConnection = () => {
|
||||||
isTruststoreSpiDropdownOpen,
|
isTruststoreSpiDropdownOpen,
|
||||||
setIsTruststoreSpiDropdownOpen,
|
setIsTruststoreSpiDropdownOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
|
|
||||||
const [isBindTypeDropdownOpen, setIsBindTypeDropdownOpen] = useState(false);
|
const [isBindTypeDropdownOpen, setIsBindTypeDropdownOpen] = useState(false);
|
||||||
const { register, handleSubmit, control } = useForm<
|
|
||||||
ComponentRepresentation
|
const { register, control } = useForm<ComponentRepresentation>();
|
||||||
>();
|
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Cache settings */}
|
{/* Cache settings */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("connectionURL")}
|
label={t("connectionURL")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -249,9 +246,9 @@ export const LdapSettingsConnection = () => {
|
||||||
isRequired
|
isRequired
|
||||||
>
|
>
|
||||||
<InputGroup>
|
<InputGroup>
|
||||||
<TextInput // TODO: Make password field
|
<TextInput // TODO: Make password field switch to type=text with button
|
||||||
isRequired
|
isRequired
|
||||||
type="text"
|
type="password"
|
||||||
id="kc-console-bind-credentials"
|
id="kc-console-bind-credentials"
|
||||||
name="bindCredentials"
|
name="bindCredentials"
|
||||||
ref={register}
|
ref={register}
|
||||||
|
@ -266,13 +263,13 @@ export const LdapSettingsConnection = () => {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup fieldId="kc-test-button">
|
<FormGroup fieldId="kc-test-button">
|
||||||
|
{" "}
|
||||||
|
{/* TODO: whatever this button is supposed to do */}
|
||||||
<Button variant="secondary" id="kc-test-button">
|
<Button variant="secondary" id="kc-test-button">
|
||||||
Test
|
Test
|
||||||
</Button>
|
</Button>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</FormAccess>
|
||||||
<button type="submit">Test Submit</button>
|
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
Form,
|
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
|
@ -11,23 +10,20 @@ import React, { useState } from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsGeneral = () => {
|
export const LdapSettingsGeneral = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const helpText = useTranslation("user-federation-help").t;
|
const helpText = useTranslation("user-federation-help").t;
|
||||||
|
|
||||||
const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false);
|
const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false);
|
||||||
const { register, handleSubmit, control } = useForm<
|
|
||||||
ComponentRepresentation
|
const { register, control } = useForm<ComponentRepresentation>();
|
||||||
>();
|
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Cache settings */}
|
{/* Cache settings */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("consoleDisplayName")}
|
label={t("consoleDisplayName")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -90,8 +86,7 @@ export const LdapSettingsGeneral = () => {
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<button type="submit">Test submit</button>
|
</FormAccess>
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
import { Form, FormGroup, Switch } from "@patternfly/react-core";
|
import { FormGroup, Switch } from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsKerberosIntegration = () => {
|
export const LdapSettingsKerberosIntegration = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const helpText = useTranslation("user-federation-help").t;
|
const helpText = useTranslation("user-federation-help").t;
|
||||||
|
|
||||||
const { handleSubmit, control } = useForm<ComponentRepresentation>();
|
const { control } = useForm<ComponentRepresentation>();
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Kerberos integration */}
|
{/* Kerberos integration */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("allowKerberosAuthentication")}
|
label={t("allowKerberosAuthentication")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -75,9 +73,7 @@ export const LdapSettingsKerberosIntegration = () => {
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</FormAccess>
|
||||||
<button type="submit">Test submit</button>
|
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
Form,
|
|
||||||
FormGroup,
|
FormGroup,
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
|
@ -12,31 +11,29 @@ import React, { useState } from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsSearching = () => {
|
export const LdapSettingsSearching = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const helpText = useTranslation("user-federation-help").t;
|
const helpText = useTranslation("user-federation-help").t;
|
||||||
|
|
||||||
const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false);
|
const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
isUserLdapFilterModeDropdownOpen,
|
isUserLdapFilterModeDropdownOpen,
|
||||||
setIsUserLdapFilterModeDropdownOpen,
|
setIsUserLdapFilterModeDropdownOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
|
|
||||||
const [isSearchScopeDropdownOpen, setIsSearchScopeDropdownOpen] = useState(
|
const [isSearchScopeDropdownOpen, setIsSearchScopeDropdownOpen] = useState(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
const { register, handleSubmit, control } = useForm<
|
const { register, control } = useForm<ComponentRepresentation>();
|
||||||
ComponentRepresentation
|
|
||||||
>();
|
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Cache settings */}
|
{/* Cache settings */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("editMode")}
|
label={t("editMode")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -308,9 +305,7 @@ export const LdapSettingsSearching = () => {
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</FormAccess>
|
||||||
<button type="submit">Test Submit</button>
|
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,21 @@
|
||||||
import { Form, FormGroup, Switch, TextInput } from "@patternfly/react-core";
|
import { FormGroup, Switch, TextInput } from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { useForm, Controller } from "react-hook-form";
|
import { useForm, Controller } from "react-hook-form";
|
||||||
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation";
|
||||||
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
|
|
||||||
export const LdapSettingsSynchronization = () => {
|
export const LdapSettingsSynchronization = () => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const helpText = useTranslation("user-federation-help").t;
|
const helpText = useTranslation("user-federation-help").t;
|
||||||
|
|
||||||
const { register, handleSubmit, control } = useForm<
|
const { register, control } = useForm<ComponentRepresentation>();
|
||||||
ComponentRepresentation
|
|
||||||
>();
|
|
||||||
const onSubmit = (data: ComponentRepresentation) => {
|
|
||||||
console.log(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Synchronization settings */}
|
{/* Synchronization settings */}
|
||||||
<Form isHorizontal onSubmit={handleSubmit(onSubmit)}>
|
<FormAccess role="manage-realm" isHorizontal>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("importUsers")}
|
label={t("importUsers")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -121,8 +117,7 @@ export const LdapSettingsSynchronization = () => {
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<button type="submit">Test submit</button>
|
</FormAccess>
|
||||||
</Form>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue