UserFromContext extracts the UserInfo from context. Returns nil if not present.
(ctx context.Context)
| 62 | |
| 63 | // UserFromContext extracts the UserInfo from context. Returns nil if not present. |
| 64 | func UserFromContext(ctx context.Context) *UserInfo { |
| 65 | u, _ := ctx.Value(userInfoKey).(*UserInfo) |
| 66 | return u |
| 67 | } |
| 68 | |
| 69 | // RequireRole checks that the context has a user with at least the given role. |
| 70 | // Returns the UserInfo on success or an error suitable for gRPC status responses. |
no outgoing calls