UserFromContext returns the current logged in user.
(ctx context.Context)
| 28 | |
| 29 | // UserFromContext returns the current logged in user. |
| 30 | func UserFromContext(ctx context.Context) *User { |
| 31 | user, _ := ctx.Value(userContextKey).(*User) |
| 32 | return user |
| 33 | } |
| 34 | |
| 35 | // UserIDFromContext is a helper function that returns the ID of the current |
| 36 | // logged in user. Returns zero if no user is logged in. |