GetUserInfoFromContext get user info from context
(ctx *gin.Context)
| 286 | |
| 287 | // GetUserInfoFromContext get user info from context |
| 288 | func 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 | |
| 300 | func GetUserIsAdminModerator(ctx *gin.Context) (isAdminModerator bool) { |
| 301 | userInfo, exist := ctx.Get(ctxUUIDKey) |
no test coverage detected