resolveAgentForUser loads an agent by email address and verifies the user owns it.
(r *http.Request, email string, user *identity.User)
| 868 | |
| 869 | // resolveAgentForUser loads an agent by email address and verifies the user owns it. |
| 870 | func (a *API) resolveAgentForUser(r *http.Request, email string, user *identity.User) (*identity.AgentIdentity, error) { |
| 871 | agent, err := a.store.GetAgentByEmail(r.Context(), email) |
| 872 | if err != nil { |
| 873 | return nil, fmt.Errorf("agent not found") |
| 874 | } |
| 875 | if agent.UserID != user.ID { |
| 876 | return nil, fmt.Errorf("forbidden") |
| 877 | } |
| 878 | return agent, nil |
| 879 | } |
| 880 | |
| 881 | // --- Domain Management --- |
| 882 |
nothing calls this directly
no test coverage detected