mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
feat(users): cascade delete user-owned inbounds when deleting user
This commit is contained in:
parent
0775c5f10d
commit
78767c082e
1 changed files with 12 additions and 0 deletions
|
|
@ -105,6 +105,18 @@ func (a *UserController) deleteUser(c *gin.Context) {
|
|||
}
|
||||
|
||||
currentUser := session.GetLoginUser(c)
|
||||
inbounds, err := a.inboundService.GetInbounds(id)
|
||||
if err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), err)
|
||||
return
|
||||
}
|
||||
for _, inbound := range inbounds {
|
||||
if _, err := a.inboundService.DelInbound(inbound.Id); err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = a.userService.DeleteUser(id, currentUser.Id)
|
||||
if err != nil {
|
||||
jsonMsg(c, I18nWeb(c, "pages.users.toasts.delete"), a.localizeUserError(c, err))
|
||||
|
|
|
|||
Loading…
Reference in a new issue