MCPcopy Index your code
hub / github.com/apache/answer / GetUserInfoFromContext

Function GetUserInfoFromContext

internal/base/middleware/auth.go:288–298  ·  view source on GitHub ↗

GetUserInfoFromContext get user info from context

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

286
287// GetUserInfoFromContext get user info from context
288func GetUserInfoFromContext(ctx *gin.Context) (u *entity.UserCacheInfo) {
289 userInfo, exist := ctx.Get(ctxUUIDKey)
290 if !exist {
291 return nil
292 }
293 u, ok := userInfo.(*entity.UserCacheInfo)
294 if !ok {
295 return nil
296 }
297 return u
298}
299
300func GetUserIsAdminModerator(ctx *gin.Context) (isAdminModerator bool) {
301 userInfo, exist := ctx.Get(ctxUUIDKey)

Callers 6

GetObjectTimelineMethod · 0.92
UserVerifyEmailSendMethod · 0.92
ActionRecordMethod · 0.92
EjectUserBySiteInfoMethod · 0.85
GetIsAdminFromContextFunction · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected