@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
18 lines • 1.38 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { TextControl } from "../../ui-shared";
import { FixedButtonsGroup } from "../../components/form/FixedButtonGroup";
import { FormAccess } from "../../components/form/FormAccess";
import { useAccess } from "../../context/access/Access";
import { LoginSettings } from "../../clients/add/LoginSettings";
export const AccessSettings = ({ client, save, reset, }) => {
var _a, _b;
const { t } = useTranslation();
const { watch } = useFormContext();
const { hasAccess } = useAccess();
const isManager = hasAccess("manage-clients") || ((_a = client.access) === null || _a === void 0 ? void 0 : _a.configure);
const protocol = watch("protocol");
return (_jsxs(FormAccess, { isHorizontal: true, fineGrainedAccess: (_b = client.access) === null || _b === void 0 ? void 0 : _b.configure, role: "manage-clients", children: [!client.bearerOnly && _jsx(LoginSettings, { protocol: protocol }), protocol !== "saml" && (_jsx(TextControl, { type: "url", name: "adminUrl", label: t("adminURL"), labelIcon: t("adminURLHelp") })), client.bearerOnly && (_jsx(FixedButtonsGroup, { name: "settings", save: save, reset: reset, isDisabled: isManager }))] }));
};
//# sourceMappingURL=AccessSettings.js.map