MCPcopy Index your code
hub / github.com/coder/coder / UserParam

Function UserParam

coderd/httpmw/userparam.go:26–32  ·  view source on GitHub ↗

UserParam returns the user from the ExtractUserParam handler.

(r *http.Request)

Source from the content-addressed store, hash-verified

24
25// UserParam returns the user from the ExtractUserParam handler.
26func UserParam(r *http.Request) database.User {
27 user, ok := r.Context().Value(userParamContextKey{}).(database.User)
28 if !ok {
29 panic("developer error: user parameter middleware not provided")
30 }
31 return user
32}
33
34func UserParamOptional(r *http.Request) (database.User, bool) {
35 user, ok := r.Context().Value(userParamContextKey{}).(database.User)

Callers 15

postUserSecretMethod · 0.92
getUserSecretsMethod · 0.92
getUserSecretMethod · 0.92
patchUserSecretMethod · 0.92
deleteUserSecretMethod · 0.92
userDebugOIDCMethod · 0.92
deleteUserMethod · 0.92
userByNameMethod · 0.92
userLoginTypeMethod · 0.92
putUserProfileMethod · 0.92
putUserStatusMethod · 0.92

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by 1

TestUserParamFunction · 0.74