Skip to content
Snippets Groups Projects
Commit 75c2a69b authored by Ewen Le Bihan's avatar Ewen Le Bihan
Browse files

Revert "fix(ldap): duplicate uids created in LDAP"

This reverts commit 48281950.
parent 48281950
Branches
Tags v0.10.16
No related merge requests found
...@@ -98,11 +98,13 @@ export const createUid = async ({ ...@@ -98,11 +98,13 @@ export const createUid = async ({
}).replaceAll('-', ''); }).replaceAll('-', '');
const base = toAscii(lastName).slice(0, 16) + toAscii(firstName).charAt(0); const base = toAscii(lastName).slice(0, 16) + toAscii(firstName).charAt(0);
const n = await dichotomid(async (n) => { const n = await dichotomid(async (n) => {
const existsInDb = Boolean( let exist = !(await prisma.user.findFirst({ where: { uid: `${base}${n > 1 ? n : ''}` } }));
await prisma.user.findFirst({ where: { uid: `${base}${n > 1 ? n : ''}` } }) if (!exist) {
); const ldapUser = await queryLdapUser(`${base}${n > 1 ? n : ''}`);
const existsInLdap = Boolean(await queryLdapUser(`${base}${n > 1 ? n : ''}`)); exist = Boolean(ldapUser);
return existsInDb || existsInLdap; }
return exist;
}); });
return `${base}${n > 1 ? n : ''}`; return `${base}${n > 1 ? n : ''}`;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment