mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix user import with group
This commit is contained in:
1 file changed
+6
-4
@@ -270,10 +270,12 @@ class SystemUserImportHandler extends SystemHandler {
|
||||
messages.push(e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const name in groups) {
|
||||
const uids = groups[name].map((i) => mapping[i]).filter((i) => i);
|
||||
if (uids.length) await user.updateGroup(domainId, name, uids);
|
||||
const existing = await user.listGroup(domainId);
|
||||
for (const name in groups) {
|
||||
const uids = groups[name].map((i) => mapping[i]).filter((i) => i);
|
||||
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.messages = messages;
|
||||
|
||||
Reference in new issue
Block a user