Issue 2618 (#2623)
This commit is contained in:
parent
18c610d12e
commit
bb853874d8
3 changed files with 23 additions and 4 deletions
|
@ -201,5 +201,7 @@
|
|||
"password": "Password",
|
||||
"passwordConfirmation": "Password confirmation",
|
||||
"temporaryPassword": "Temporary",
|
||||
"temporaryPasswordHelpText": "If enabled, the user must change the password on next login"
|
||||
"temporaryPasswordHelpText": "If enabled, the user must change the password on next login",
|
||||
"forbidden_one": "Forbidden, permission needed:",
|
||||
"forbidden_other": "Forbidden, permissions needed:"
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ const SecuredRoute = ({ route }: SecuredRouteProps) => {
|
|||
</Suspense>
|
||||
);
|
||||
|
||||
return <ForbiddenSection />;
|
||||
return <ForbiddenSection permissionNeeded={route.access} />;
|
||||
};
|
||||
|
||||
export const App = ({ adminClient }: AdminClientProps) => {
|
||||
|
|
|
@ -1,5 +1,22 @@
|
|||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { PageSection } from "@patternfly/react-core";
|
||||
|
||||
export const ForbiddenSection = () => {
|
||||
return <>Forbidden</>;
|
||||
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>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue