MCPcopy
hub / github.com/mudler/LocalAI / GetUser

Function GetUser

core/http/auth/middleware.go:205–211  ·  view source on GitHub ↗

GetUser returns the authenticated user from the echo context, or nil.

(c echo.Context)

Source from the content-addressed store, hash-verified

203
204// GetUser returns the authenticated user from the echo context, or nil.
205func GetUser(c echo.Context) *User {
206 u, ok := c.Get(contextKeyUser).(*User)
207 if !ok {
208 return nil
209 }
210 return u
211}
212
213// GetUserRole returns the role of the authenticated user, or empty string.
214func GetUserRole(c echo.Context) string {

Callers 15

UsageMiddlewareFunction · 0.92
recordHTTPDecisionFunction · 0.92
TraceMiddlewareFunction · 0.92
middleware_test.goFile · 0.92
resolveUsageUserFunction · 0.92
RegisterAuthRoutesFunction · 0.92
usageHandlerFunction · 0.92
newTestAuthAppFunction · 0.92
RegisterUIAPIRoutesFunction · 0.92
ownerFromContextFunction · 0.92
isCurrentUserAdminFunction · 0.92
requireAssistantAccessFunction · 0.92

Calls 1

GetMethod · 0.65

Tested by 2

usageHandlerFunction · 0.74
newTestAuthAppFunction · 0.74