MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / handleUserInbound

Method handleUserInbound

internal/serverapi/users.go:409–441  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request, userID, ibID string)

Source from the content-addressed store, hash-verified

407}
408
409func (a *userAPI) handleUserInbound(w http.ResponseWriter, r *http.Request, userID, ibID string) {
410 switch r.Method {
411 case http.MethodGet:
412 acc, err := a.users.GetUserInbound(ibID)
413 if err != nil {
414 writeUserInboundError(w, err)
415 return
416 }
417 if acc.UserID != userID {
418 writeJSON(w, http.StatusNotFound, map[string]any{"error": "user inbound not found"})
419 return
420 }
421 writeJSON(w, http.StatusOK, acc)
422 case http.MethodDelete:
423 acc, err := a.users.GetUserInbound(ibID)
424 if err != nil {
425 writeUserInboundError(w, err)
426 return
427 }
428 if acc.UserID != userID {
429 writeJSON(w, http.StatusNotFound, map[string]any{"error": "user inbound not found"})
430 return
431 }
432 if err := a.users.DeleteUserInbound(ibID); err != nil {
433 writeUserInboundError(w, err)
434 return
435 }
436 a.applyNodes([]string{acc.NodeID})
437 writeJSON(w, http.StatusOK, map[string]any{"deleted": true})
438 default:
439 writeMethodNotAllowed(w, http.MethodGet+", "+http.MethodDelete)
440 }
441}
442
443// handleUserCredentials 管理用户全局凭证(UUID / Secret)。
444// GET 返回当前凭证;PUT 更新凭证(留空则重新随机生成),随后触发全节点配置下发。

Callers 1

handleUserRoutesMethod · 0.95

Calls 6

applyNodesMethod · 0.95
writeUserInboundErrorFunction · 0.85
writeMethodNotAllowedFunction · 0.85
writeJSONFunction · 0.70
GetUserInboundMethod · 0.65
DeleteUserInboundMethod · 0.65

Tested by

no test coverage detected