remove userProfileMetadata from user (#25608)

fixes: #25463

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-01-09 11:49:51 +01:00 committed by GitHub
parent dd90ffccaf
commit 01e7a58aa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -103,13 +103,13 @@ export default function EditUser() {
adminClient.users.findOne({ adminClient.users.findOne({
id: id!, id: id!,
userProfileMetadata: true, userProfileMetadata: true,
}) as UIUserRepresentation, }) as UIUserRepresentation | undefined,
adminClient.attackDetection.findOne({ id: id! }), adminClient.attackDetection.findOne({ id: id! }),
getUnmanagedAttributes(id!), getUnmanagedAttributes(id!),
adminClient.users.getProfile({ realm: realmName }), adminClient.users.getProfile({ realm: realmName }),
]), ]),
([realm, user, attackDetection, unmanagedAttributes, upConfig]) => { ([realm, userData, attackDetection, unmanagedAttributes, upConfig]) => {
if (!user || !realm || !attackDetection) { if (!userData || !realm || !attackDetection) {
throw new Error(t("notFound")); throw new Error(t("notFound"));
} }
@ -117,8 +117,9 @@ export default function EditUser() {
isFeatureEnabled(Feature.DeclarativeUserProfile) && isFeatureEnabled(Feature.DeclarativeUserProfile) &&
realm.attributes?.userProfileEnabled === "true"; realm.attributes?.userProfileEnabled === "true";
const { userProfileMetadata, ...user } = userData;
setUserProfileMetadata( setUserProfileMetadata(
isUserProfileEnabled ? user.userProfileMetadata : undefined, isUserProfileEnabled ? userProfileMetadata : undefined,
); );
if (isUserProfileEnabled) { if (isUserProfileEnabled) {