CustomRoleMW adds a custom role cache on the ctx to prevent duplicate db fetches.
(next http.Handler)
| 19 | // CustomRoleMW adds a custom role cache on the ctx to prevent duplicate |
| 20 | // db fetches. |
| 21 | func CustomRoleMW(next http.Handler) http.Handler { |
| 22 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 23 | r = r.WithContext(CustomRoleCacheContext(r.Context())) |
| 24 | next.ServeHTTP(w, r) |
| 25 | }) |
| 26 | } |
| 27 | |
| 28 | // CustomRoleCacheContext prevents needing to lookup custom roles within the |
| 29 | // same request lifecycle. Optimizing this to span requests should be done |
nothing calls this directly
no test coverage detected