提交 7d910b25 编写于 作者: 雪洛's avatar 雪洛

feat: update uni-id-users schema

上级 022223ee
{ {
"bsonType": "object", "bsonType": "object",
"required": ["username", "password"],
"permission": { "permission": {
"read": true, "read": true,
"create": "'CREATE_UNI_ID_USERS' in auth.permission", "create": "'CREATE_UNI_ID_USERS' in auth.permission",
"update": "doc._id == auth.uid || 'UPDATE_UNI_ID_USERS' in auth.permission", "update": "doc._id == auth.uid || 'UPDATE_UNI_ID_USERS' in auth.permission",
"delete": "'DELETE_UNI_ID_USERS' in auth.permission" "delete": "'DELETE_UNI_ID_USERS' in auth.permission"
}, },
"properties": { "properties": {
...@@ -15,28 +14,36 @@ ...@@ -15,28 +14,36 @@
"bsonType": "string", "bsonType": "string",
"description": "支付宝平台openid", "description": "支付宝平台openid",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"apple_openid": { "apple_openid": {
"bsonType": "string", "bsonType": "string",
"description": "苹果登录openid", "description": "苹果登录openid",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"avatar": { "avatar": {
"bsonType": "string", "bsonType": "string",
"description": "头像地址", "description": "头像地址",
"title": "头像地址", "title": "头像地址",
"trim": "both" "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"
}
}, },
"avatar_file": { "avatar_file": {
"bsonType": "file", "bsonType": "file",
"description": "用file类型方便使用uni-file-picker组件", "description": "用file类型方便使用uni-file-picker组件",
"title": "头像文件" "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"
}
}, },
"comment": { "comment": {
"bsonType": "string", "bsonType": "string",
...@@ -44,8 +51,8 @@ ...@@ -44,8 +51,8 @@
"title": "备注", "title": "备注",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": false "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"dcloud_appid": { "dcloud_appid": {
...@@ -53,8 +60,8 @@ ...@@ -53,8 +60,8 @@
"description": "允许登录的客户端的appid列表", "description": "允许登录的客户端的appid列表",
"foreignKey": "opendb-app-list.appid", "foreignKey": "opendb-app-list.appid",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"department_id": { "department_id": {
...@@ -68,8 +75,8 @@ ...@@ -68,8 +75,8 @@
"enumType": "tree", "enumType": "tree",
"title": "部门", "title": "部门",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"email": { "email": {
...@@ -79,8 +86,8 @@ ...@@ -79,8 +86,8 @@
"title": "邮箱", "title": "邮箱",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"email_confirmed": { "email_confirmed": {
...@@ -98,8 +105,8 @@ ...@@ -98,8 +105,8 @@
], ],
"title": "邮箱验证状态", "title": "邮箱验证状态",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"gender": { "gender": {
...@@ -121,16 +128,16 @@ ...@@ -121,16 +128,16 @@
], ],
"title": "性别", "title": "性别",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"invite_time": { "invite_time": {
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "受邀时间", "description": "受邀时间",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"inviter_uid": { "inviter_uid": {
...@@ -138,24 +145,24 @@ ...@@ -138,24 +145,24 @@
"description": "用户全部上级邀请者", "description": "用户全部上级邀请者",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"last_login_date": { "last_login_date": {
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "最后登录时间", "description": "最后登录时间",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"last_login_ip": { "last_login_ip": {
"bsonType": "string", "bsonType": "string",
"description": "最后登录时 IP 地址", "description": "最后登录时 IP 地址",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"mobile": { "mobile": {
...@@ -165,8 +172,8 @@ ...@@ -165,8 +172,8 @@
"title": "手机号码", "title": "手机号码",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"mobile_confirmed": { "mobile_confirmed": {
...@@ -184,50 +191,50 @@ ...@@ -184,50 +191,50 @@
], ],
"title": "手机号验证状态", "title": "手机号验证状态",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"my_invite_code": { "my_invite_code": {
"bsonType": "string", "bsonType": "string",
"description": "用户自身邀请码", "description": "用户自身邀请码",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"nickname": { "nickname": {
"bsonType": "string", "bsonType": "string",
"description": "用户昵称", "description": "用户昵称",
"title": "昵称", "title": "昵称",
"trim": "both" "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"
}
}, },
"password": { "password": {
"bsonType": "password", "bsonType": "password",
"description": "密码,加密存储", "description": "密码,加密存储",
"title": "密码", "title": "密码",
"trim": "both", "trim": "both"
"permission": {
"write": false,
"read": false
}
}, },
"password_secret_version": { "password_secret_version": {
"bsonType": "int", "bsonType": "int",
"description": "密码使用的passwordSecret版本", "description": "密码使用的passwordSecret版本",
"title": "passwordSecret", "title": "passwordSecret",
"permission": { "permission": {
"write": false, "read": false,
"read": false "write": false
} }
}, },
"realname_auth": { "realname_auth": {
"bsonType": "object", "bsonType": "object",
"description": "实名认证信息", "description": "实名认证信息",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
}, }
"properties": { "properties": {
"auth_date": { "auth_date": {
"bsonType": "timestamp", "bsonType": "timestamp",
...@@ -291,16 +298,22 @@ ...@@ -291,16 +298,22 @@
"bsonType": "timestamp", "bsonType": "timestamp",
"description": "注册时间", "description": "注册时间",
"forceDefaultValue": { "forceDefaultValue": {
"$env": "now", "$env": "now"
"read": "doc._id == auth.uid" },
"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"
} }
}, },
"register_ip": { "register_ip": {
"bsonType": "string", "bsonType": "string",
"description": "注册时 IP 地址", "description": "注册时 IP 地址",
"forceDefaultValue": { "forceDefaultValue": {
"$env": "clientIP", "$env": "clientIP"
"read": "doc._id == auth.uid" },
"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"
} }
}, },
"role": { "role": {
...@@ -311,9 +324,10 @@ ...@@ -311,9 +324,10 @@
"field": "role_id as value, role_name as text" "field": "role_id as value, role_name as text"
}, },
"foreignKey": "uni-id-roles.role_id", "foreignKey": "uni-id-roles.role_id",
,
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
}, },
"title": "角色" "title": "角色"
}, },
...@@ -321,8 +335,8 @@ ...@@ -321,8 +335,8 @@
"bsonType": "int", "bsonType": "int",
"description": "用户积分,积分变更记录可参考:uni-id-scores表定义", "description": "用户积分,积分变更记录可参考:uni-id-scores表定义",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"status": { "status": {
...@@ -330,8 +344,8 @@ ...@@ -330,8 +344,8 @@
"defaultValue": 0, "defaultValue": 0,
"description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝", "description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝",
"permission": { "permission": {
"write": false, "read": "doc._id == auth.uid || 'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
}, },
"enum": [{ "enum": [{
"text": "正常", "text": "正常",
...@@ -356,7 +370,8 @@ ...@@ -356,7 +370,8 @@
"bsonType": "array", "bsonType": "array",
"description": "用户token", "description": "用户token",
"permission": { "permission": {
"read": "doc._id == auth.uid" "read": "'READ_UNI_ID_USERS' in auth.permission",
"write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"username": { "username": {
...@@ -365,7 +380,8 @@ ...@@ -365,7 +380,8 @@
"title": "用户名", "title": "用户名",
"trim": "both", "trim": "both",
"permission": { "permission": {
"write": false "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"
} }
}, },
"wx_openid": { "wx_openid": {
...@@ -390,16 +406,16 @@ ...@@ -390,16 +406,16 @@
} }
}, },
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"wx_unionid": { "wx_unionid": {
"bsonType": "string", "bsonType": "string",
"description": "微信unionid", "description": "微信unionid",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"qq_openid": { "qq_openid": {
...@@ -416,17 +432,26 @@ ...@@ -416,17 +432,26 @@
} }
}, },
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "write": "'CREATE_UNI_ID_USERS' in auth.permission || 'UPDATE_UNI_ID_USERS' in auth.permission"
} }
}, },
"qq_unionid": { "qq_unionid": {
"bsonType": "string", "bsonType": "string",
"description": "QQ unionid", "description": "QQ unionid",
"permission": { "permission": {
"write": false, "read": "'READ_UNI_ID_USERS' in auth.permission",
"read": "doc._id == auth.uid" "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
} }
} }
} },
"required": []
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册