Files
ai_academy/migrations/versioned/000156_users_dept_fields.up.sql
runny 168057db78
deploy-hxtesting / build-and-deploy (push) Failing after 1s
feat(tenant): 成员管理新增 CASDOOR 同步与批量导入部门匹配(000156)
同步CASDOOR成员:
- 经 Casdoor 管理 API 拉全量用户目录:部门落组织架构(org_depts),账号
  工号优先匹配/邮箱兜底,未注册自动开户并加入空间;单向增量幂等,
  无部门数据自动降级为纯成员同步
- 新增 OIDC_AUTH_ADMIN_* 配置段(client_credentials/服务账号密码两种模式、
  部门字段映射),集成层见 internal/integrations/casdoor
用户部门字段(迁移 000156):
- users.dept_code/dept_name 同步态字段:成员列表「所属部门」列展示,
  组织中心从平台用户添加时按部门自动预选
批量导入部门列:
- 模板调整为 工号/姓名/部门/邮箱/角色 五列,六语言弹窗文案同步更新
- 部门列按部门管理自动匹配:名称/编号精确命中 → 唯一子串兜底,多候选
  歧义不匹配;命中回写所属部门,未命中留空不阻断该行导入;部门管理
  不可用时整列降级忽略(与 Casdoor 同步降级同思路)
构建:
- Dockerfile: browserskill 预构建产物快速通道,rustup 按需安装 + BuildKit 缓存挂载
2026-11-21 01:39:06 +08:00

17 lines
1.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Migration: 000156_users_dept_fields
-- users.dept_code / dept_name 存放工号式 IdP(Casdoor)侧的部门编号与部门名称,
-- 由「成员管理 → 同步 Casdoor 成员」(POST /tenants/:id/members/sync-casdoor)
-- 在开户与每次同步时回写;组织架构手动调整部门不影响这两列(同步态字段,
-- 以 IdP 为源)。所属部门展示(成员列表列、平台用户选择器自动带部门)均读这里。
DO $$ BEGIN RAISE NOTICE '[Migration 000156] Adding users.dept_code / users.dept_name columns...'; END $$;
ALTER TABLE users
ADD COLUMN IF NOT EXISTS dept_code VARCHAR(64) NOT NULL DEFAULT '';
ALTER TABLE users
ADD COLUMN IF NOT EXISTS dept_name VARCHAR(128) NOT NULL DEFAULT '';
COMMENT ON COLUMN users.dept_code IS 'Department code synced from the IdP (Casdoor); source of truth is the IdP, written by the member-sync endpoint';
COMMENT ON COLUMN users.dept_name IS 'Department name synced from the IdP (Casdoor); shown as 所属部门 in member list and used to prefill org-center employee import';