Edit User: the only active super user can be demoted through Role on Harper before 5.2.1

未关闭 适合新手
#2,109 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

从 src/features/instance/config/users/isOnlyActiveSuperUser.ts 和 Config → Users 中的 Edit User 模态框开始;issue 指出此检查是在 #2108 中添加的。追踪 Role 字段如何处理验证并保存角色更改,然后运行相关的用户配置测试。完成标准是:无法给唯一的活跃超级用户分配不含 super_user 的角色,并且 Role 字段会说明原因。

由索引模型根据 Issue 内容生成。

描述

Problem

The Edit User modal in Config → Users locks the Active switch on for an instance's only active super user (#2108). Harper before 5.2.1 applies a deactivation that leaves no active super user, so Studio refuses it.

The Role field has no such check. Picking a role without super_user for that same user and saving sends alter_user with the new role, and Harper before 5.2.1 applies that too. The instance is left with no active super user, through a form whose Active switch says the user "can't be deactivated".

From Harper 5.2.1, alterUser refuses both changes itself: assertActiveSuperUserRemains runs whenever role or active changes.

Suggested fix

Run isOnlyActiveSuperUser (src/features/instance/config/users/isOnlyActiveSuperUser.ts, added in #2108) against role changes too. When the target is the only active super user, refuse a role without super_user and say why beside the Role field.

Review-Deferral: e696e5372625ebcd severity=minor category=data-integrity

🤖 Generated by Claude Code (Claude Opus 5.5); posted via @dawsontoth.

主要语言
TypeScript
星标
5
派生
4
平均合并
2 天 13 小时
30 天内合并 PR
60

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

HarperFast/studio 的其他 Issue

查看 HarperFast/studio 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。