currentUser returns the authenticated user from the request context, or nil if no user is authenticated.
(r *http.Request)
| 450 | // currentUser returns the authenticated user from the request context, |
| 451 | // or nil if no user is authenticated. |
| 452 | func currentUser(r *http.Request) *models.User { |
| 453 | u, _ := r.Context().Value(ctxCurrentUser).(*models.User) |
| 454 | return u |
| 455 | } |
| 456 | |
| 457 | // isAPITokenAuth returns true if the request was authenticated via an API token |
| 458 | // (not a session cookie or CLI session). Use this to gate sensitive operations |
no outgoing calls
no test coverage detected