Let admins delete a signed-in user's account

未关闭
#4,271 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@anth-volk 已经在做这个了。

开始于 2026年11月10日。

  • #4272 来自 @anth-volk —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
python

调研方向

Start with the existing DELETE /v2/me handler and the admin user routes under /v2/admin/users; the issue names no file or test paths. Trace the deletion transaction, Auth0 cleanup, and advisory lock checks, then inspect the linked pull request #4272 for work already underway. Done means the admin route and shared deletion behavior meet the listed status, authorization, logging, and Auth0 cleanup requirements.

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

描述

Admins can list signed-in users, read one, change their types and read their type history under /v2/admin/users (#4261), but cannot delete a user's account. Users can delete only their own, with DELETE /v2/me.

Add DELETE /v2/admin/users/{user_id} so that an admin can delete another signed-in user's account and saved records, including the Auth0 users of its sign-in identities, exactly as DELETE /v2/me deletes one's own:

  • prepare the Auth0 Management deleter before touching data (503 with nothing deleted when it can't be prepared);
  • 204 on success, 502 when an Auth0 deletion fails after the data is gone, 404 for an absent or unauthenticated user ID, 409 for the last admin;
  • after the data is deleted, try every one of the account's Auth0 users before reporting a failure, for this route and for DELETE /v2/me, and say how many remain;
  • admins only (403 below admin): the router's admin check, plus a check inside the deletion's own transaction under the user-type change advisory lock, as type changes do;
  • an admin deleting their own account through this route follows the same last-admin rule as DELETE /v2/me;
  • record each deletion as a log event naming the admin's and the deleted user's v2 IDs, never emails or tokens;
  • share the deletion logic with DELETE /v2/me rather than copying it.
主要语言
Python
星标
18
派生
33
平均合并
2 天 10 小时
30 天内合并 PR
124

环境准备

从这里开始

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

PolicyEngine/policyengine-api 的其他 Issue

查看 PolicyEngine/policyengine-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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