Fix bugs when admin has limited roles. (#2098)

This commit is contained in:
Stan Silvert 2022-02-21 12:00:41 -05:00 committed by GitHub
parent 10b53617a0
commit b892c49436
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 6 deletions

View file

@ -9,7 +9,7 @@ export const AuthenticationRoute: RouteDef = {
path: "/:realm/authentication/:tab?", path: "/:realm/authentication/:tab?",
component: lazy(() => import("../AuthenticationSection")), component: lazy(() => import("../AuthenticationSection")),
breadcrumb: (t) => t("authentication"), breadcrumb: (t) => t("authentication"),
access: "view-realm", access: ["view-realm", "view-identity-providers", "view-clients"],
}; };
export const toAuthentication = ( export const toAuthentication = (

View file

@ -14,7 +14,7 @@ export const FlowRoute: RouteDef = {
path: "/:realm/authentication/:id/:usedBy/:builtIn?", path: "/:realm/authentication/:id/:usedBy/:builtIn?",
component: lazy(() => import("../FlowDetails")), component: lazy(() => import("../FlowDetails")),
breadcrumb: (t) => t("authentication:flowDetails"), breadcrumb: (t) => t("authentication:flowDetails"),
access: "manage-authorization", access: "view-authorization",
}; };
export const toFlow = (params: FlowParams): LocationDescriptorObject => ({ export const toFlow = (params: FlowParams): LocationDescriptorObject => ({

View file

@ -24,7 +24,7 @@ import { toDashboard } from "../../dashboard/routes/Dashboard";
export default function NewRealmForm() { export default function NewRealmForm() {
const { t } = useTranslation("realm"); const { t } = useTranslation("realm");
const history = useHistory(); const history = useHistory();
const { refresh } = useWhoAmI(); const { refresh, whoAmI } = useWhoAmI();
const { refresh: refreshRealms } = useRealms(); const { refresh: refreshRealms } = useRealms();
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
@ -59,7 +59,8 @@ export default function NewRealmForm() {
<FormAccess <FormAccess
isHorizontal isHorizontal
onSubmit={handleSubmit(save)} onSubmit={handleSubmit(save)}
role="manage-realm" role="view-realm"
isReadOnly={!whoAmI.canCreateRealm()}
> >
<JsonFileUpload <JsonFileUpload
id="kc-realm-filename" id="kc-realm-filename"

View file

@ -9,7 +9,7 @@ export const AddRealmRoute: RouteDef = {
path: "/:realm/add-realm", path: "/:realm/add-realm",
component: lazy(() => import("../add/NewRealmForm")), component: lazy(() => import("../add/NewRealmForm")),
breadcrumb: (t) => t("realm:createRealm"), breadcrumb: (t) => t("realm:createRealm"),
access: "manage-realm", access: "view-realm",
}; };
export const toAddRealm = ( export const toAddRealm = (

View file

@ -9,7 +9,7 @@ export const SessionsRoute: RouteDef = {
path: "/:realm/sessions", path: "/:realm/sessions",
component: lazy(() => import("../SessionsSection")), component: lazy(() => import("../SessionsSection")),
breadcrumb: (t) => t("sessions:title"), breadcrumb: (t) => t("sessions:title"),
access: "view-realm", access: ["view-realm", "view-clients", "view-users"],
}; };
export const toSessions = ( export const toSessions = (