mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix user import metadata
This commit is contained in:
1 file changed
+3
-3
@@ -219,7 +219,7 @@ class SystemUserImportHandler extends SystemHandler {
|
|||||||
@param('draft', Types.Boolean)
|
@param('draft', Types.Boolean)
|
||||||
async post(domainId: string, _users: string, draft: boolean) {
|
async post(domainId: string, _users: string, draft: boolean) {
|
||||||
const users = _users.split('\n');
|
const users = _users.split('\n');
|
||||||
const udocs: { email: string, username: string, password: string, displayName?: string, payload?: any }[] = [];
|
const udocs: { email: string, username: string, password: string, displayName?: string, [key: string]: any; }[] = [];
|
||||||
const messages = [];
|
const messages = [];
|
||||||
const mapping = {};
|
const mapping = {};
|
||||||
const groups: Record<string, string[]> = {};
|
const groups: Record<string, string[]> = {};
|
||||||
@@ -265,8 +265,8 @@ class SystemUserImportHandler extends SystemHandler {
|
|||||||
const uid = await user.create(udoc.email, udoc.username, udoc.password);
|
const uid = await user.create(udoc.email, udoc.username, udoc.password);
|
||||||
mapping[udoc.email] = uid;
|
mapping[udoc.email] = uid;
|
||||||
if (udoc.displayName) await domain.setUserInDomain(domainId, uid, { displayName: udoc.displayName });
|
if (udoc.displayName) await domain.setUserInDomain(domainId, uid, { displayName: udoc.displayName });
|
||||||
if (udoc.payload?.school) await user.setById(uid, { school: udoc.payload.school });
|
if (udoc.school) await user.setById(uid, { school: udoc.school });
|
||||||
if (udoc.payload?.studentId) await user.setById(uid, { studentId: udoc.payload.studentId });
|
if (udoc.studentId) await user.setById(uid, { studentId: udoc.studentId });
|
||||||
await this.ctx.serial('user/import/create', uid, udoc);
|
await this.ctx.serial('user/import/create', uid, udoc);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
messages.push(e.message);
|
messages.push(e.message);
|
||||||
|
|||||||
Reference in new issue
Block a user