feat(settings): 成员管理新增 Excel 模板批量导入成员

- 新增 POST /tenants/:id/members/import(仅 Owner,5MB/2000 行上限):
  excelize 解析花名册,表头探测容错,逐行校验并回传逐行结果
- 按邮箱 → 工号(users.username)匹配已有账号;未注册员工自动创建本地
  账号(随机密码、tenantless、OIDC-only 标记,首次 Casdoor 登录自动
  收编)并直接加入空间;邮箱缺失时按 OIDC 兜底域合成占位邮箱
- 角色列支持 owner/admin/contributor/viewer 与中英文标签,空默认访客;
  文件内按工号/邮箱去重,已是成员的行单独计数不视为失败
- 前端成员管理新增「批量导入」入口:SheetJS 前端生成模板(含示例行)、
  上传导入、结果汇总与失败明细展示,成功后自动刷新成员列表
- 六语言文案同步(tenantMember.import.*)
This commit is contained in:
runny committed 2026-11-19 22:32:55 +08:00
1 parent 4e25fce9aa
commit 4b899a4647
13 files changed
+1032 -5

No files matched your search

+2 -2
View File
@@ -126,7 +126,7 @@ func (s *stubMemberUserService) GetUsersByIDs(ctx context.Context, ids []string)
// middleware via memberTestRouter rather than threading a cfg through
// the handler.
func newTestMemberHandler(ms interfaces.TenantMemberService, us interfaces.UserService) *TenantMemberHandler {
return NewTenantMemberHandler(ms, us)
return NewTenantMemberHandler(ms, us, nil)
}
// memberTestRouter wires the handler with the same errorCapture middleware
@@ -685,7 +685,7 @@ func TestTenantMember_SuperuserBypassRequiresFeatureFlag(t *testing.T) {
// Build the router with the flag explicitly off — the carve-out
// now lives in middleware.RequirePathTenantMatch, which the router
// helper mounts.
h := NewTenantMemberHandler(ms, &stubMemberUserService{})
h := NewTenantMemberHandler(ms, &stubMemberUserService{}, nil)
router := memberTestRouterWithCfg(h, &config.Config{
Tenant: &config.TenantConfig{EnableCrossTenantAccess: false},
})