keycloak-scim/src/ForbiddenSection.tsx

22 lines
600 B
TypeScript
Raw Normal View History

2022-05-12 08:09:15 +00:00
import { useTranslation } from "react-i18next";
import { PageSection } from "@patternfly/react-core";
2022-05-12 08:09:15 +00:00
import type { AccessType } from "@keycloak/keycloak-admin-client/lib/defs/whoAmIRepresentation";
type ForbiddenSectionProps = {
permissionNeeded: AccessType | AccessType[];
};
export const ForbiddenSection = ({
permissionNeeded,
}: ForbiddenSectionProps) => {
const { t } = useTranslation("common");
const count = Array.isArray(permissionNeeded) ? permissionNeeded.length : 1;
return (
<PageSection>
{t("forbidden", { count })} {permissionNeeded}
</PageSection>
);
};