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 摘要。