Skip to content
Snippets Groups Projects
Commit 380d514a authored by whidix's avatar whidix
Browse files

fix: username ldap

parent 16b39daa
Branches
Tags v0.17.19
No related merge requests found
......@@ -539,14 +539,14 @@ builder.mutationField('syncUserLdap', (t) =>
return Boolean(user?.admin);
},
async resolve(_, { uid }) {
const userDb = await prisma.user.findUnique({
where: { uid },
const usersDb = await prisma.user.findMany({
include: { major: true },
});
if (!userDb) return false;
for (const userDb of usersDb) {
if (!userDb) continue;
const userLdap = await queryLdapUser(userDb.uid);
if (!userLdap) return false;
if (userDb.graduationYear === userLdap.promo) return false;
if (!userLdap) continue;
if (userDb.graduationYear === userLdap.promo) continue;
if (userLdap.genre !== 404) {
const newUid = await createUid(userDb);
await prisma.user.update({
......@@ -555,6 +555,7 @@ builder.mutationField('syncUserLdap', (t) =>
});
console.info(`Updated uid: ${uid} -> ${newUid}`);
}
}
return true;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment