Skip to content

feat: 批量设置分组 + 可配置的默认注册分组 - #7

Merged
mzrodyu merged 1 commit into
mainfrom
feat/model-pull-button
Sep 10, 2026
Merged

mzrodyu merged 1 commit into
mainfrom
feat/model-pull-button

Conversation

@mzrodyu

@mzrodyu mzrodyu commented Sep 10, 2026

Copy link
Copy Markdown
Owner

背景

  • 批量操作只支持改状态/角色/余额,给用户分组只能一个个点
  • 默认注册分组后端早已支持getAuthSettings 返回 defaultGroupIdupdateAuthSettings 接受它),但前端没有入口,管理员无法知道新用户会落进自动创建的「默认分组」

改动

  • 批量 set_groupPOST /api/users/bulk 新增该 action;value 为空表示移出分组(与单用户 PATCH 行为一致);分组不存在时在写入前拒绝
  • 设置 → 注册 新增「默认注册分组」下拉,与「新用户初始额度」并列
  • 用户页批量栏 新增分组选择器 + 「设为分组」按钮

验证

新增两个测试并通过:

  • TestBulkSetGroupAssignsAndClears —— 批量归组、未知分组被拒、空值清除且不影响未选中用户
  • TestDefaultRegistrationGroupAppliesToNewUsers —— 默认分组持久化、未知分组被拒、新注册用户自动归入

实测(本地起服务):

PATCH /api/settings/auth {"defaultGroupId":"grp_..."}  → 已保存
注册新用户 Newbie                                       → "groupId":"grp_..."  ✓
POST /api/users/bulk {"action":"set_group"}            → {"updated":1}        ✓

go test ./... 全绿;npm run build 通过。

注:本 PR 同时修正了 PR #5 中对陈旧 bundle 成因的描述——更准确的原因是构建时被占用的文件无法删除且不报错,而非 vite 未清空 outDir。

…roup

Bulk user actions only covered status/role/balance, so grouping users meant
editing them one at a time. The default registration group was already
supported by the API but had no console control, so admins could not tell new
users would land in the auto-created 默认分组.

- Add a set_group bulk action; an empty value clears the assignment, matching
  the single-user patch
- Surface the default registration group in 设置 → 注册, alongside the existing
  default balance
- Add a group picker plus action button to the user bulk bar

Also includes the rebuilt bundle.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@mzrodyu
mzrodyu merged commit 81ab83a into main Sep 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant