currentUser returns the authenticated user from the request context, or nil if no user is authenticated.
(r *http.Request)
| 512 | // currentUser returns the authenticated user from the request context, |
| 513 | // or nil if no user is authenticated. |
| 514 | func currentUser(r *http.Request) *models.User { |
| 515 | u, _ := r.Context().Value(ctxCurrentUser).(*models.User) |
| 516 | return u |
| 517 | } |
| 518 | |
| 519 | // isAPITokenAuth returns true if the request was authenticated via an API token |
| 520 | // (not a session cookie or CLI session). Use this to gate sensitive operations |
no outgoing calls