uni-id-users.schema.json 13.4 KB
Newer Older
1 2 3
{
	"bsonType": "object",
	"permission": {
雪洛's avatar
雪洛 已提交
4 5 6
		"read": true,
		"create": "'CREATE_UNI_ID_USERS' in auth.permission",
		"update": "doc._id == auth.uid || 'UPDATE_UNI_ID_USERS' in auth.permission",
7 8 9 10 11 12 13 14 15 16
		"delete": "'DELETE_UNI_ID_USERS' in auth.permission"
	},
	"properties": {
		"_id": {
			"description": "存储文档 ID(用户 ID),系统自动生成"
		},
		"ali_openid": {
			"bsonType": "string",
			"description": "支付宝平台openid",
			"permission": {
雪洛's avatar
雪洛 已提交
17 18
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
19 20 21 22 23 24
			}
		},
		"apple_openid": {
			"bsonType": "string",
			"description": "苹果登录openid",
			"permission": {
雪洛's avatar
雪洛 已提交
25 26
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
27 28 29 30 31 32
			}
		},
		"avatar": {
			"bsonType": "string",
			"description": "头像地址",
			"title": "头像地址",
雪洛's avatar
雪洛 已提交
33 34 35 36 37
			"trim": "both",
			"permission": {
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
			}
38 39 40 41
		},
		"avatar_file": {
			"bsonType": "file",
			"description": "用file类型方便使用uni-file-picker组件",
雪洛's avatar
雪洛 已提交
42 43 44 45 46
			"title": "头像文件",
			"permission": {
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
			}
47 48 49 50 51 52 53
		},
		"comment": {
			"bsonType": "string",
			"description": "备注",
			"title": "备注",
			"trim": "both",
			"permission": {
雪洛's avatar
雪洛 已提交
54 55
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
56 57 58 59 60 61 62
			}
		},
		"dcloud_appid": {
			"bsonType": "array",
			"description": "允许登录的客户端的appid列表",
			"foreignKey": "opendb-app-list.appid",
			"permission": {
雪洛's avatar
雪洛 已提交
63 64
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
65 66 67 68 69 70 71 72 73 74 75 76 77
			}
		},
		"department_id": {
			"bsonType": "array",
			"description": "部门ID",
			"enum": {
				"collection": "opendb-department",
				"field": "_id as value, name as text",
				"orderby": "name asc"
			},
			"enumType": "tree",
			"title": "部门",
			"permission": {
雪洛's avatar
雪洛 已提交
78 79
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
80 81 82 83 84 85 86 87 88
			}
		},
		"email": {
			"bsonType": "string",
			"description": "邮箱地址",
			"format": "email",
			"title": "邮箱",
			"trim": "both",
			"permission": {
雪洛's avatar
雪洛 已提交
89 90
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
			}
		},
		"email_confirmed": {
			"bsonType": "int",
			"defaultValue": 0,
			"description": "邮箱验证状态:0 未验证 1 已验证",
			"enum": [{
					"text": "未验证",
					"value": 0
				},
				{
					"text": "已验证",
					"value": 1
				}
			],
			"title": "邮箱验证状态",
			"permission": {
雪洛's avatar
雪洛 已提交
108 109
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
			}
		},
		"gender": {
			"bsonType": "int",
			"defaultValue": 0,
			"description": "用户性别:0 未知 1 男性 2 女性",
			"enum": [{
					"text": "未知",
					"value": 0
				},
				{
					"text": "男",
					"value": 1
				},
				{
					"text": "女",
					"value": 2
				}
			],
			"title": "性别",
			"permission": {
雪洛's avatar
雪洛 已提交
131 132
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
133 134 135 136 137 138
			}
		},
		"invite_time": {
			"bsonType": "timestamp",
			"description": "受邀时间",
			"permission": {
雪洛's avatar
雪洛 已提交
139 140
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
141 142 143 144 145 146 147
			}
		},
		"inviter_uid": {
			"bsonType": "array",
			"description": "用户全部上级邀请者",
			"trim": "both",
			"permission": {
雪洛's avatar
雪洛 已提交
148 149
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
150 151 152 153 154 155
			}
		},
		"last_login_date": {
			"bsonType": "timestamp",
			"description": "最后登录时间",
			"permission": {
雪洛's avatar
雪洛 已提交
156 157
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
158 159 160 161 162 163
			}
		},
		"last_login_ip": {
			"bsonType": "string",
			"description": "最后登录时 IP 地址",
			"permission": {
雪洛's avatar
雪洛 已提交
164 165
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
166 167 168 169 170 171 172 173 174
			}
		},
		"mobile": {
			"bsonType": "string",
			"description": "手机号码",
			"pattern": "^\\+?[0-9-]{3,20}$",
			"title": "手机号码",
			"trim": "both",
			"permission": {
雪洛's avatar
雪洛 已提交
175 176
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
			}
		},
		"mobile_confirmed": {
			"bsonType": "int",
			"defaultValue": 0,
			"description": "手机号验证状态:0 未验证 1 已验证",
			"enum": [{
					"text": "未验证",
					"value": 0
				},
				{
					"text": "已验证",
					"value": 1
				}
			],
			"title": "手机号验证状态",
			"permission": {
雪洛's avatar
雪洛 已提交
194 195
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
196 197 198 199 200 201
			}
		},
		"my_invite_code": {
			"bsonType": "string",
			"description": "用户自身邀请码",
			"permission": {
雪洛's avatar
雪洛 已提交
202 203
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
204 205 206 207 208 209
			}
		},
		"nickname": {
			"bsonType": "string",
			"description": "用户昵称",
			"title": "昵称",
雪洛's avatar
雪洛 已提交
210 211 212 213 214
			"trim": "both",
			"permission": {
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "doc._id == auth.uid || 'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
			}
215 216 217 218 219
		},
		"password": {
			"bsonType": "password",
			"description": "密码,加密存储",
			"title": "密码",
雪洛's avatar
雪洛 已提交
220
			"trim": "both"
221 222 223 224 225 226
		},
		"password_secret_version": {
			"bsonType": "int",
			"description": "密码使用的passwordSecret版本",
			"title": "passwordSecret",
			"permission": {
雪洛's avatar
雪洛 已提交
227 228
				"read": false,
				"write": false
229 230 231 232 233 234
			}
		},
		"realname_auth": {
			"bsonType": "object",
			"description": "实名认证信息",
			"permission": {
雪洛's avatar
雪洛 已提交
235 236
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
雪洛's avatar
雪洛 已提交
237
			},
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
			"properties": {
				"auth_date": {
					"bsonType": "timestamp",
					"description": "认证通过时间"
				},
				"auth_status": {
					"bsonType": "int",
					"description": "认证状态:0 未认证 1 等待认证 2 认证通过 3 认证失败",
					"maximum": 3,
					"minimum": 0
				},
				"contact_email": {
					"bsonType": "string",
					"description": "联系人邮箱"
				},
				"contact_mobile": {
					"bsonType": "string",
					"description": "联系人手机号码"
				},
				"contact_person": {
					"bsonType": "string",
					"description": "联系人姓名"
				},
				"id_card_back": {
					"bsonType": "string",
					"description": "身份证反面照 URL"
				},
				"id_card_front": {
					"bsonType": "string",
					"description": "身份证正面照 URL"
				},
				"identity": {
					"bsonType": "string",
					"description": "身份证号码/营业执照号码"
				},
				"in_hand": {
					"bsonType": "string",
					"description": "手持身份证照片 URL"
				},
				"license": {
					"bsonType": "string",
					"description": "营业执照 URL"
				},
				"real_name": {
					"bsonType": "string",
					"description": "真实姓名/企业名称"
				},
				"type": {
					"bsonType": "int",
					"description": "用户类型:0 个人用户 1 企业用户",
					"maximum": 1,
					"minimum": 0
				}
			},
			"required": [
				"type",
				"auth_status"
			]
		},
		"register_date": {
			"bsonType": "timestamp",
			"description": "注册时间",
			"forceDefaultValue": {
雪洛's avatar
雪洛 已提交
301 302 303 304 305
				"$env": "now"
			},
			"permission": {
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
306 307 308 309 310 311
			}
		},
		"register_ip": {
			"bsonType": "string",
			"description": "注册时 IP 地址",
			"forceDefaultValue": {
雪洛's avatar
雪洛 已提交
312 313 314 315 316
				"$env": "clientIP"
			},
			"permission": {
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
317 318 319 320 321 322 323 324 325 326 327
			}
		},
		"role": {
			"bsonType": "array",
			"description": "用户角色",
			"enum": {
				"collection": "uni-id-roles",
				"field": "role_id as value, role_name as text"
			},
			"foreignKey": "uni-id-roles.role_id",
			"permission": {
雪洛's avatar
雪洛 已提交
328 329
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
330 331 332 333 334 335 336
			},
			"title": "角色"
		},
		"score": {
			"bsonType": "int",
			"description": "用户积分,积分变更记录可参考:uni-id-scores表定义",
			"permission": {
雪洛's avatar
雪洛 已提交
337 338
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
339 340 341 342 343 344 345
			}
		},
		"status": {
			"bsonType": "int",
			"defaultValue": 0,
			"description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",
			"permission": {
雪洛's avatar
雪洛 已提交
346 347
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
			},
			"enum": [{
					"text": "正常",
					"value": 0
				},
				{
					"text": "禁用",
					"value": 1
				},
				{
					"text": "审核中",
					"value": 2
				},
				{
					"text": "审核拒绝",
					"value": 3
				}
			],
			"title": "用户状态"
		},
		"token": {
			"bsonType": "array",
			"description": "用户token",
			"permission": {
雪洛's avatar
雪洛 已提交
372 373
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
374 375 376 377 378 379 380 381
			}
		},
		"username": {
			"bsonType": "string",
			"description": "用户名,不允许重复",
			"title": "用户名",
			"trim": "both",
			"permission": {
雪洛's avatar
雪洛 已提交
382 383
				"read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
			}
		},
		"wx_openid": {
			"bsonType": "object",
			"description": "微信各个平台openid",
			"properties": {
				"app": {
					"bsonType": "string",
					"description": "app平台微信openid"
				},
				"mp": {
					"bsonType": "string",
					"description": "微信小程序平台openid"
				},
				"h5": {
					"bsonType": "string",
					"description": "微信公众号登录openid"
				},
				"web": {
					"bsonType": "string",
					"description": "PC页面扫码登录openid"
				}
			},
			"permission": {
雪洛's avatar
雪洛 已提交
408 409
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
410 411 412 413 414 415
			}
		},
		"wx_unionid": {
			"bsonType": "string",
			"description": "微信unionid",
			"permission": {
雪洛's avatar
雪洛 已提交
416 417
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
			}
		},
		"qq_openid": {
			"bsonType": "object",
			"description": "QQ各个平台openid",
			"properties": {
				"app": {
					"bsonType": "string",
					"description": "app平台QQ openid"
				},
				"mp": {
					"bsonType": "string",
					"description": "QQ小程序平台openid"
				}
			},
			"permission": {
雪洛's avatar
雪洛 已提交
434 435
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
436 437 438 439 440 441
			}
		},
		"qq_unionid": {
			"bsonType": "string",
			"description": "QQ unionid",
			"permission": {
雪洛's avatar
雪洛 已提交
442 443 444 445 446 447 448 449 450 451
				"read": "'READ_UNI_ID_USERS' in auth.permission",
				"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
			}
		},
		"third_party": {
			"bsonType": "object",
			"description": "三方平台凭证",
			"permission": {
				"read": false,
				"write": false
452 453
			}
		}
雪洛's avatar
雪洛 已提交
454 455
	},
	"required": []
雪洛's avatar
雪洛 已提交
456
}