search user

This commit is contained in:
peintnermax
2024-08-21 11:18:12 +02:00
parent 6b5069d38e
commit bcab9bebd0
2 changed files with 41 additions and 32 deletions

View File

@@ -4,6 +4,7 @@ import {
createUser,
getBrandingSettings,
getIDPByID,
listUsers,
retrieveIDPIntent,
} from "@/lib/zitadel";
import Alert, { AlertType } from "@/ui/Alert";
@@ -152,6 +153,13 @@ export default async function Page({
if (options?.isLinkingAllowed) {
const userId = "";
const foundUser = await listUsers(idpInformation.userName).then(
(response) => {
return response.result ? response.result[0] : null;
},
);
if (foundUser) {
const idpLink = await addIDPLink(
{
id: idpInformation.idpId,
@@ -186,6 +194,7 @@ export default async function Page({
</DynamicTheme>
);
}
}
} else if (options?.isCreationAllowed && options.isAutoCreation) {
const userId = await createUser(provider, idpInformation).catch(
(error) => {

View File

@@ -237,7 +237,7 @@ export async function getUserByID(userId: string) {
return userService.getUserByID({ userId }, {});
}
export async function listUsers(userName: string, organizationId: string) {
export async function listUsers(userName: string, organizationId?: string) {
return userService.listUsers(
{
queries: organizationId