Pine
|
ac2df72b21
|
refactor(auth): 去多身份/多端口——账号单一角色,删 user_identities/select-identity/多端口路由
- 删 UserIdentity 模型/IdentityRepository/db.identities,账号统一单一角色(users.role)
- auth.py 去 select-identity/_identity_summaries,登录恒返回 identities=[];_login_response_for_user 按单角色签发
- 删多端口路由 rbac_government/investor/developer 及其 main 挂载
- seed 去多身份回填(_migrate_identities/_ensure_port_agents/多端身份/端口标签映射)
- dependencies: require_port 去端口隔离(单角色放宽)、optional_current_user 修 identity_id 多余参数
- user_admin_service create_user 不再建端口身份;schemas 去 SelectIdentityRequest
- 新增迁移 0014_drop_user_identities(drop user_identities 表)
- 测试改写为单角色契约(登录空 identities、无 select-identity、账号级智能体)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-26 19:15:51 +08:00 |
|
Pine
|
745ba678bd
|
feat(auth): 统一鉴权收口,账号单一角色+权限码,去多身份
- dependencies._resolve_identity 收敛为单角色(users.role),不再读身份分支
- auth.login/select_identity 单角色发token、identities 恒空,Pine=operator(运营方)
- repositories.to_profile 按 role 计算 account_type(修复身份标签显示"服务方")
- seed 重构 PERMISSIONS/ROLE_PERMISSIONS:operator 平台全 menu、carrier 园区 menu:park_*,删多端口冗余
- account_types 归一 operator/carrier/opc_member/service
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-26 19:02:54 +08:00 |
|
Pine
|
f6f2008498
|
refactor(auth): 账号类型彻底收敛为四种 + 各端口守卫改 service(去除冗余角色)
- 迁移守卫: provider/enterprise/government/investor/developer 一律 require_roles("service")
- token/profile.role 归一为四种(operator/carrier/opc_member/service); require_roles 与之一致
- 账号类型集中 app/domain/account_types.py; 子角色停用
|
2026-08-26 13:15:06 +08:00 |
|
Pine
|
af6f01c5a9
|
feat(auth): 账号类型统一为四种(运营方/载体方/OPC/服务方) + 关闭子角色 + 权限逻辑集中
- 新增 app/domain/account_types.py(唯一来源): account_type(role)→operator/carrier/opc/service,
非运营非OPC一律→service(预留服务商/甲方企业); permission_role(类型)→权限角色码; label()
- _issue_token/_profile_for 统一走账号类型: 权限=permissions_for(permission_role(atype)),
子角色置None(停用); 资料暴露 account_type/account_type_label
- 端口角色(role)仅保留做内部路由守卫兼容, 对外鉴权用四种账号类型
|
2026-08-26 13:03:44 +08:00 |
|
Pine
|
cabc49eda9
|
fix(auth): 同一账号不同登录方式权限一致 —— 登录身份由账号真实角色决定
- 新增 _login_response_for_user: 保证 C端有opc_member身份, 但令牌角色取账号真实身份(多身份→中性token, role=users.role)
- phone/wx/mp/扫码/绑定 登录统一走它, 不再强制 opc_member → 手机号绑定的operator账号手机号登录也是operator
- 修「admin登录无权限, 刷新才有」根因(登录角色错配)
|
2026-08-26 13:00:20 +08:00 |
|
Pine
|
2bac67fb3c
|
fix(auth): 账号ID/登录名/昵称/微信身份彻底独立, 不再互相影响
- username 登录名独立生成: 微信用户 wx_<tokenHex>、手机号用户 u_<tokenHex> —— 不再 = openid / 手机号
- 手机号登录只按 phone 列查找(find_by_phone), 删除用 username 兜底
- 微信 openid/unionid/mini_openid 存各自列, 不污染 username
|
2026-08-26 12:55:05 +08:00 |
|
Pine
|
53521b9438
|
feat(auth): 支持通过小程序码「绑定小程序」到当前账号
- WxQrSessionStore 支持 bind_user_id(绑定态)+message; bind_user() 访问器
- POST /auth/mp-qr/bind-start(当前账号发起,返小程序码); confirm 检测绑定态: 把openid绑到目标账号(若该微信属另一账号则按手机号/微信合并)
- poll 返回 message(bound); repositories 加 set_wx_mini_openid
|
2026-08-26 12:47:55 +08:00 |
|
Pine
|
0cdcdeed26
|
feat(auth): 关闭所有微信登录(开放平台扫码),只保留小程序登录
- AUTH_WECHAT_QR 默认 false(禁用微信扫码OAuth); AUTH_WECHAT_LOGIN 默认 true(小程序登录开启)
- mp-qr/start 改挂 AUTH_WECHAT_LOGIN(小程序); /auth/status login_modes 不含 wechat
|
2026-08-26 12:25:53 +08:00 |
|
Pine
|
fa06678e92
|
feat(auth): 运行环境(生产/开发)+ 小程序码版本(体验版trial/正式版release)可配
- PINEAGENTS_ENV=prod|dev 判定运行环境; /auth/status 回显 env + wxacode_env 以便确认
- PINEAGENTS_WXACODE_ENV=release|trial|develop 决定小程序码指向(默认 prod→release, dev→trial=体验版)
- get_wxacode 用该 env_version(支持体验版测试)
|
2026-08-26 12:21:30 +08:00 |
|
Pine
|
f697fdad37
|
feat(auth): 统一账号绑定/解绑 + 按手机号自动合并(同一账号不新建)
- merge_accounts(keeper,absorbed): 身份字段继承、user_identities改挂、audit_logs/任务归属改指keeper、absorbed级联删除(防FK阻断)
- POST /auth/bind-phone(验证码,手机号被占用→按手机号合并成keeper并返新令牌); POST /auth/unbind(至少要留一种登录方式); wx-phone 改走合并
- profile 加 wxBound/wxMiniBound; schemas BindPhoneRequest/UnbindRequest
|
2026-08-26 12:15:22 +08:00 |
|
Pine
|
53cb18efe5
|
feat(auth): 小程序扫码登录其它端口 —— 生成小程序码(微信扫一扫自动拉起)
- wechat.get_wxacode(access_token缓存+getwxacodeunlimit),scene短token<=32
- /auth/mp-qr/start 返回 qr_image(小程序码,扫码自动打开小程序pages/scan-login) ,无凭据回退 qr_url
- mp-qr gate 改 AUTH_WECHAT_QR(默认开)
|
2026-08-26 11:59:54 +08:00 |
|
Pine
|
32ca580a06
|
feat(auth): 统一四种登录 —— 短信演示码123456 + 微信扫码OAuth + 小程序扫码
- sms stub 固定演示码123456
- 微信扫码(开放平台标准OAuth): /auth/wx-qr/start|wx-callback(GET/POST)|wx-qr/poll
- 小程序扫码: /auth/mp-qr/start|poll|confirm
- /auth/status 返回四 login_modes;WECHAT_OPEN_APPID/SECRET、AUTH_WECHAT_QR、WECHAT_QR_REDIRECT_URI 配置
|
2026-08-25 22:47:27 +08:00 |
|
Pine
|
9d60e0afc6
|
feat(auth): 平台成唯一账号源——小程序微信登录进 users + OPC 报名资料字段
统一用户账号体系(阶段1,非破坏):
- UserRepository 新增 get_by_wx_mini_openid。
- /auth/wx-login:小程序登录(X-Client=miniprogram)按 wx_mini_openid 建/复用
users 账号(role=opc_member, source=mini_program, auth_type=wx_openid),
并带 nickName/avatarUrl;非小程序仍走 wx_openid。
- /auth/me + 登录响应补齐小程序契约字段 name/phone/phoneBound。
- users 增 opc_status/topics 列(alembic 0010);desktop/web profile 也输出
name/phone/phoneBound/status/topics,且 update-profile 支持 name/status/topics 映射。
- scripts/db/seed.py 增 accounts→users 幂等迁移:旧小程序账号并入全局 users
(wx_mini_openid/phone 关联 + opc_member 身份),由用户执行 migrate+seed。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-08-25 19:59:34 +08:00 |
|
Pine
|
a976ce194e
|
refactor(auth): 统一登录=账号密码+手机号验证码, 微信扫码预留(本期未开放)
- auth/status 返回 login_modes([password,phone]) + wechat_login 标志, 供各端渲染(VITE 按此显示)
- wx-login 用 config.AUTH_WECHAT_LOGIN(默认 false) 闸门, 未开放返回 503'微信登录预留中'
- 本期所有端口两种登录模式; 微信扫码后期拓展
|
2026-08-25 16:25:50 +08:00 |
|
Pine
|
0039a809ac
|
feat(user): 用户认证状态/所属/账号类型 分类字段
- users 增: certification_status(uncertified|pending|certified|rejected)+certification_time, affiliation(independent|park)+park_id/park_name, account_type(opc_default|park_staff|platform_staff|provider|enterprise); alembic 0007
- repo: set_classification; _user_to_dict 含全部新字段; profile 返回认证/所属/账号类型
- admin: POST /admin/users/{id}/classification(认证/分类设置, action:user.manage) + UserClassificationRequest schema
- 迁移已应用, 导入通过
|
2026-08-25 16:24:19 +08:00 |
|
Pine
|
879396b532
|
feat(user): 全局用户准确来源 + 丰富跨端字段(全端口兼容)
- users 增: wx_unionid/wx_mini_openid(微信绑定), source(来源枚举), auth_type, register_ip, last_login_ip/at, email, gender, birthday, compute_provisioned/username/quota/used_quota(算力镜像); alembic 0006
- 来源: register/phone-login/wx-login(读 X-Client 头,回退 body.source,再回退按 auth_type 推断)、admin 创建=admin、seed=seed
- auth: 登录(签发令牌)记 last_login; profile 返回 source/auth_type/compute; email/gender/birthday 可编辑
- 对账 sync-users 回写 compute_* 镜像到平台用户
- _user_to_dict 含全部新字段; 迁移已应用, 导入/零依赖校验通过(dict 含 source/算力)
|
2026-08-25 16:21:20 +08:00 |
|
Pine
|
b90539a013
|
feat(server): 统一登录+算力打通(port 阶段0-1)落地四层架构
- 登录:/auth/send-code·phone-login·wx-login·wx-phone(复用 RBAC 签发)
- 算力:services/compute_client(loopback :3000)+ /admin/compute/ping·provision
- /v1 relay 改走 compute-engine(前端不直连引擎)
- 模型:User 补 wx_openid/phone;仓储 async create+新方法
- 契约:api/schemas(auth/compute)Pydantic
|
2026-08-24 14:16:34 +08:00 |
|
Pine
|
01ef3c9637
|
refactor: schemas 抽取(DTO 从 models.py 与路由内联迁至 api/schemas/)
- 新建 api/schemas/:auth/agents/admin/ecosystem/investor/opc/operator/org/portals
- models.py 移除 15 个 Pydantic DTO(保留 ORM 数据模型层)
- 13 个路由内联 DTO 全部迁出,路由瘦身仅剩处理逻辑
- 全量 66 测试通过
|
2026-08-24 09:51:52 +08:00 |
|
Pine
|
a869b2934a
|
test: 平台测试套件适配异步四层,66 全绿
- conftest 改为 monkeypatch DATABASE_URL + lifespan 建库(解决异步引擎跨事件循环)
- 修复 seed_data 辅助函数 await、_to_dict 链式 await、get_current_user await
- 修复 Database.initialize 建表于本实例引擎
- 平台 19 路由全部经异步接口回归通过
|
2026-08-24 00:34:28 +08:00 |
|
Pine
|
980a2db6d9
|
refactor: 平台应用异步四层架构(接口/业务/领域/基础设施)
- 基础设施层 async:SQLAlchemy 异步引擎/会话、33 Repository async 化、models/security/seed 迁入 infrastructure、新增 cache.py(redis.asyncio) 与 oss.py(aioboto3)
- 接口层:routers 迁 api/routers 并全 async,dependencies 迁 api/dependencies(get_db/get_current_user async)
- 依赖:sqlalchemy[asyncio]/aiosqlite/asyncmy/redis/aioboto3;config 异步 URL + Redis/OSS 配置
- 删除废弃:旧同步 db/dependencies/repositories/storage
- 验证:平台 19 路由 + 培训 48 路由全注册;/health /auth/login /auth/me /admin/tasks /notifications 等接口 async 可用
|
2026-08-23 23:52:58 +08:00 |
|