mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix user import with group
This commit is contained in:
1 file changed
+4
-2
@@ -270,10 +270,12 @@ class SystemUserImportHandler extends SystemHandler {
|
|||||||
messages.push(e.message);
|
messages.push(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
const existing = await user.listGroup(domainId);
|
||||||
for (const name in groups) {
|
for (const name in groups) {
|
||||||
const uids = groups[name].map((i) => mapping[i]).filter((i) => i);
|
const uids = groups[name].map((i) => mapping[i]).filter((i) => i);
|
||||||
if (uids.length) await user.updateGroup(domainId, name, uids);
|
const current = existing.find((i) => i.name === name)?.uids || [];
|
||||||
|
if (uids.length) await user.updateGroup(domainId, name, Array.from(new Set([...current, ...uids])));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.response.body.users = udocs;
|
this.response.body.users = udocs;
|
||||||
this.response.body.messages = messages;
|
this.response.body.messages = messages;
|
||||||
|
|||||||
Reference in new issue
Block a user