@nocobase/plugin-users 1.6.0-alpha.2 → 1.6.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/893fe71650db2b0b.js +10 -0
- package/dist/client/UsersProvider.d.ts +11 -0
- package/dist/client/cf0fdf6272ad9782.js +10 -0
- package/dist/client/e04edf6224b393f2.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +10 -8
- package/dist/locale/en-US.json +3 -1
- package/dist/locale/ja-JP.json +2 -1
- package/dist/locale/zh-CN.json +3 -1
- package/dist/server/actions/users.d.ts +1 -0
- package/dist/server/actions/users.js +66 -3
- package/dist/server/collections/users.js +3 -1
- package/dist/server/migrations/20241117112824-profile-schema.d.ts +13 -0
- package/dist/server/migrations/20241117112824-profile-schema.js +64 -0
- package/dist/server/migrations/20241221135800-update-password-validator.d.ts +14 -0
- package/dist/server/migrations/20241221135800-update-password-validator.js +57 -0
- package/dist/server/profile/edit-form-schema.d.ts +490 -0
- package/dist/server/profile/edit-form-schema.js +521 -0
- package/dist/server/server.d.ts +4 -2
- package/dist/server/server.js +24 -9
- package/package.json +3 -2
- package/dist/client/360.index.js +0 -10
- package/dist/client/554.index.js +0 -10
- /package/dist/client/{114.index.js → e727dfc0317bc5a0.js} +0 -0
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var edit_form_schema_exports = {};
|
|
28
|
+
__export(edit_form_schema_exports, {
|
|
29
|
+
adminProfileCreateFormSchema: () => adminProfileCreateFormSchema,
|
|
30
|
+
adminProfileEditFormSchema: () => adminProfileEditFormSchema,
|
|
31
|
+
userProfileEditFormSchema: () => userProfileEditFormSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(edit_form_schema_exports);
|
|
34
|
+
const adminProfileCreateFormSchema = {
|
|
35
|
+
type: "void",
|
|
36
|
+
"x-uid": "nocobase-admin-profile-create-form",
|
|
37
|
+
properties: {
|
|
38
|
+
form: {
|
|
39
|
+
type: "void",
|
|
40
|
+
"x-decorator": "FormBlockProvider",
|
|
41
|
+
"x-decorator-props": {
|
|
42
|
+
collection: "users",
|
|
43
|
+
dataSource: "main"
|
|
44
|
+
},
|
|
45
|
+
"x-use-decorator-props": "useCreateFormBlockDecoratorProps",
|
|
46
|
+
properties: {
|
|
47
|
+
create: {
|
|
48
|
+
type: "void",
|
|
49
|
+
"x-component": "FormV2",
|
|
50
|
+
"x-use-component-props": "useCreateFormBlockProps",
|
|
51
|
+
properties: {
|
|
52
|
+
grid: {
|
|
53
|
+
type: "void",
|
|
54
|
+
"x-component": "Grid",
|
|
55
|
+
"x-initializer": "form:configureFields",
|
|
56
|
+
properties: {
|
|
57
|
+
nickname: {
|
|
58
|
+
type: "void",
|
|
59
|
+
"x-component": "Grid.Row",
|
|
60
|
+
properties: {
|
|
61
|
+
col: {
|
|
62
|
+
type: "void",
|
|
63
|
+
"x-component": "Grid.Col",
|
|
64
|
+
properties: {
|
|
65
|
+
nickname: {
|
|
66
|
+
type: "string",
|
|
67
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
68
|
+
"x-settings": "fieldSettings:FormItem",
|
|
69
|
+
"x-component": "CollectionField",
|
|
70
|
+
"x-decorator": "FormItem",
|
|
71
|
+
"x-component-props": {},
|
|
72
|
+
"x-collection-field": "users.nickname"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
username: {
|
|
79
|
+
type: "void",
|
|
80
|
+
"x-component": "Grid.Row",
|
|
81
|
+
properties: {
|
|
82
|
+
col: {
|
|
83
|
+
type: "void",
|
|
84
|
+
"x-component": "Grid.Col",
|
|
85
|
+
properties: {
|
|
86
|
+
username: {
|
|
87
|
+
type: "string",
|
|
88
|
+
required: true,
|
|
89
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
90
|
+
"x-settings": "fieldSettings:FormItem",
|
|
91
|
+
"x-component": "CollectionField",
|
|
92
|
+
"x-decorator": "FormItem",
|
|
93
|
+
"x-component-props": {},
|
|
94
|
+
"x-collection-field": "users.username"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
email: {
|
|
101
|
+
type: "void",
|
|
102
|
+
"x-component": "Grid.Row",
|
|
103
|
+
properties: {
|
|
104
|
+
col: {
|
|
105
|
+
type: "void",
|
|
106
|
+
"x-component": "Grid.Col",
|
|
107
|
+
properties: {
|
|
108
|
+
email: {
|
|
109
|
+
type: "string",
|
|
110
|
+
required: false,
|
|
111
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
112
|
+
"x-settings": "fieldSettings:FormItem",
|
|
113
|
+
"x-component": "CollectionField",
|
|
114
|
+
"x-decorator": "FormItem",
|
|
115
|
+
"x-component-props": {},
|
|
116
|
+
"x-collection-field": "users.email"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
phone: {
|
|
123
|
+
type: "void",
|
|
124
|
+
"x-component": "Grid.Row",
|
|
125
|
+
properties: {
|
|
126
|
+
col: {
|
|
127
|
+
type: "void",
|
|
128
|
+
"x-component": "Grid.Col",
|
|
129
|
+
properties: {
|
|
130
|
+
phone: {
|
|
131
|
+
type: "string",
|
|
132
|
+
required: false,
|
|
133
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
134
|
+
"x-settings": "fieldSettings:FormItem",
|
|
135
|
+
"x-component": "CollectionField",
|
|
136
|
+
"x-decorator": "FormItem",
|
|
137
|
+
"x-component-props": {},
|
|
138
|
+
"x-collection-field": "users.phone"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
password: {
|
|
145
|
+
type: "void",
|
|
146
|
+
"x-component": "Grid.Row",
|
|
147
|
+
properties: {
|
|
148
|
+
col: {
|
|
149
|
+
type: "void",
|
|
150
|
+
"x-component": "Grid.Col",
|
|
151
|
+
properties: {
|
|
152
|
+
password: {
|
|
153
|
+
type: "string",
|
|
154
|
+
required: true,
|
|
155
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
156
|
+
"x-settings": "fieldSettings:FormItem",
|
|
157
|
+
"x-component": "CollectionField",
|
|
158
|
+
"x-decorator": "FormItem",
|
|
159
|
+
"x-component-props": {},
|
|
160
|
+
"x-collection-field": "users.password"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
roles: {
|
|
167
|
+
type: "void",
|
|
168
|
+
"x-component": "Grid.Row",
|
|
169
|
+
properties: {
|
|
170
|
+
col: {
|
|
171
|
+
type: "void",
|
|
172
|
+
"x-component": "Grid.Col",
|
|
173
|
+
properties: {
|
|
174
|
+
roles: {
|
|
175
|
+
type: "string",
|
|
176
|
+
required: false,
|
|
177
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
178
|
+
"x-settings": "fieldSettings:FormItem",
|
|
179
|
+
"x-component": "CollectionField",
|
|
180
|
+
"x-decorator": "FormItem",
|
|
181
|
+
"x-component-props": {},
|
|
182
|
+
"x-collection-field": "users.roles"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
footer: {
|
|
191
|
+
type: "void",
|
|
192
|
+
"x-component": "Action.Drawer.FootBar",
|
|
193
|
+
properties: {
|
|
194
|
+
cancel: {
|
|
195
|
+
title: '{{ t("Cancel") }}',
|
|
196
|
+
"x-component": "Action",
|
|
197
|
+
"x-use-component-props": "useCancelActionProps"
|
|
198
|
+
},
|
|
199
|
+
submit: {
|
|
200
|
+
title: '{{ t("Submit") }}',
|
|
201
|
+
"x-component": "Action",
|
|
202
|
+
"x-use-component-props": "useCreateActionProps",
|
|
203
|
+
"x-component-props": {
|
|
204
|
+
type: "primary",
|
|
205
|
+
htmlType: "submit"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const adminProfileEditFormSchema = {
|
|
217
|
+
type: "void",
|
|
218
|
+
"x-uid": "nocobase-admin-profile-edit-form",
|
|
219
|
+
properties: {
|
|
220
|
+
form: {
|
|
221
|
+
type: "void",
|
|
222
|
+
"x-decorator": "FormBlockProvider",
|
|
223
|
+
"x-decorator-props": {
|
|
224
|
+
collection: "users",
|
|
225
|
+
dataSource: "main",
|
|
226
|
+
action: "get"
|
|
227
|
+
},
|
|
228
|
+
"x-use-decorator-props": "useEditFormBlockDecoratorProps",
|
|
229
|
+
properties: {
|
|
230
|
+
edit: {
|
|
231
|
+
type: "void",
|
|
232
|
+
"x-component": "FormV2",
|
|
233
|
+
"x-use-component-props": "useEditFormBlockProps",
|
|
234
|
+
properties: {
|
|
235
|
+
grid: {
|
|
236
|
+
type: "void",
|
|
237
|
+
"x-component": "Grid",
|
|
238
|
+
"x-initializer": "form:configureFields",
|
|
239
|
+
properties: {
|
|
240
|
+
nickname: {
|
|
241
|
+
type: "void",
|
|
242
|
+
"x-component": "Grid.Row",
|
|
243
|
+
properties: {
|
|
244
|
+
col: {
|
|
245
|
+
type: "void",
|
|
246
|
+
"x-component": "Grid.Col",
|
|
247
|
+
properties: {
|
|
248
|
+
nickname: {
|
|
249
|
+
type: "string",
|
|
250
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
251
|
+
"x-settings": "fieldSettings:FormItem",
|
|
252
|
+
"x-component": "CollectionField",
|
|
253
|
+
"x-decorator": "FormItem",
|
|
254
|
+
"x-component-props": {},
|
|
255
|
+
"x-collection-field": "users.nickname"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
username: {
|
|
262
|
+
type: "void",
|
|
263
|
+
"x-component": "Grid.Row",
|
|
264
|
+
properties: {
|
|
265
|
+
col: {
|
|
266
|
+
type: "void",
|
|
267
|
+
"x-component": "Grid.Col",
|
|
268
|
+
properties: {
|
|
269
|
+
username: {
|
|
270
|
+
type: "string",
|
|
271
|
+
required: true,
|
|
272
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
273
|
+
"x-settings": "fieldSettings:FormItem",
|
|
274
|
+
"x-component": "CollectionField",
|
|
275
|
+
"x-decorator": "FormItem",
|
|
276
|
+
"x-component-props": {},
|
|
277
|
+
"x-collection-field": "users.username"
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
email: {
|
|
284
|
+
type: "void",
|
|
285
|
+
"x-component": "Grid.Row",
|
|
286
|
+
properties: {
|
|
287
|
+
col: {
|
|
288
|
+
type: "void",
|
|
289
|
+
"x-component": "Grid.Col",
|
|
290
|
+
properties: {
|
|
291
|
+
email: {
|
|
292
|
+
type: "string",
|
|
293
|
+
required: false,
|
|
294
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
295
|
+
"x-settings": "fieldSettings:FormItem",
|
|
296
|
+
"x-component": "CollectionField",
|
|
297
|
+
"x-decorator": "FormItem",
|
|
298
|
+
"x-component-props": {},
|
|
299
|
+
"x-collection-field": "users.email"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
phone: {
|
|
306
|
+
type: "void",
|
|
307
|
+
"x-component": "Grid.Row",
|
|
308
|
+
properties: {
|
|
309
|
+
col: {
|
|
310
|
+
type: "void",
|
|
311
|
+
"x-component": "Grid.Col",
|
|
312
|
+
properties: {
|
|
313
|
+
phone: {
|
|
314
|
+
type: "string",
|
|
315
|
+
required: false,
|
|
316
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
317
|
+
"x-settings": "fieldSettings:FormItem",
|
|
318
|
+
"x-component": "CollectionField",
|
|
319
|
+
"x-decorator": "FormItem",
|
|
320
|
+
"x-component-props": {},
|
|
321
|
+
"x-collection-field": "users.phone"
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
roles: {
|
|
328
|
+
type: "void",
|
|
329
|
+
"x-component": "Grid.Row",
|
|
330
|
+
properties: {
|
|
331
|
+
col: {
|
|
332
|
+
type: "void",
|
|
333
|
+
"x-component": "Grid.Col",
|
|
334
|
+
properties: {
|
|
335
|
+
roles: {
|
|
336
|
+
type: "string",
|
|
337
|
+
required: false,
|
|
338
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
339
|
+
"x-settings": "fieldSettings:FormItem",
|
|
340
|
+
"x-component": "CollectionField",
|
|
341
|
+
"x-decorator": "FormItem",
|
|
342
|
+
"x-component-props": {},
|
|
343
|
+
"x-collection-field": "users.roles"
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
footer: {
|
|
352
|
+
type: "void",
|
|
353
|
+
"x-component": "Action.Drawer.FootBar",
|
|
354
|
+
properties: {
|
|
355
|
+
cancel: {
|
|
356
|
+
title: '{{ t("Cancel") }}',
|
|
357
|
+
"x-component": "Action",
|
|
358
|
+
"x-use-component-props": "useCancelActionProps"
|
|
359
|
+
},
|
|
360
|
+
submit: {
|
|
361
|
+
title: '{{ t("Submit") }}',
|
|
362
|
+
"x-component": "Action",
|
|
363
|
+
"x-use-component-props": "useUpdateActionProps",
|
|
364
|
+
"x-component-props": {
|
|
365
|
+
type: "primary",
|
|
366
|
+
htmlType: "submit"
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
const userProfileEditFormSchema = {
|
|
378
|
+
type: "void",
|
|
379
|
+
"x-uid": "nocobase-user-profile-edit-form",
|
|
380
|
+
properties: {
|
|
381
|
+
form: {
|
|
382
|
+
type: "void",
|
|
383
|
+
"x-decorator": "FormBlockProvider",
|
|
384
|
+
"x-decorator-props": {
|
|
385
|
+
collection: "users",
|
|
386
|
+
dataSource: "main",
|
|
387
|
+
action: "get"
|
|
388
|
+
},
|
|
389
|
+
"x-use-decorator-props": "useEditFormBlockDecoratorProps",
|
|
390
|
+
properties: {
|
|
391
|
+
edit: {
|
|
392
|
+
type: "void",
|
|
393
|
+
"x-component": "FormV2",
|
|
394
|
+
"x-use-component-props": "useEditFormBlockProps",
|
|
395
|
+
properties: {
|
|
396
|
+
grid: {
|
|
397
|
+
type: "void",
|
|
398
|
+
"x-component": "Grid",
|
|
399
|
+
"x-initializer": "form:configureFields",
|
|
400
|
+
properties: {
|
|
401
|
+
nickname: {
|
|
402
|
+
type: "void",
|
|
403
|
+
"x-component": "Grid.Row",
|
|
404
|
+
properties: {
|
|
405
|
+
col: {
|
|
406
|
+
type: "void",
|
|
407
|
+
"x-component": "Grid.Col",
|
|
408
|
+
properties: {
|
|
409
|
+
nickname: {
|
|
410
|
+
type: "string",
|
|
411
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
412
|
+
"x-settings": "fieldSettings:FormItem",
|
|
413
|
+
"x-component": "CollectionField",
|
|
414
|
+
"x-decorator": "FormItem",
|
|
415
|
+
"x-component-props": {},
|
|
416
|
+
"x-collection-field": "users.nickname"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
username: {
|
|
423
|
+
type: "void",
|
|
424
|
+
"x-component": "Grid.Row",
|
|
425
|
+
properties: {
|
|
426
|
+
col: {
|
|
427
|
+
type: "void",
|
|
428
|
+
"x-component": "Grid.Col",
|
|
429
|
+
properties: {
|
|
430
|
+
username: {
|
|
431
|
+
type: "string",
|
|
432
|
+
required: true,
|
|
433
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
434
|
+
"x-settings": "fieldSettings:FormItem",
|
|
435
|
+
"x-component": "CollectionField",
|
|
436
|
+
"x-decorator": "FormItem",
|
|
437
|
+
"x-component-props": {},
|
|
438
|
+
"x-collection-field": "users.username"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
email: {
|
|
445
|
+
type: "void",
|
|
446
|
+
"x-component": "Grid.Row",
|
|
447
|
+
properties: {
|
|
448
|
+
col: {
|
|
449
|
+
type: "void",
|
|
450
|
+
"x-component": "Grid.Col",
|
|
451
|
+
properties: {
|
|
452
|
+
email: {
|
|
453
|
+
type: "string",
|
|
454
|
+
required: false,
|
|
455
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
456
|
+
"x-settings": "fieldSettings:FormItem",
|
|
457
|
+
"x-component": "CollectionField",
|
|
458
|
+
"x-decorator": "FormItem",
|
|
459
|
+
"x-component-props": {},
|
|
460
|
+
"x-collection-field": "users.email"
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
phone: {
|
|
467
|
+
type: "void",
|
|
468
|
+
"x-component": "Grid.Row",
|
|
469
|
+
properties: {
|
|
470
|
+
col: {
|
|
471
|
+
type: "void",
|
|
472
|
+
"x-component": "Grid.Col",
|
|
473
|
+
properties: {
|
|
474
|
+
phone: {
|
|
475
|
+
type: "string",
|
|
476
|
+
required: false,
|
|
477
|
+
"x-toolbar": "FormItemSchemaToolbar",
|
|
478
|
+
"x-settings": "fieldSettings:FormItem",
|
|
479
|
+
"x-component": "CollectionField",
|
|
480
|
+
"x-decorator": "FormItem",
|
|
481
|
+
"x-component-props": {},
|
|
482
|
+
"x-collection-field": "users.phone"
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
footer: {
|
|
491
|
+
type: "void",
|
|
492
|
+
"x-component": "Action.Drawer.FootBar",
|
|
493
|
+
properties: {
|
|
494
|
+
cancel: {
|
|
495
|
+
title: '{{ t("Cancel") }}',
|
|
496
|
+
"x-component": "Action",
|
|
497
|
+
"x-use-component-props": "useCancelActionProps"
|
|
498
|
+
},
|
|
499
|
+
submit: {
|
|
500
|
+
title: '{{ t("Submit") }}',
|
|
501
|
+
"x-component": "Action",
|
|
502
|
+
"x-use-component-props": "useUpdateProfileActionProps",
|
|
503
|
+
"x-component-props": {
|
|
504
|
+
type: "primary",
|
|
505
|
+
htmlType: "submit"
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
517
|
+
0 && (module.exports = {
|
|
518
|
+
adminProfileCreateFormSchema,
|
|
519
|
+
adminProfileEditFormSchema,
|
|
520
|
+
userProfileEditFormSchema
|
|
521
|
+
});
|
package/dist/server/server.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import { Plugin } from '@nocobase/server';
|
|
9
|
+
import { InstallOptions, Plugin } from '@nocobase/server';
|
|
10
10
|
export default class PluginUsersServer extends Plugin {
|
|
11
11
|
beforeLoad(): Promise<void>;
|
|
12
12
|
load(): Promise<void>;
|
|
@@ -16,5 +16,7 @@ export default class PluginUsersServer extends Plugin {
|
|
|
16
16
|
rootNickname: any;
|
|
17
17
|
rootUsername: any;
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
initUserCollection(options: InstallOptions): Promise<void>;
|
|
20
|
+
initProfileSchema(): Promise<void>;
|
|
21
|
+
install(options: InstallOptions): Promise<void>;
|
|
20
22
|
}
|
package/dist/server/server.js
CHANGED
|
@@ -45,6 +45,7 @@ var import_utils = require("@nocobase/utils");
|
|
|
45
45
|
var actions = __toESM(require("./actions/users"));
|
|
46
46
|
var import_UserModel = require("./models/UserModel");
|
|
47
47
|
var import_user_data_sync_resource = require("./user-data-sync-resource");
|
|
48
|
+
var import_edit_form_schema = require("./profile/edit-form-schema");
|
|
48
49
|
class PluginUsersServer extends import_server.Plugin {
|
|
49
50
|
async beforeLoad() {
|
|
50
51
|
this.db.registerModels({
|
|
@@ -169,7 +170,7 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
169
170
|
}
|
|
170
171
|
};
|
|
171
172
|
});
|
|
172
|
-
const loggedInActions = ["updateProfile"];
|
|
173
|
+
const loggedInActions = ["updateProfile", "updateLang"];
|
|
173
174
|
loggedInActions.forEach((action) => this.app.acl.allow("users", action, "loggedIn"));
|
|
174
175
|
this.app.acl.registerSnippet({
|
|
175
176
|
name: `pm.${this.name}`,
|
|
@@ -178,16 +179,10 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
178
179
|
const getMetaDataForUpdateProfileAction = async (ctx) => {
|
|
179
180
|
return {
|
|
180
181
|
request: {
|
|
181
|
-
params: ctx.request.params,
|
|
182
|
-
query: ctx.request.query,
|
|
183
182
|
body: {
|
|
184
183
|
...ctx.request.body,
|
|
185
184
|
password: "******"
|
|
186
|
-
}
|
|
187
|
-
path: ctx.request.path
|
|
188
|
-
},
|
|
189
|
-
response: {
|
|
190
|
-
body: ctx.body
|
|
185
|
+
}
|
|
191
186
|
}
|
|
192
187
|
};
|
|
193
188
|
};
|
|
@@ -220,6 +215,13 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
220
215
|
await Promise.all(values.map((userId) => ctx.app.emitAsync("cache:del:roles", { userId })));
|
|
221
216
|
}
|
|
222
217
|
});
|
|
218
|
+
this.app.resourceManager.use(async (ctx, next) => {
|
|
219
|
+
const { resourceName, actionName } = ctx.action;
|
|
220
|
+
if (resourceName === "users" && actionName === "updateProfile") {
|
|
221
|
+
ctx.action.actionName = "update";
|
|
222
|
+
}
|
|
223
|
+
await next();
|
|
224
|
+
});
|
|
223
225
|
const userDataSyncPlugin = this.app.pm.get("user-data-sync");
|
|
224
226
|
if (userDataSyncPlugin && userDataSyncPlugin.enabled) {
|
|
225
227
|
userDataSyncPlugin.resourceManager.registerResource(new import_user_data_sync_resource.UserDataSyncResource(this.db, this.app.logger));
|
|
@@ -249,7 +251,7 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
249
251
|
rootUsername
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
|
-
async
|
|
254
|
+
async initUserCollection(options) {
|
|
253
255
|
const { rootNickname, rootPassword, rootEmail, rootUsername } = this.getInstallingData(options);
|
|
254
256
|
const User = this.db.getCollection("users");
|
|
255
257
|
if (await User.repository.findOne({ filter: { email: rootEmail } })) {
|
|
@@ -268,4 +270,17 @@ class PluginUsersServer extends import_server.Plugin {
|
|
|
268
270
|
await repo.db2cm("users");
|
|
269
271
|
}
|
|
270
272
|
}
|
|
273
|
+
async initProfileSchema() {
|
|
274
|
+
const uiSchemas = this.db.getRepository("uiSchemas");
|
|
275
|
+
if (!uiSchemas) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
await uiSchemas.insert(import_edit_form_schema.adminProfileCreateFormSchema);
|
|
279
|
+
await uiSchemas.insert(import_edit_form_schema.adminProfileEditFormSchema);
|
|
280
|
+
await uiSchemas.insert(import_edit_form_schema.userProfileEditFormSchema);
|
|
281
|
+
}
|
|
282
|
+
async install(options) {
|
|
283
|
+
await this.initUserCollection(options);
|
|
284
|
+
await this.initProfileSchema();
|
|
285
|
+
}
|
|
271
286
|
}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "用户",
|
|
5
5
|
"description": "Provides basic user model, as well as created by and updated by fields.",
|
|
6
6
|
"description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。",
|
|
7
|
-
"version": "1.6.0-alpha.
|
|
7
|
+
"version": "1.6.0-alpha.21",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"homepage": "https://docs.nocobase.com/handbook/users",
|
|
@@ -19,13 +19,14 @@
|
|
|
19
19
|
"@nocobase/database": "1.x",
|
|
20
20
|
"@nocobase/plugin-acl": "1.x",
|
|
21
21
|
"@nocobase/plugin-auth": "1.x",
|
|
22
|
+
"@nocobase/plugin-ui-schema-storage": "1.x",
|
|
22
23
|
"@nocobase/plugin-user-data-sync": "1.x",
|
|
23
24
|
"@nocobase/resourcer": "1.x",
|
|
24
25
|
"@nocobase/server": "1.x",
|
|
25
26
|
"@nocobase/test": "1.x",
|
|
26
27
|
"@nocobase/utils": "1.x"
|
|
27
28
|
},
|
|
28
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "873cbaec9554e684781b8dc6cfd4386bb5cfa5b0",
|
|
29
30
|
"keywords": [
|
|
30
31
|
"Users & permissions"
|
|
31
32
|
]
|