TencentCloud / TencentCloud/TencentDB-Agent-Memory
[Bug] MemoryPanel Team 删除入口难发现,system_admin 无法查看或删除其他用户的 Team
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27k
- Forks
- 2.6k
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 23
Description
OpenClaw Version | OpenClaw 版本
Not applicable. This issue is in MemoryPanel.
Plugin Version | 插件版本
TencentDB-Agent-Memory / MemoryPanel 0.1.0, current feat/server_team implementation.
Operating System | 操作系统
Linux 7.0.0-30-generic x86_64 (container deployment).
System Specification | 系统配置
Not relevant to reproduction.
Describe the bug | 问题描述
MemoryPanel 的 Team 删除流程存在两个相关问题:
- 对 Team owner / Team admin,删除入口只出现在
TeamSwitcher的当前 active Team 行中,并且默认隐藏,只有 hover / focus 时才显示。成员管理页等常见的 Team 管理位置没有清晰、常驻的删除入口,用户很容易认为系统不支持删除 Team。 - 全局
system_admin无法在 MemoryPanel 中查看或删除其他用户创建的 Team。前端虽然将userRole === 'admin'视为可以编辑或删除当前 Team,但 Team 列表仍按当前管理员的user_id调用team/list,因此只会返回该管理员作为 active member 加入的 Team。未加入普通 Team 的system_admin看不到实例中的其他 Team,也无法到达删除入口。
后端授权也与前端表达不一致:deleteTeamsForCaller() 仅允许 Team owner 或 meta_team_members.role === 'admin' 删除 Team,没有考虑 ctx.isSystemAdmin。因此,即使 system_admin 已知目标 team_id,直接调用删除接口仍会返回 403。
To Reproduce | 复现步骤
Team owner:
- 使用普通用户创建一个 Team。
- 登录 MemoryPanel,进入成员管理页或其他 Team 管理相关页面。
- 页面中没有清晰、常驻的“删除 Team”入口。
- 打开顶栏
TeamSwitcher。 - 如果目标 Team 不是 active Team,需要先选择该 Team,再次打开
TeamSwitcher。 - hover active Team 行后,右侧才显示编辑和删除图标。
system_admin:
- 创建一个
system_admin,但不将其加入普通 Team。 - 使用普通用户创建一个或多个 Team。
- 使用
system_admin登录 MemoryPanel。 TeamSwitcher不显示这些 Team,因此无法选择或删除它们。- 即使已知
team_id,以system_admin调用 Team 删除接口仍会因不是 owner 或 Team member admin 而返回 403。
Expected behavior | 预期行为
- Team 删除操作应位于用户自然预期的 Team 管理位置;如果保留在
TeamSwitcher中,也应提供清晰、易发现的常驻菜单或操作入口,而不是仅依赖 hover 且只对 active Team 显示。 - 明确定义
system_admin的 Team 管理权限,并保证前后端一致:- 如果
system_admin应管理实例内全部 Team,应提供实例级 Team 列表能力,并在 Core 的 Team 管理授权中显式支持ctx.isSystemAdmin; - 如果
system_admin不应管理未加入的 Team,应从TeamSwitcher的 active Team 管理判断中移除userRole === 'admin'这一特殊分支,并在 UI 或文档中明确该限制。
- 如果
- 删除操作应保留明确的二次确认和级联影响说明。
Error Logs / Screenshots | 报错日志/截图
没有运行时错误日志。问题表现为入口不可见;已知 team_id 时,非 owner / Team member admin 的删除请求返回 403。
Additional context | 补充信息
MemoryPanel/web/src/layouts/GlobalHeader/TeamSwitcher.tsx:只对 active Team 渲染操作按钮;对于已经出现在列表中的 active Team,userRole === 'admin'会直接使canManageActiveTeam成立,无需当前用户是该 Team 的 owner 或 member admin。MemoryPanel/web/src/layouts/GlobalHeader/team-switcher.css:操作区默认透明,仅在 hover / focus 时显示。MemoryPanel/web/src/lib/api/teams.ts:Team 列表仍按当前用户的user_id请求。MemoryCore/src/metadata/service/metadata-service.ts:Team 删除仅允许 owner 或 Team member admin,未检查ctx.isSystemAdmin。
该问题存在于上游仓库当前实现中。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with MemoryPanel/web/src/layouts/GlobalHeader/TeamSwitcher.tsx and team-switcher.css to trace the current Team actions, then inspect MemoryPanel/web/src/lib/api/teams.ts for list behavior. Read MemoryCore/src/metadata/service/metadata-service.ts to compare deletion authorization. Done means the chosen system_admin policy, Team visibility, deletion entry point, backend authorization, and confirmation behavior are consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- authorization, backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100