Unable to delete account if the project is removed
- 主要語言
- Java
- 星號
- 3.1k
- 分支
- 1.4k
- 平均合併
- 6 天 19 小時
- 30 天內合併 PR
- 32
描述
### problem
Unable to delete account if the project is removed
### versions
ACS 4.22
### The steps to reproduce the bug
1. Create a project
2. Create a account/user with User role
3. Add User to the project, Select the project role as Admin
5. Delete the project with clean up option
6. Delete the user
7. Disable the account and Delete the account >> Exception observed
```
2026-02-06 05:19:09,201 DEBUG [c.c.a.ApiServer] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) Retrieved cmdEventType from job info: ACCOUNT.DELETE
2026-02-06 05:19:09,203 INFO [o.a.c.f.j.i.AsyncJobMonitor] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:92e3ffb4) Add job-166 into job monitoring
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) submit async job-166, details: AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,204 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl$5] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Executing AsyncJob {"accountId":2,"cmd":"org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd","cmdInfo":"{\"response\":\"json\",\"ctxUserId\":\"2\",\"sessionkey\":\"nDTziuDnO4qxnRScKDVyKQTZukU\",\"httpmethod\":\"POST\",\"ctxStartEventId\":\"623\",\"id\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"ctxDetails\":\"{\\\"interface com.cloud.user.Account\\\":\\\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\\\"}\",\"ctxAccountId\":\"2\",\"uuid\":\"f004ffb3-f8d0-4297-8951-fc83bdd10fad\",\"cmdEventType\":\"ACCOUNT.DELETE\"}","cmdVersion":0,"completeMsid":null,"created":null,"id":166,"initMsid":32988016411316,"instanceId":12,"instanceType":"Account","lastPolled":null,"lastUpdated":null,"processStatus":0,"removed":null,"result":null,"resultCode":0,"status":"IN_PROGRESS","userId":2,"uuid":"1ba7a022-f715-4df5-a771-99e59e80e38f"}
2026-02-06 05:19:09,205 DEBUG [c.c.a.ApiServlet] (qtp1390913202-23:[ctx-52b15b57, ctx-b39021de]) (logid:c0aa78bd) ===END=== 10.0.3.251 -- POST
command=deleteAccount
response=json
id=f004ffb3-f8d0-4297-8951-fc83bdd10fad
sessionkey=nDTziuDnO4qxnRScKDVyKQTZukU
2026-02-06 05:19:09,207 DEBUG [c.c.u.AccountManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166, ctx-32d73b76]) (logid:1ba7a022) Account [Account [{"accountName":"admin","id":2,"uuid":"ef7f35bc-fffc-11f0-8d07-1e009f0002b4"}]] has access to resource.
2026-02-06 05:19:09,223 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl] (API-Job-Executor-22:[ctx-54696ea9, job-166]) (logid:1ba7a022) Complete async job-166, jobStatus: FAILED, resultCode: 431, result: org.apache.cloudstack.api.response.ExceptionResponse/null/{"uuidList":[],"errorcode":"431","errortext":"Unable to delete account [12], because it manages the following project(s): [4]. Please, remove the account from these projects or demote it to a regular project role first."}
```
### What to do about it?
Account should get deleted
貢獻指南
研究方向
從日誌中顯示的 deleteAccount API 和 DeleteAccountCmd 進入點開始,然後重現 issue 中描述的帳戶和專案清理順序。追蹤回報已刪除的專案仍由帳戶管理的失敗。啟用清理並移除專案後,如果帳戶可以被停用並刪除,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- api, backend
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100