2022-05-12 08:09:15 +00:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { PageSection } from "@patternfly/react-core";
|
2020-10-21 11:31:41 +00:00
|
|
|
|
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) => {
|
2023-09-08 13:17:17 +00:00
|
|
|
const { t } = useTranslation();
|
2023-11-28 13:07:11 +00:00
|
|
|
const permissionNeededArray = Array.isArray(permissionNeeded)
|
|
|
|
? permissionNeeded
|
|
|
|
: [permissionNeeded];
|
2022-05-12 08:09:15 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PageSection>
|
2023-11-28 13:07:11 +00:00
|
|
|
{t("forbidden", { count: permissionNeededArray.length })}{" "}
|
2024-05-07 20:34:06 +00:00
|
|
|
{permissionNeededArray.map((p) => p.toString()).join(", ")}
|
2022-05-12 08:09:15 +00:00
|
|
|
</PageSection>
|
|
|
|
);
|
2020-10-21 11:31:41 +00:00
|
|
|
};
|