use users realm to edit admin user (#32964)

fixes: #32915

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-09-16 14:48:30 +02:00 committed by GitHub
parent 808883c34d
commit 5e65bdde16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View file

@ -22,7 +22,6 @@ import {
import { useAdminClient } from "../admin-client"; import { useAdminClient } from "../admin-client";
import { useAlerts } from "@keycloak/keycloak-ui-shared"; import { useAlerts } from "@keycloak/keycloak-ui-shared";
import { FormAccess } from "../components/form/FormAccess"; import { FormAccess } from "../components/form/FormAccess";
import { useRealm } from "../context/realm-context/RealmContext";
import { toUser } from "../user/routes/User"; import { toUser } from "../user/routes/User";
import { emailRegexPattern } from "../util"; import { emailRegexPattern } from "../util";
import { useCurrentUser } from "../utils/useCurrentUser"; import { useCurrentUser } from "../utils/useCurrentUser";
@ -44,7 +43,6 @@ export const RealmSettingsEmailTab = ({
const { adminClient } = useAdminClient(); const { adminClient } = useAdminClient();
const { t } = useTranslation(); const { t } = useTranslation();
const { realm: realmName } = useRealm();
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const currentUser = useCurrentUser(); const currentUser = useCurrentUser();
@ -254,7 +252,7 @@ export const RealmSettingsEmailTab = ({
<Link <Link
{...props} {...props}
to={toUser({ to={toUser({
realm: realmName, realm: currentUser.realm!,
id: currentUser.id!, id: currentUser.id!,
tab: "settings", tab: "settings",
})} })}

View file

@ -15,5 +15,5 @@ export function useCurrentUser() {
userId, userId,
]); ]);
return currentUser; return { ...currentUser, realm: whoAmI.getRealm() };
} }