diff options
Diffstat (limited to 'modules/context/api.go')
-rw-r--r-- | modules/context/api.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/context/api.go b/modules/context/api.go index a21e0d7402..8f1ed3f2ce 100644 --- a/modules/context/api.go +++ b/modules/context/api.go @@ -275,6 +275,17 @@ func APIContexter() func(http.Handler) http.Handler { ctx.Data["CsrfToken"] = html.EscapeString(ctx.csrf.GetToken()) next.ServeHTTP(ctx.Resp, ctx.Req) + + // Handle adding signedUserName to the context for the AccessLogger + usernameInterface := ctx.Data["SignedUserName"] + identityPtrInterface := ctx.Req.Context().Value(signedUserNameStringPointerKey) + if usernameInterface != nil && identityPtrInterface != nil { + username := usernameInterface.(string) + identityPtr := identityPtrInterface.(*string) + if identityPtr != nil && username != "" { + *identityPtr = username + } + } }) } } |