when user is only member of an org via idp (#33570)
removing the member from the org will result in the user no longer being in the system. In that case we move to the users list. fixes: #33435 Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
7e5734fd48
commit
e999b8fd82
1 changed files with 7 additions and 1 deletions
|
@ -16,7 +16,7 @@ import {
|
|||
} from "@patternfly/react-core";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link, useParams } from "react-router-dom";
|
||||
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||
import { useAdminClient } from "../admin-client";
|
||||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||
import { useRealm } from "../context/realm-context/RealmContext";
|
||||
|
@ -24,11 +24,13 @@ import { OrganizationModal } from "../organizations/OrganizationModal";
|
|||
import { toEditOrganization } from "../organizations/routes/EditOrganization";
|
||||
import useToggle from "../utils/useToggle";
|
||||
import { UserParams } from "./routes/User";
|
||||
import { toUsers } from "./routes/Users";
|
||||
|
||||
export const Organizations = () => {
|
||||
const { adminClient } = useAdminClient();
|
||||
const { t } = useTranslation();
|
||||
const { id } = useParams<UserParams>();
|
||||
const navigate = useNavigate();
|
||||
const { addAlert, addError } = useAlerts();
|
||||
const { realm } = useRealm();
|
||||
|
||||
|
@ -65,6 +67,10 @@ export const Organizations = () => {
|
|||
),
|
||||
);
|
||||
addAlert(t("organizationRemovedSuccess"));
|
||||
const user = await adminClient.users.findOne({ id: id! });
|
||||
if (!user) {
|
||||
navigate(toUsers({ realm: realm }));
|
||||
}
|
||||
setSelectedOrgs([]);
|
||||
refresh();
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in a new issue