fix(user): revoke tunnel access when disabling users (#568)

Revoke tunnel grants and pause each forwarding entry without self-healing missing services. Continue healthy nodes and other forwards after failures, aggregate pending nodes for retry, and show persistent partial-disable feedback.

Related: #562
This commit is contained in:
sagit
2026-11-01 18:03:07 +08:00
committed by GitHub
parent 3549fe5ad8
commit 46bfb86c1b
8 changed files with 775 additions and 32 deletions
@@ -205,6 +205,15 @@ func (h *Handler) userUpdate(w http.ResponseWriter, r *http.Request) {
}
}
if status != 1 {
// Revoke access before optional quota/group updates can fail or return.
if err := h.disableUserAccess(id, now); err != nil {
result := response.Err(-2, fmt.Sprintf("账号已禁用,以下权限或节点暂停未确认;其他转发已继续处理,请排查后重试禁用:\n%v", err))
result.Data = map[string]interface{}{"userDisabled": true}
response.WriteJSON(w, result)
return
}
}
h.repo.PropagateUserFlowToTunnels(id, flow, num, expTime, flowResetTime, flowMiB)
if hasDailyQuota || hasMonthlyQuota {
dailyQuotaGB := asInt64(req["dailyQuotaGB"], 0)
@@ -243,6 +252,13 @@ func (h *Handler) userUpdate(w http.ResponseWriter, r *http.Request) {
}
}
}
if status != 1 {
// Group changes may have created additional tunnel grants.
if err := h.repo.DisableUserTunnels(id); err != nil {
response.WriteJSON(w, response.Err(-2, err.Error()))
return
}
}
if oldUser.MaxConn != maxConn {
warnings, syncErr := h.syncUserMaxConnForwards(id)
if syncErr != nil {